Click or drag to resize
Ab4d.SharpEngine logo

SpriteBatchDrawSprite(Vector2, Color4, Single, Single, Single, Boolean) Method

DrawSprite method draws the current texture to the specified position and using the specified scale (1 by default) and rotation (0 by default). The colors in the texture are multiplied by the specified colorMask. See remarks for more info.

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public void DrawSprite(
	Vector2 topLeftPosition,
	Color4 colorMask,
	float scaleX = 1f,
	float scaleY = 1f,
	float rotationAngleDegrees = 0f,
	bool isPreMultipliedAlpha = false
)

Parameters

topLeftPosition  Vector2
position as Vector2
colorMask  Color4
color that is multiplied by each pixel in the texture
scaleX  Single  (Optional)
scale x (1 by default)
scaleY  Single  (Optional)
scale Y (1 by default)
rotationAngleDegrees  Single  (Optional)
clockwise rotation angle in degrees (0 by default)
isPreMultipliedAlpha  Boolean  (Optional)
specifies if the colorMask is specified as pre-multiplied alpha color (false by default)
Remarks

DrawSprite method draws the current texture to the specified position and using the specified scale (1 by default) and rotation (0 by default).

Before calling this method, the current texture must be set by calling the SetSpriteTexture(GpuImage) method.

The topLeftPosition can be specified in relative coordinates (valid range is from 0 to 1) or in absolute coordinates (valid range is from 0 to size of view). Absolute coordinates are supported only when the SpriteBatch is created from SceneView (in this case the AreAbsoluteCoordinatesSupported is true). To use absolute coordinates call Begin(Boolean, Int32) method and set useAbsoluteCoordinates parameter to true or set the IsUsingAbsoluteCoordinates property to true.

When rotationAngleDegrees is specified (0 by default), then the sprite is rotated around the center position.

When IsUsingDpiScale is true, then size of view is defined as (sceneView.Width / DpiScaleX, sceneView.Height / DpiScaleY). When IsUsingDpiScale is false (by default) then size of the view is the same as size of the SceneView.

See Also