Skip to content

Graphics

Namespace

Graphics

The Graphics namespace contains various graphics-related functions.

Constants

Name Value
BLEND_NORMAL 0
BLEND_ADD 1
BLEND_SUBTRACT 2
BLEND_REVERSESUBTRACT 3
BLEND_MODULATE 4

Functions

Overview

Image Format

ImageFormat(formatId) -> ImageFormat AllImageFormats() -> ImageFormat[] DetectImageFormat(data) -> ImageFormat

Images

GetImageInfo(data, [index]) -> table


ImageFormat

Parameters

  • formatId (string): The id of the format to get

Returns

  • ImageFormat: The format matching the given formatId. Will be the 'unknown' format if no format with a matching id was found

AllImageFormats

Returns

  • ImageFormat[]: An array of all supported image formats

DetectImageFormat

Parameters

Returns

  • ImageFormat: The format data was detected as, or the 'unknown' format if the data couldn't be detected as a known format

GetImageInfo

Returns a table containing basic information about the image contained in data.

Parameters

  • data (DataBlock): The image data to read
  • [index] (integer): The index of the image in the data (for cases where the image format contains multiple images, eg. Duke3D ART). Default is 0

Returns

  • table: A table containing information about the image (see notes below)

Notes

The table returned by this function has the following keys:

Name Type Description
width integer The pixel width of the image
height integer The pixel height of the image
type integer The pixel format of the image (see Image.PIXELFORMAT_ constants)
format string The format id of the image (see ImageFormat.id)
imageCount integer The number of sub-images contained in the image
offsetX integer The X-offset of the image
offsetY integer The Y-offset of the image
hasPalette boolean true if the image contains an internal palette