Class

Bitmap

Bitmap(filename)

Constructor

# new Bitmap(filename)

Load a BMP, TGA, PCX, QOI, JPEG or PNG image.

Note: PNG module must be loaded by calling LoadLibrary("png") before using this function with PNG files! Note: JPEG module must be loaded by calling LoadLibrary("jpeg") before loading JPEG files! Note: JPEG module must be loaded by calling LoadLibrary("qoi") before loading QOI files!

Parameters:
Name Type Description
filename string

name of the file.

See:
  • LoadLibrary()

Members

string

# filename

Name of the file.

number

# height

Height in pixels

number

# width

Width in pixels

Methods

# Clear()

clear the bitmap to EGA.BLACK.

# Draw(x, y)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# DrawAdvanced(srcX, srcY, srcW, srcH, destX, destY, destW, destH)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
srcX number

source position to draw from.

srcY number

source position to draw from.

srcW number

source size to draw from.

srcH number

source size to draw from.

destX number

position to draw to.

destY number

position to draw to.

destW number

size to draw.

destH number

size to draw.

# DrawTrans(x, y)

Draw the image to the canvas at given coordinates using the alpha channel transparency. Only works for 32bit TGA with alpha channel information.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# FxDrawLfb(x, y, buffer, pipeline)

draw the bitmap directly into the 3dfx/voodoo framebuffer (only works when fxInit() was called).

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

buffer GR_BUFFER

one of FRONTBUFFER, BACKBUFFER or AUXBUFFER

pipeline boolean

true if the pixels shall be processed by the voodoos pixel pipeline, false to just draw.

# GetPixel(x, y) → {number}

Get the color of a pixel of this image.

Parameters:
Name Type Description
x number

position.

y number

position.

the color of the pixel.

number

# SaveBmpImage(fname)

Save bitmap to BMP file.

Parameters:
Name Type Description
fname string

filename.

# SavePcxImage(fname)

Save bitmap to PCX file.

Parameters:
Name Type Description
fname string

filename.

# SavePngImage(fname)

Save bitmap to PNG file.

Note: PNG module must be loaded by calling LoadLibrary("png") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveQoiImage(fname)

Save bitmap to QOI file.

Note: QOI module must be loaded by calling LoadLibrary("qoi") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveTgaImage(fname)

Save bitmap to TGA file.

Parameters:
Name Type Description
fname string

filename.

Bitmap(blurhash, width, height, punchopt)

Constructor

# new Bitmap(blurhash, width, height, punchopt)

create bitmap for given blurhash (see https://blurha.sh/).

Parameters:
Name Type Attributes Description
blurhash string

The blurhash.

width number

bitmap width.

height number

bitmap width.

punch number <optional>

The factor to improve the contrast, default = 1

Members

string

# filename

Name of the file.

number

# height

Height in pixels

number

# width

Width in pixels

Methods

# Clear()

clear the bitmap to EGA.BLACK.

# Draw(x, y)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# DrawAdvanced(srcX, srcY, srcW, srcH, destX, destY, destW, destH)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
srcX number

source position to draw from.

srcY number

source position to draw from.

srcW number

source size to draw from.

srcH number

source size to draw from.

destX number

position to draw to.

destY number

position to draw to.

destW number

size to draw.

destH number

size to draw.

# DrawTrans(x, y)

Draw the image to the canvas at given coordinates using the alpha channel transparency. Only works for 32bit TGA with alpha channel information.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# FxDrawLfb(x, y, buffer, pipeline)

draw the bitmap directly into the 3dfx/voodoo framebuffer (only works when fxInit() was called).

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

buffer GR_BUFFER

one of FRONTBUFFER, BACKBUFFER or AUXBUFFER

pipeline boolean

true if the pixels shall be processed by the voodoos pixel pipeline, false to just draw.

# GetPixel(x, y) → {number}

Get the color of a pixel of this image.

Parameters:
Name Type Description
x number

position.

y number

position.

the color of the pixel.

number

# SaveBmpImage(fname)

Save bitmap to BMP file.

Parameters:
Name Type Description
fname string

filename.

# SavePcxImage(fname)

Save bitmap to PCX file.

Parameters:
Name Type Description
fname string

filename.

# SavePngImage(fname)

Save bitmap to PNG file.

Note: PNG module must be loaded by calling LoadLibrary("png") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveQoiImage(fname)

Save bitmap to QOI file.

Note: QOI module must be loaded by calling LoadLibrary("qoi") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveTgaImage(fname)

Save bitmap to TGA file.

Parameters:
Name Type Description
fname string

filename.

Bitmap(width, height, coloropt)

Constructor

# new Bitmap(width, height, coloropt)

create empty bitmap of given size.

Parameters:
Name Type Attributes Description
width number

bitmap width.

height number

bitmap width.

color number <optional>

background color of the new bitmap.

Members

string

# filename

Name of the file.

number

# height

Height in pixels

number

# width

Width in pixels

Methods

# Clear()

clear the bitmap to EGA.BLACK.

# Draw(x, y)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# DrawAdvanced(srcX, srcY, srcW, srcH, destX, destY, destW, destH)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
srcX number

source position to draw from.

srcY number

source position to draw from.

srcW number

source size to draw from.

srcH number

source size to draw from.

destX number

position to draw to.

destY number

position to draw to.

destW number

size to draw.

destH number

size to draw.

# DrawTrans(x, y)

Draw the image to the canvas at given coordinates using the alpha channel transparency. Only works for 32bit TGA with alpha channel information.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# FxDrawLfb(x, y, buffer, pipeline)

draw the bitmap directly into the 3dfx/voodoo framebuffer (only works when fxInit() was called).

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

buffer GR_BUFFER

one of FRONTBUFFER, BACKBUFFER or AUXBUFFER

pipeline boolean

true if the pixels shall be processed by the voodoos pixel pipeline, false to just draw.

# GetPixel(x, y) → {number}

Get the color of a pixel of this image.

Parameters:
Name Type Description
x number

position.

y number

position.

the color of the pixel.

number

# SaveBmpImage(fname)

Save bitmap to BMP file.

Parameters:
Name Type Description
fname string

filename.

# SavePcxImage(fname)

Save bitmap to PCX file.

Parameters:
Name Type Description
fname string

filename.

# SavePngImage(fname)

Save bitmap to PNG file.

Note: PNG module must be loaded by calling LoadLibrary("png") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveQoiImage(fname)

Save bitmap to QOI file.

Note: QOI module must be loaded by calling LoadLibrary("qoi") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveTgaImage(fname)

Save bitmap to TGA file.

Parameters:
Name Type Description
fname string

filename.

Bitmap(data, width, height)

Constructor

# new Bitmap(data, width, height)

create Bitmap from integer array.

Parameters:
Name Type Description
data Array.<number>

32bit integer data interpreted as ARGB.

width number

bitmap width.

height number

bitmap height.

Members

string

# filename

Name of the file.

number

# height

Height in pixels

number

# width

Width in pixels

Methods

# Clear()

clear the bitmap to EGA.BLACK.

# Draw(x, y)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# DrawAdvanced(srcX, srcY, srcW, srcH, destX, destY, destW, destH)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
srcX number

source position to draw from.

srcY number

source position to draw from.

srcW number

source size to draw from.

srcH number

source size to draw from.

destX number

position to draw to.

destY number

position to draw to.

destW number

size to draw.

destH number

size to draw.

# DrawTrans(x, y)

Draw the image to the canvas at given coordinates using the alpha channel transparency. Only works for 32bit TGA with alpha channel information.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# FxDrawLfb(x, y, buffer, pipeline)

draw the bitmap directly into the 3dfx/voodoo framebuffer (only works when fxInit() was called).

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

buffer GR_BUFFER

one of FRONTBUFFER, BACKBUFFER or AUXBUFFER

pipeline boolean

true if the pixels shall be processed by the voodoos pixel pipeline, false to just draw.

# GetPixel(x, y) → {number}

Get the color of a pixel of this image.

Parameters:
Name Type Description
x number

position.

y number

position.

the color of the pixel.

number

# SaveBmpImage(fname)

Save bitmap to BMP file.

Parameters:
Name Type Description
fname string

filename.

# SavePcxImage(fname)

Save bitmap to PCX file.

Parameters:
Name Type Description
fname string

filename.

# SavePngImage(fname)

Save bitmap to PNG file.

Note: PNG module must be loaded by calling LoadLibrary("png") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveQoiImage(fname)

Save bitmap to QOI file.

Note: QOI module must be loaded by calling LoadLibrary("qoi") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveTgaImage(fname)

Save bitmap to TGA file.

Parameters:
Name Type Description
fname string

filename.

Bitmap(data)

Constructor

# new Bitmap(data)

create Bitmap from ByteArray (must contain a compatible image file format).

Parameters:
Name Type Description
data ByteArray

image file data like PCX, BMP, etc.

Members

string

# filename

Name of the file.

number

# height

Height in pixels

number

# width

Width in pixels

Methods

# Clear()

clear the bitmap to EGA.BLACK.

# Draw(x, y)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# DrawAdvanced(srcX, srcY, srcW, srcH, destX, destY, destW, destH)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
srcX number

source position to draw from.

srcY number

source position to draw from.

srcW number

source size to draw from.

srcH number

source size to draw from.

destX number

position to draw to.

destY number

position to draw to.

destW number

size to draw.

destH number

size to draw.

# DrawTrans(x, y)

Draw the image to the canvas at given coordinates using the alpha channel transparency. Only works for 32bit TGA with alpha channel information.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# FxDrawLfb(x, y, buffer, pipeline)

draw the bitmap directly into the 3dfx/voodoo framebuffer (only works when fxInit() was called).

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

buffer GR_BUFFER

one of FRONTBUFFER, BACKBUFFER or AUXBUFFER

pipeline boolean

true if the pixels shall be processed by the voodoos pixel pipeline, false to just draw.

# GetPixel(x, y) → {number}

Get the color of a pixel of this image.

Parameters:
Name Type Description
x number

position.

y number

position.

the color of the pixel.

number

# SaveBmpImage(fname)

Save bitmap to BMP file.

Parameters:
Name Type Description
fname string

filename.

# SavePcxImage(fname)

Save bitmap to PCX file.

Parameters:
Name Type Description
fname string

filename.

# SavePngImage(fname)

Save bitmap to PNG file.

Note: PNG module must be loaded by calling LoadLibrary("png") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveQoiImage(fname)

Save bitmap to QOI file.

Note: QOI module must be loaded by calling LoadLibrary("qoi") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveTgaImage(fname)

Save bitmap to TGA file.

Parameters:
Name Type Description
fname string

filename.

Bitmap(x, y, width, height, bufferopt)

Constructor

# new Bitmap(x, y, width, height, bufferopt)

create Bitmap from current(3dfx) screen.

Parameters:
Name Type Attributes Description
x number

screen x position.

y number

screen y position.

width number

bitmap width.

height number

bitmap height.

buffer GR_BUFFER <optional>

one of FRONTBUFFER, BACKBUFFER or AUXBUFFER for 3dfx access, omit for normal screen acccess.

Members

string

# filename

Name of the file.

number

# height

Height in pixels

number

# width

Width in pixels

Methods

# Clear()

clear the bitmap to EGA.BLACK.

# Draw(x, y)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# DrawAdvanced(srcX, srcY, srcW, srcH, destX, destY, destW, destH)

Draw the image to the canvas at given coordinates.

Parameters:
Name Type Description
srcX number

source position to draw from.

srcY number

source position to draw from.

srcW number

source size to draw from.

srcH number

source size to draw from.

destX number

position to draw to.

destY number

position to draw to.

destW number

size to draw.

destH number

size to draw.

# DrawTrans(x, y)

Draw the image to the canvas at given coordinates using the alpha channel transparency. Only works for 32bit TGA with alpha channel information.

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

# FxDrawLfb(x, y, buffer, pipeline)

draw the bitmap directly into the 3dfx/voodoo framebuffer (only works when fxInit() was called).

Parameters:
Name Type Description
x number

position to draw to.

y number

position to draw to.

buffer GR_BUFFER

one of FRONTBUFFER, BACKBUFFER or AUXBUFFER

pipeline boolean

true if the pixels shall be processed by the voodoos pixel pipeline, false to just draw.

# GetPixel(x, y) → {number}

Get the color of a pixel of this image.

Parameters:
Name Type Description
x number

position.

y number

position.

the color of the pixel.

number

# SaveBmpImage(fname)

Save bitmap to BMP file.

Parameters:
Name Type Description
fname string

filename.

# SavePcxImage(fname)

Save bitmap to PCX file.

Parameters:
Name Type Description
fname string

filename.

# SavePngImage(fname)

Save bitmap to PNG file.

Note: PNG module must be loaded by calling LoadLibrary("png") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveQoiImage(fname)

Save bitmap to QOI file.

Note: QOI module must be loaded by calling LoadLibrary("qoi") before using this function!

Parameters:
Name Type Description
fname string

filename.

See:
  • LoadLibrary()

# SaveTgaImage(fname)

Save bitmap to TGA file.

Parameters:
Name Type Description
fname string

filename.