Module stamp

Stamp related variables and functions.

Functions

getBounds () Returns the bounds of the stamp as a Rectangle, relative to itself.
getRect () Returns the bounds of the stamp as a Rectangle, relative to itself, excluding any strokes on shapes.
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.
drawTextField (textfield, x, y, scaleX, scaleY, rotation) Renders a given text field to the stamp using a given translation, scaling, and rotation.
drawDisplayObject (The, x, y, scaleX, scaleY, rotation) Renders a given display object 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.
setPixels (hexARGB, x, y, width, height) Sets the ARGB values (alpha and color) of the pixels within the given rectangle, based on a string input.
noise (randomSeed, low, high, channelOptions, grayScale) Fills the stamp with randomly generated noise
perlinNoise (baseX, baseY, numOctaves, randomSeed, stitch, fractalNoise, channelOptions, grayScale, offsetsArray) Fills the stamp with randomly generated perlin noise.
scroll (x, y) Scrolls the contents of the stamp.
floodFill (x, y, color) Performs a flood fill operation starting at an (x,y) coordinate, filling with a given color.
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.
smoothing Controls whether or not the bitmap is smoothed when scaled or rotated.
x The x position, in pixels, of the stamp when it is the child of a sprite.
y The y position, in pixels, of the stamp when it is the child of a sprite.
scaleX The horizontal scale of the stamp when it is the child of a sprite.
scaleY The vertical scale of the stamp when it is the child of a sprite.
scaleY The vertical scale of the stamp when it is the child of a sprite.
rotation The rotation of the stamp, in degrees, when it is the child of a sprite.
alpha The alpha of the stamp, represented by a number in the range of 0 - 1.
redMultiplier A number value that is multiplied with the red color channel when drawn.
greenMultiplier A number value that is multiplied with the green color channel when drawn.
blueMultiplier A number value that is multiplied with the blue color channel when drawn.
colorMultiplier Sets red, green, and blue multipliers based on a hexadecimal RGB value (e.g.
alphaOffset A number value from -255 to 255 that is added to the alpha channel after it is multiplied by alpha.
redOffset A number value from -255 to 255 that is added to the alpha channel after it is multiplied by redMultiplier.
greenOffset A number value from -255 to 255 that is added to the alpha channel after it is multiplied by greenMultiplier.
blueOffset A number value from -255 to 255 that is added to the alpha channel after it is multiplied by blueMultiplier.
blendMode The blend mode of the stamp.
destroyed Whether or not the stamp was destroyed.


Functions

getBounds ()
Returns the bounds of the stamp as a Rectangle, relative to itself.

Returns:

    Rectangle The bounds of the stamp
getRect ()
Returns the bounds of the stamp as a Rectangle, relative to itself, excluding any strokes on shapes.

Returns:

    Rectangle The bounds of the stamp
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:

drawTextField (textfield, x, y, scaleX, scaleY, rotation)
Renders a given text field to the stamp using a given translation, scaling, and rotation.

Parameters:

  • textfield textfield The text field to render to the stamp.
  • x number By how many pixels along the x-axis to move the text field when rendering to the stamp. By default 0.
  • y number By how many pixels along the y-axis to move the text field when rendering to the stamp. By default 0.
  • scaleX number By how much to scale the text field along the x-axis when rendering to the stamp. By default 1.
  • scaleY number By how much to scale the text field along the y-axis when rendering to the stamp. By default 1.
  • rotation number By how many degrees to rotate the text field when rendering to the stamp. By default 0.

See also:

drawDisplayObject (The, x, y, scaleX, scaleY, rotation)
Renders a given display object to the stamp using a given translation, scaling, and rotation. A display object can be a sprite, stamp, or text field.

Parameters:

  • The stamp/sprite/textfield display object to render to the stamp.
  • x number By how many pixels along the x-axis to move the display object when rendering to the stamp. By default 0.
  • y number By how many pixels along the y-axis to move the display object when rendering to the stamp. By default 0.
  • scaleX number By how much to scale the display object along the x-axis when rendering to the stamp. By default 1.
  • scaleY number By how much to scale the display object along the y-axis when rendering to the stamp. By default 1.
  • rotation number By how many degrees to rotate the display object when rendering to the stamp. By default 0.
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.
setPixels (hexARGB, x, y, width, height)
Sets the ARGB values (alpha and color) of the pixels within the given rectangle, based on a string input.

Parameters:

  • hexARGB string A string containing ARGB data for each pixel in the hexadecimal format (e.g "FF808080FF000000" for the first pixel to be gray and the second pixel to be black)
  • x int The x-coordinate of the top left corner of the rectangle. 0 by default.
  • y int The y-coordinate of the top left corner of the rectangle. 0 by default.
  • width int The width of the rectangle. Stamp width by default.
  • height int The height of the rectangle. Stamp height by default.

Usage:

    local strBuff = {}
    local i = 1
    for x = 0, 63 do
        for y = 0, 63 do
            strBuff[i] = string.format("%.8x",0xFF000000 + math.random(0xFFFFFF)) -- Generate a random color for the pixel, and format it as a hex string.
            i = i + 1
        end
    end
    someStamp.setPixels(table.concat(strBuff),0,0,64,64) -- Set each pixel to a be a fully opaque random color
noise (randomSeed, low, high, channelOptions, grayScale)
Fills the stamp with randomly generated noise

Parameters:

  • randomSeed int The seed to use for random numbers.
  • low int The lowest value to generate for each channel.
  • high int The highest value to generate for each channel.
  • channelOptions int An integer indication for which color channels to put noise in.
  • grayScale boolean Whether the noise is grayscale or not. False by default.

Usage:

    someStamp.noise(512356,0x00,0xFF,7,false) -- Generates randomly colored noise
perlinNoise (baseX, baseY, numOctaves, randomSeed, stitch, fractalNoise, channelOptions, grayScale, offsetsArray)
Fills the stamp with randomly generated perlin noise. https://airsdk.dev/reference/actionscript/3.0/flash/display/BitmapData.html#perlinNoise()

Parameters:

  • baseX int Frequency to use in the X direction.
  • baseY int Frequency to use in the Y direction.
  • numOctaves int Number of octaves to use for fractal noise. Higher numbers create greater detail, at the cost of more processing time.
  • randomSeed int The seed to use for random numbers.
  • stitch boolean If true, the method attempts to smooth the transition edges of the image to create seamless textures for tiling as a bitmap fill. Does not work with offsets.
  • fractalNoise boolean If true, generates fractal noise, otherwise generates turbulence. An image with turbulence has visible discontinuities in the gradient that can make it better approximate sharper visual effects.
  • channelOptions int An integer indication for which color channels to put noise in.
  • grayScale boolean Whether the noise is grayscale or not. False by default.
  • offsetsArray An AS3 array of numbers to use as the offsets, formatted as {x1, y1, x2, y2, ..., xn, yn}

Usage:

    someStamp.perlinNoise(120,120,3,math.random(0x7FFFFFFF),false,true,7,true,toarray{12,12,32,-12,-16,16}) -- Generates grayscale perlin noise.
scroll (x, y)
Scrolls the contents of the stamp.

Parameters:

  • x int How much to scroll in the x direction.
  • y int How much to scroll in the y direction.
floodFill (x, y, color)
Performs a flood fill operation starting at an (x,y) coordinate, filling with a given color.

Parameters:

  • x int How much to scroll in the x direction.
  • y int How much to scroll in the y direction.
  • color int The ARGB value for the color to fill with.
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.
smoothing
Controls whether or not the bitmap is smoothed when scaled or rotated. https://airsdk.dev/reference/actionscript/3.0/flash/display/Bitmap.html#Bitmap()
x
The x position, in pixels, of the stamp when it is the child of a sprite. By default 0.
y
The y position, in pixels, of the stamp when it is the child of a sprite. By default 0.
scaleX
The horizontal scale of the stamp when it is the child of a sprite. By default 1.
scaleY
The vertical scale of the stamp when it is the child of a sprite. By default 1.
scaleY
The vertical scale of the stamp when it is the child of a sprite. By default 1.
rotation
The rotation of the stamp, in degrees, when it is the child of a sprite. By default 0.
alpha
The alpha of the stamp, represented by a number in the range of 0 - 1. An alpha of 0 means the stamp is completely transparent; 1 means fully visible. By default 1.
redMultiplier
A number value that is multiplied with the red color channel when drawn. By default 1.
greenMultiplier
A number value that is multiplied with the green color channel when drawn. By default 1.
blueMultiplier
A number value that is multiplied with the blue color channel when drawn. By default 1.
colorMultiplier
Sets red, green, and blue multipliers based on a hexadecimal RGB value (e.g. 0xFF0000). Write-only.
alphaOffset
A number value from -255 to 255 that is added to the alpha channel after it is multiplied by alpha. By default 0.
redOffset
A number value from -255 to 255 that is added to the alpha channel after it is multiplied by redMultiplier. By default 0.
greenOffset
A number value from -255 to 255 that is added to the alpha channel after it is multiplied by greenMultiplier. By default 0.
blueOffset
A number value from -255 to 255 that is added to the alpha channel after it is multiplied by blueMultiplier. By default 0.
blendMode
The blend mode of the stamp. Use BlendMode enum values. By default BlendMode.NORMAL.

See also:

destroyed
Whether or not the stamp was destroyed. Calling destroy sets this to true. Read-only.
generated by LDoc 1.5.0 Last updated 2025-12-17 05:13:02