Module stamp
Stamp related variables and functions.
Functions
drawStamp (stamp, x, y, scaleX, scaleY, rotation) | Renders a given stamp to the stamp using a given translation, scaling, and rotation. |
drawSprite (sprite, x, y, scaleX, scaleY, rotation) | Renders a given sprite to the stamp using a given translation, scaling, and rotation. |
setPixel (x, y, color) | Sets the ARGB value (alpha and color) of the pixel at the given coordinate. |
setRect (x, y, width, height, color) | Sets the ARGB value (alpha and color) of the pixels within the given rectangle. |
clone () | Creates a copy of the stamp with identical contents. |
destroy () | Destroys the stamp, making it unable to be drawn to or rendered from. |
clear () | Clears the stamp, emptying its contents without destroying the stamp. |
Fields
width | The width, in pixels, of the stamp. |
height | The height, in pixels, of the stamp. |
blendMode | The blend mode of the stamp. |
destroyed | Whether or not the stamp was destroyed. |
Functions
- drawStamp (stamp, x, y, scaleX, scaleY, rotation)
-
Renders a given stamp to the stamp using a given translation, scaling, and rotation.
Parameters:
- stamp stamp The sprite to render to the stamp.
- x number By how many pixels along the x-axis to move the stamp when rendering to the stamp. By default 0.
- y number By how many pixels along the y-axis to move the stamp when rendering to the stamp. By default 0.
- scaleX number By how much to scale the stamp along the x-axis when rendering to the stamp. By default 1.
- scaleY number By how much to scale the stamp along the y-axis when rendering to the stamp. By default 1.
- rotation number By how many degrees to rotate the stamp when rendering to the stamp. By default 0
- drawSprite (sprite, x, y, scaleX, scaleY, rotation)
-
Renders a given sprite to the stamp using a given translation, scaling, and rotation.
Parameters:
- sprite sprite The sprite to render to the stamp.
- x number By how many pixels along the x-axis to move the sprite when rendering to the stamp. By default 0.
- y number By how many pixels along the y-axis to move the sprite when rendering to the stamp. By default 0.
- scaleX number By how much to scale the sprite along the x-axis when rendering to the stamp. By default 1.
- scaleY number By how much to scale the sprite along the y-axis when rendering to the stamp. By default 1.
- rotation number By how many degrees to rotate the sprite when rendering to the stamp. By default 0.
See also:
- setPixel (x, y, color)
-
Sets the ARGB value (alpha and color) of the pixel at the given coordinate.
Parameters:
- x int The x-coordinate of the pixel.
- y int The y-coordinate of the pixel.
- color int The ARGB value of the pixel. The simplest way to calculate this is with the 0xAARRGGBB hex format, where AA is the hex value from 0 - 255 for the alpha, RR for red, GG for green, and BB for blue.
Usage:
someStamp.setPixel(10, 10, 0xFF00FF00) -- Sets the pixel at (10, 10) to fully opaque green.
- setRect (x, y, width, height, color)
-
Sets the ARGB value (alpha and color) of the pixels within the given rectangle.
Parameters:
- x int The x-coordinate of the top left corner of the rectangle.
- y int The y-coordinate of the top left corner of the rectangle.
- width int The width of the rectangle.
- height int The height of the rectangle.
- color int The ARGB value of the pixel. The simplest way to calculate this is with the 0xAARRGGBB hex format, where AA is the hex value from 0 - 255 for the alpha, RR for red, GG for green, and BB for blue.
Usage:
someStamp.setPixel(10, 10, 0xFF00FF00) -- Sets the pixel at (10, 10) to fully opaque green.
- clone ()
-
Creates a copy of the stamp with identical contents.
Returns:
-
stamp
Returns the clone of the stamp
- destroy ()
- Destroys the stamp, making it unable to be drawn to or rendered from.
- clear ()
- Clears the stamp, emptying its contents without destroying the stamp.
Fields
- width
- The width, in pixels, of the stamp. By default 64. Read-only.
- height
- The height, in pixels, of the stamp. By default 64. Read-only.
- blendMode
- The blend mode of the stamp. By default "normal". Valid blend modes are defined here: https://airsdk.dev/reference/actionscript/3.0/flash/display/BlendMode.html
- destroyed
- Whether or not the stamp was destroyed. Calling destroy sets this to true. Read-only.