Fork me on GitHub

Base class for graphics type. Do not use this directly, instead use the classes in haxepunk.graphics.

Variables

active : Bool

If the graphic should update.

alpha : Float

Change the opacity of the Image, a value from 0 to 1.

blend : BlendMode

Optional blend mode to use when drawing this image. Use constants from the haxepunk.utils.BlendMode class.

clipRect : Rectangle

Optional rectangle to clip the portion of this graphic that will be drawn.


Available since:

4.0.0

color : Color

The tinted color of the Image. Use 0xFFFFFF to draw the Image normally.

flexibleLayer : Bool

If true, this graphic may sometimes "fall through" other textures to reduce the number of draw calls. This can affect layering.

originX : Float

X origin of the graphic, determines transformation point. Defaults to top-left corner.

originY : Float

Y origin of the graphic, determines transformation point. Defaults to top-left corner.

pixelSnapping : Bool

Whether this graphic will be snapped to the nearest whole number pixel position when rendering. If pixelSnapping is set to true on the Camera, snapping will occur regardless of this setting. Some graphics like Tilemap set this to true by default.

relative : Bool

If the graphic should render at its position relative to its parent Entity's position.

scrollX : Float

X scrollfactor, effects how much the camera offsets the drawn graphic. Can be used for parallax effect, eg. Set to 0 to follow the camera, 0.5 to move at half-speed of the camera, or 1 (default) to stay still.

scrollY : Float

Y scrollfactor, effects how much the camera offsets the drawn graphic. Can be used for parallax effect, eg. Set to 0 to follow the camera, 0.5 to move at half-speed of the camera, or 1 (default) to stay still.

shader : Shader

The shader to use when drawing this graphic.


Available since:

4.0.0

smooth : Bool

If the image should be drawn transformed with pixel smoothing. This will affect drawing performance, but look less pixelly.

Default value: false if HXP.stage.quality is LOW, true otherwise.

visible : Bool

If the graphic should render.

x : Float

X offset.

y : Float

Y offset.

Functions

View source

centerOrigin () : Void

Center the Origin of this graphic.

View source

destroy () : Void

Removes the graphic from the scene

View source

floorX (camera : Camera, x : Float) : Float

View source

floorY (camera : Camera, y : Float) : Float

View source

isPixelPerfect (camera : Camera) : Bool

View source

pause () : Void

Pause updating this graphic.

View source

pixelPerfectRender (point : Vector2, camera : Camera) : Void

Renders the graphic, taking extra care to snap pixel locations and lengths to whole number positions. Not all graphics need a separate pixelPerfectRender implementation; by default this will just call render.


Parameters:
point   

The position to draw the graphic.

camera   

The camera offset.

View source

resume () : Void

Resume updating this graphic.

View source

toString () : String