bitmap#
A 2D canvas of pixels for drawing to.
Variables#
Constructors#
Functions#
int |
GetPixel(int x, int y) |
int |
CountColor(bitmap mask, int x, int y, int checkColor, int maskColor = |
void |
Rectangle(int layer, int x, int y, int x2, int y2, int color, int scale = |
void |
Circle(int layer, int x, int y, int radius, int color, int scale = |
void |
Arc(int layer, int x, int y, int radius, int startangle, int endangle, int color, int scale = |
void |
Ellipse(int layer, int x, int y, int xradius, int yradius, int color, int scale = |
void |
Line(int layer, int x, int y, int x2, int y2, int color, int scale = |
void |
Spline(int layer, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int color, int opacity = |
void |
PutPixel(int layer, int x, int y, int color, int rx = |
void |
DrawCharacter(int layer, int x, int y, int font, int color, int background_color, int width, int height, char32 char, int opacity = |
void |
DrawInteger(int layer, int x, int y, int font, int color, int background_color, int width, int height, int number, int number_decimal_places = |
void |
DrawTile(int layer, int x, int y, int tile, int blockw, int blockh, int cset, int xscale = |
void |
DrawTileCloaked(int layer, int x, int y, int tile, int blockw, int blockh, int flip = |
void |
DrawCombo(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9 = |
void |
DrawComboCloaked(int layer, int x, int y, int combo, int tilewidth, int tileheight, int flip = |
void |
Quad(int layer, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int w, int h, int cset, int flip, int texture, int render_mode, bitmap render_source = |
void |
Triangle(int layer, int x1, int y1, int x2, int y2, int x3, int y3, int w, int h, int cset, int flip, int texture, int render_mode, bitmap render_source) |
void |
Quad3D(int layer, int pos, int uv, int cset, int size, int flip, int texture, int polytype, bitmap render_source) |
void |
Triangle3D(int layer, int pos, int uv, int csets, int size, int flip, int tile, int polytype, bitmap render_source) |
void |
FastTile(int layer, int x, int y, int tile, int cset, int opacity = |
void |
FastCombo(int layer, int x, int y, int combo, int cset, int opacity = |
void |
DrawString(int layer, int x, int y, int font, int color, int background_color, int format, char32[] str, int opacity = |
void |
DrawString(int layer, int x, int y, int font, int color, int background_color, int format, char32[] str, int opacity, int shadow_type, int shadow_color) |
void |
DrawLayer(int layer, int source_map, int source_screen, int source_layer, int x, int y, int rotation = |
void |
DrawScreen(int layer, int map, int source_screen, int x, int y, int rotation = |
void |
Blit(int layer, untyped target, int source_x, int source_y, int source_w, int source_h, int dest_x, int dest_y, int dest_w, int dest_h, int rotation = |
void |
BlitTo(int layer, untyped source, int source_x, int source_y, int source_w, int source_h, int dest_x, int dest_y, int dest_w, int dest_h, int rotation = |
void |
TileBlit(int layer, int tile, int cset, int source_x, int source_y, int source_w, int source_h, int dest_x, int dest_y, int dest_w, int dest_h, int rotation = |
void |
ComboBlit(int layer, int combo, int cset, int source_x, int source_y, int source_w, int source_h, int dest_x, int dest_y, int dest_w, int dest_h, int rotation = |
void |
DrawPlane(int layer, untyped src, int src_x, int src_y, int dest_x, int dest_y, int dest_w, int dest_h, int space_z, int horizon, int scale_x = |
bool |
isValid() |
bool |
|
void |
Write(int layer, char32[] filename, bool allow_overwrite = |
void |
Read(int layer, char32[] filename) |
void |
Create(int layer = |
void |
Polygon(int layer, int num_points, int[] vertices, int colour, int opacity = |
void |
ClearToColor(int layer, int color) |
void |
Free() deprecated |
void |
Own() |
void |
DrawFrame(int layer, int x, int y, int tile, int cset, int width, int height, bool overlay = |
void |
WriteTile(int layer, int x, int y, int tile, bool is8bit = |
void |
Dither(int layer, bitmap mask, int color, int ditherType, int ditherArg) |
void |
ReplaceColors(int layer, int color, int startCol, int endCol) |
void |
ShiftColors(int layer, int shift, int startCol, int endCol) |
void |
MaskedDraw(int layer, bitmap mask, int color) |
void |
MaskedDraw(int layer, bitmap mask, int color, int maskColor) |
void |
MaskedDraw(int layer, bitmap mask, int color, int startMaskColor, int endMaskColor) |
void |
MaskedBlit(int layer, bitmap mask, bitmap pattern, bool repeatPattern) |
void |
MaskedBlit(int layer, bitmap mask, bitmap pattern, bool repeatPattern, int maskColor) |
void |
MaskedBlit(int layer, bitmap mask, bitmap pattern, bool repeatPattern, int startMaskColor, int endMaskColor) |
void |
Clear(int layer = |
void |
DrawScreenSolid(int layer, int map, int source_screen, int x, int y, int rotation = |
void |
DrawScreenSolidity(int layer, int map, int source_screen, int x, int y, int rotation = |
void |
DrawScreenComboTypes(int layer, int map, int source_screen, int x, int y, int rotation = |
void |
DrawScreenComboFlags(int layer, int map, int source_screen, int x, int y, int rotation = |
void |
DrawScreenComboIFlags(int layer, int map, int source_screen, int x, int y, int rotation = |
void |
DrawLayerSolid(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) |
void |
DrawLayerSolidity(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) |
void |
DrawLayerComboTypes(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) |
void |
DrawLayerComboFlags(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) |
void |
DrawLayerComboIFlags(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) |
Variable descriptions#
The width of the bitmap *at the start of this frame* in pixels.
The height of the bitmap *at the start of this frame* in pixels.
Constructor descriptions#
bitmap bitmap(int width = 256
, int height = 256
) ๐ Source
Function descriptions#
int GetPixel(int x, int y) ๐ Source
Returns the palette index at the given position on the bitmap *at the start of the frame*.
int CountColor(bitmap mask, int x, int y, int checkColor, int maskColor = -1
) ๐ Source
Checks the area of this bitmap specified by the area on the mask
bitmap
which matches the maskColor
. For a maskColor
of -1
, all non-zero
values will match.
void Rectangle(int layer, int x, int y, int x2, int y2, int color, int scale = 1
, int rx = 0
, int ry = 0
, int rangle = 0
, bool fill = true
, int opacity = 128
) ๐ Source
Identical to Screen->Rectangle(), but it draws to a target bitmap.
void Circle(int layer, int x, int y, int radius, int color, int scale = 1
, int rx = 0
, int ry = 0
, int rangle = 0
, bool fill = true
, int opacity = 128
) ๐ Source
Identical to Screen->Circle(), but it draws to a target bitmap.
void Arc(int layer, int x, int y, int radius, int startangle, int endangle, int color, int scale = 1
, int rx = 0
, int ry = 0
, int rangle = 0
, bool closed = true
, bool fill = true
, int opacity = 128
) ๐ Source
Identical to Screen->Arc(), but it draws to a target bitmap.
void Ellipse(int layer, int x, int y, int xradius, int yradius, int color, int scale = 1
, int rx = 0
, int ry = 0
, int rangle = 0
, bool fill = true
, int opacity = 128
) ๐ Source
Identical to Screen->Ellipse(), but it draws to a target bitmap.
void Line(int layer, int x, int y, int x2, int y2, int color, int scale = 1
, int rx = 0
, int ry = 0
, int rangle = 0
, int opacity = 128
) ๐ Source
Identical to Screen->Line(), but it draws to a target bitmap.
void Spline(int layer, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int color, int opacity = 1
) ๐ Source
Identical to Screen->Spline(), but it draws to a target bitmap.
void PutPixel(int layer, int x, int y, int color, int rx = 0
, int ry = 0
, int rangle = 0
, int opacity = 128
) ๐ Source
Identical to Screen->PutPixel(), but it draws to a target bitmap.
void DrawCharacter(int layer, int x, int y, int font, int color, int background_color, int width, int height, char32 char, int opacity = 128
) ๐ Source
Identical to Screen->DrawCharacter(), but it draws to a target bitmap.
void DrawInteger(int layer, int x, int y, int font, int color, int background_color, int width, int height, int number, int number_decimal_places = 0
, int opacity = 128
) ๐ Source
Identical to Screen->DrawInteger(), but it draws to a target bitmap.
void DrawTile(int layer, int x, int y, int tile, int blockw, int blockh, int cset, int xscale = -1
, int yscale = -1
, int rx = 0
, int ry = 0
, int rangle = 0
, int flip = 0
, bool transparency = true
, int opacity = 128
) ๐ Source
Identical to Screen->DrawTile(), but it draws to a target bitmap.
void DrawTileCloaked(int layer, int x, int y, int tile, int blockw, int blockh, int flip = 0
) ๐ Source
Identical to Screen->DrawTileCloaked(), but it draws to a target bitmap.
void DrawCombo(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9 = -1
, int arg10 = -1
, int arg11 = 0
, int arg12 = 0
, int arg13 = 0
, int arg14 = 0
, bool arg15 = true
, int arg16 = 128
) ๐ Source
void DrawComboCloaked(int layer, int x, int y, int combo, int tilewidth, int tileheight, int flip = 0
) ๐ Source
Identical to Screen->DrawComboCloaked(), but it draws to a target bitmap.
void Quad(int layer, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int w, int h, int cset, int flip, int texture, int render_mode, bitmap render_source = < bitmap > 0
) ๐ Source
Identical to Screen->Quad(), but it draws to a target bitmap, and you can specify a bitmap as your texture.
Pass the bitmap pointer that you want to use to โbitmap render_sourceโ.
If you do not wish to use a bitmap as a texture, pass NULL to the arg โbitmap render_sourceโ.
Use PT_TEXTURE or a similar polytype, to render your bitmap as a texture.
For bitmap textures, specify the exact height and width of the texture as args โwโ and โhโ.
If rendering a bitmap as a texture, the โhโ and โwโ args need not be a power of 2.
If bitmap render_source
!= NULL, then it will use this as the texture,
instead of a tile or combo.
If the pointer supplied to render_source is invalid (contains no data), then this function will default to using a tile.
void Triangle(int layer, int x1, int y1, int x2, int y2, int x3, int y3, int w, int h, int cset, int flip, int texture, int render_mode, bitmap render_source) ๐ Source
void Quad3D(int layer, int pos, int uv, int cset, int size, int flip, int texture, int polytype, bitmap render_source) ๐ Source
Identical to Screen->Quad(), but it draws to a target bitmap, and you can specify a bitmap as your texture.
Pass the bitmap pointer that you want to use to render_source
.
If you do not wish to use a bitmap as a texture, pass NULL to the arg
render_source
.
Use PT_TEXTURE or a similar polytype, to render your bitmap as a texture.
For bitmap textures, specify the exact height and width of the texture as args โwโ and โhโ.
If rendering a bitmap as a texture, the โhโ and โwโ args need not be a power of 2.
If render_source
!= NULL, then it will use this as the texture,
instead of a tile or combo.
If the pointer supplied to render_source
is invalid (contains no data),
then this function will default to using a tile.
void Triangle3D(int layer, int pos, int uv, int csets, int size, int flip, int tile, int polytype, bitmap render_source) ๐ Source
void FastTile(int layer, int x, int y, int tile, int cset, int opacity = 128
) ๐ Source
Draws the specified tile in the specified cset, with the upper-left at (x,y).
void FastCombo(int layer, int x, int y, int combo, int cset, int opacity = 128
) ๐ Source
As Screen->FastTile(), for the current tile of combo
.
void DrawString(int layer, int x, int y, int font, int color, int background_color, int format, char32[] str, int opacity = 128
) ๐ Source
Identical to Screen->DrawString(), but it draws to a target bitmap.
void DrawString(int layer, int x, int y, int font, int color, int background_color, int format, char32[] str, int opacity, int shadow_type, int shadow_color) ๐ Source
Identical to Screen->DrawString(), but it draws to a target bitmap.
void DrawLayer(int layer, int source_map, int source_screen, int source_layer, int x, int y, int rotation = 0
, int opacity = 128
) ๐ Source
Identical to Screen->DrawLayer(), but it draws to a target bitmap.
void DrawScreen(int layer, int map, int source_screen, int x, int y, int rotation = 0
) ๐ Source
void Blit(int layer, untyped target, int source_x, int source_y, int source_w, int source_h, int dest_x, int dest_y, int dest_w, int dest_h, int rotation = 0
, int cx = 0
, int cy = 0
, int mode = 0
, int lit = 0
, bool mask = true
) ๐ Source
BLITS THE BITMAP ON POINTER โbโ TO A TARGET BITMAP.
Like Screen->DrawBitmapEx(), except that it draws FROM an initialised bitmap pointer, TO a target bitmap, which may be a user-created bitmap, or it may be the screen.
To draw to the screen, or to one of the old system bitmaps, use the RT_* value from std_constants.zh as the argument to โbitmap targetโ.
To draw to a user created bitmap, pass its pointer to โbitmap targetโ.
Blit supports multiple MODES, ORโd together as a bitmask:
You can also set a pivot point for the rotation, using int cx
and int cy
If these are non-zero, the rotation anchor point will center on these coordinates.
You may specify a colour to int lit
to use a lit mode. This tints the
entire bitmap using that colour index of the main palette.
void BlitTo(int layer, untyped source, int source_x, int source_y, int source_w, int source_h, int dest_x, int dest_y, int dest_w, int dest_h, int rotation = 0
, int cx = 0
, int cy = 0
, int mode = 0
, int lit = 0
, bool mask = true
) ๐ Source
BLITS ANOTHER BITMAP TO THE POINTER โbโ.
As Blit(), except that it draws TO an initialised bitmap pointer,
FROM a source bitmap, which may be a user-created bitmap, or it may be the screen.
To draw to the screen, or to one of the old system bitmaps, use the RT_* value from std_constants.zh
as the argument to โbitmap sourceโ.
To draw from a user created bitmap, pass its pointer to โbitmap source.
BlitTo supports multiple MODES, ORโd together as a bitmask:
const int BITDX_NORMAL = 0;
const int BITDX_TRANS = 0x01; //Translucent
const int BITDX_PIVOT = 0x02; //THe sprite will rotate at a specific
point, instead of its center. const int BITDX_HFLIP = 0x04; //Horizontal
Flip const int BITDX_VFLIP = 0x08; //Vertical Flip.
You can also set a pivot point for the rotation, using โint cxโ and โint cyโ
If these are non-zero, the rotation anchor point will center on these coordinates.
You may specify a colour to โint litโ to use a lit mode. This tints the entire bitmap using that colour index of the main palette.
void TileBlit(int layer, int tile, int cset, int source_x, int source_y, int source_w, int source_h, int dest_x, int dest_y, int dest_w, int dest_h, int rotation = 0
, int cx = 0
, int cy = 0
, int mode = 0
, int lit = 0
, bool mask = true
) ๐ Source
As โBlitToโ, but draws from a tile instead of a bitmap
Blit supports multiple MODES, ORโd together as a bitmask:
const int BITDX_NORMAL = 0;
const int BITDX_TRANS = 0x01; //Translucent
const int BITDX_PIVOT = 0x02; //THe sprite will rotate at a specific
point, instead of its center. const int BITDX_HFLIP = 0x04; //Horizontal
Flip const int BITDX_VFLIP = 0x08; //Vertical Flip.
You can also set a pivot point for the rotation, using โint cxโ and โint cyโ
If these are non-zero, the rotation anchor point will center on these coordinates.
You may specify a colour to โint litโ to use a lit mode. This tints the entire bitmap using that colour index of the main palette.
void ComboBlit(int layer, int combo, int cset, int source_x, int source_y, int source_w, int source_h, int dest_x, int dest_y, int dest_w, int dest_h, int rotation = 0
, int cx = 0
, int cy = 0
, int mode = 0
, int lit = 0
, bool mask = true
) ๐ Source
As โTileBlitโ, but uses the current tile of a specified combo.
Blit supports multiple MODES, ORโd together as a bitmask:
const int BITDX_NORMAL = 0;
const int BITDX_TRANS = 0x01; //Translucent
const int BITDX_PIVOT = 0x02; //THe sprite will rotate at a specific
point, instead of its center. const int BITDX_HFLIP = 0x04; //Horizontal
Flip const int BITDX_VFLIP = 0x08; //Vertical Flip.
You can also set a pivot point for the rotation, using โint cxโ and โint cyโ
If these are non-zero, the rotation anchor point will center on these coordinates.
You may specify a colour to โint litโ to use a lit mode. This tints the entire bitmap using that colour index of the main palette.
void DrawPlane(int layer, untyped src, int src_x, int src_y, int dest_x, int dest_y, int dest_w, int dest_h, int space_z, int horizon, int scale_x = 1
, int scale_y = 1
, bool mask = true
) ๐ Source
Draws a scaled โMode 7โ style effect, line-by-line, where each raster is scaled down toward a horizon point.
Returns true if the bitmap pointer has been created to be drawn to.
bool isAllocated() ๐ Source
Returns true if the bitmap pointer has been allocated for use.
void Write(int layer, char32[] filename, bool allow_overwrite = false
) ๐ Source
Writes from the bitmap to the specified image file. Requires one of:
.png
,``.gif``,``pcx``,``.tgx``,``.bmp``. Fails otherwise.
void Read(int layer, char32[] filename) ๐ Source
Reads from the specified image file into the bitmap. Read() will fail if:
void Create(int layer = 0
, int width = 256
, int height = 256
) ๐ Source
Creates a bitmap on the pointer of width
x height
, destroying any data
that was previously on the pointer.
void Polygon(int layer, int num_points, int[] vertices, int colour, int opacity = 128
) ๐ Source
void ClearToColor(int layer, int color) ๐ Source
Clears the bitmap to the specified color on the specified layer timing.
De-allocates this bitmap
pointer, so that itsโ pointer ID may be
re-used. You may only have a limited number of bitmap pointers active at
a time; freeing them when you are done with them helps not reach the
limit.
Warning
Deprecated! Free() no longer does anything as of ZC 3.0. Objects are now freed automatically.
Grants โOwnershipโ of the bitmap pointer to the script that calls this function. When the script with โOwnershipโ terminates (at the same time itsโ local arrays are deallocated), this bitmap pointer will automatically be โFree()โd.
void DrawFrame(int layer, int x, int y, int tile, int cset, int width, int height, bool overlay = true
, int opacity = 128
) ๐ Source
Identical to Screen->DrawFrame(), but it draws to a target bitmap.
void WriteTile(int layer, int x, int y, int tile, bool is8bit = true
, bool mask = false
) ๐ Source
Writes a 16x16 area from the bitmap to the tile tile
. The tileโs 8-bit
status will be set to the value of is8bit
. If mask
is true, the draw
will be an Overlay
- otherwise it will overwrite.
void Dither(int layer, bitmap mask, int color, int ditherType, int ditherArg) ๐ Source
Draws color
onto the bitmap on pixels that are non-color-0 on the
mask
bitmap, based on the
Identical to Screen->Rectangle(), but it draws to a target bitmap.
void ReplaceColors(int layer, int color, int startCol, int endCol) ๐ Source
Replaces colors that are startCol
<= color
<= endCol
.
void ShiftColors(int layer, int shift, int startCol, int endCol) ๐ Source
Shifts colors that are >= startCol
and <= endCol
by adding shift
to
them.
void MaskedDraw(int layer, bitmap mask, int color) ๐ Source
Draws color
to this bitmap, in the area specified by the mask
by its
non-zero pixels.
void MaskedDraw(int layer, bitmap mask, int color, int maskColor) ๐ Source
Draws color
to this bitmap, in the area specified by the mask
. Any
pixel on the mask
which matches the maskColor
will be drawn.
void MaskedDraw(int layer, bitmap mask, int color, int startMaskColor, int endMaskColor) ๐ Source
Draws color
to this bitmap, in the area specified by the mask
. Any
pixel on the mask
which between startMaskColor
and endMaskColor
will be drawn.
void MaskedBlit(int layer, bitmap mask, bitmap pattern, bool repeatPattern) ๐ Source
Same as MaskedDraw(), except instead of drawing a specified color to
this bitmap, it draws from a pattern
bitmap.
void MaskedBlit(int layer, bitmap mask, bitmap pattern, bool repeatPattern, int maskColor) ๐ Source
Same as MaskedDraw(), except instead of drawing a specified color to
this bitmap, it draws from a pattern
bitmap.
void MaskedBlit(int layer, bitmap mask, bitmap pattern, bool repeatPattern, int startMaskColor, int endMaskColor) ๐ Source
Same as MaskedDraw(), except instead of drawing a specified color to
this bitmap, it draws from a pattern
bitmap.
void Clear(int layer = 0
) ๐ Source
Clears the bitmap to color 0 on the specified layer
timing.
void DrawScreenSolid(int layer, int map, int source_screen, int x, int y, int rotation = 0
) ๐ Source
void DrawScreenSolidity(int layer, int map, int source_screen, int x, int y, int rotation = 0
) ๐ Source
void DrawScreenComboTypes(int layer, int map, int source_screen, int x, int y, int rotation = 0
) ๐ Source
void DrawScreenComboFlags(int layer, int map, int source_screen, int x, int y, int rotation = 0
) ๐ Source
void DrawScreenComboIFlags(int layer, int map, int source_screen, int x, int y, int rotation = 0
) ๐ Source
void DrawLayerSolid(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) ๐ Source
void DrawLayerSolidity(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) ๐ Source
void DrawLayerComboTypes(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) ๐ Source
void DrawLayerComboFlags(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) ๐ Source
void DrawLayerComboIFlags(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8) ๐ Source