The OpenD Programming Language

gamut.types

Various public types.

Members

Aliases

LayoutConstraints
alias LayoutConstraints = ushort

Layout constraints flags (bits 0 to 15). All of those introduce "gap pixels" after the scanline, in order to follow the various constraints.

LoadFlags
alias LoadFlags = int

Load flags (range: bits 16 to 23). Load flags occupy high-order word so that casting to ushort only keeps LayoutConstraints part.

convertDPIToPPM
alias convertDPIToPPM = convertMetersToInches

Converts from DPI (Dots Per Inch) to PPM (Points Per Meter).

convertPPMToDPI
alias convertPPMToDPI = convertInchesToMeters

Converts from PPM (Points Per Meter) to DPI (Dots Per Inch).

Enums

ImageFormat
enum ImageFormat

Image format. It is the kind of container/codec formats Gamut can read and write to.

PixelType
enum PixelType

Pixel component type. Integer components are stored normalized (255 or 65535 being the maximum of intensity).

Functions

convertInchesToMeters
float convertInchesToMeters(float x)

Converts from inches to meters.

convertMetersToInches
float convertMetersToInches(float x)

Converts from meters to inches.

Manifest constants

GAMUT_UNKNOWN_ASPECT_RATIO
enum GAMUT_UNKNOWN_ASPECT_RATIO;

When images have an unknown physical pixel ratio. Explanation: it is possible to have a known pixel ratio, but an unknown DPI (eg: PNG).

GAMUT_UNKNOWN_RESOLUTION
enum GAMUT_UNKNOWN_RESOLUTION;

When images have an unknown DPI resolution;

Variables

ENCODE_CHALLENGER
enum int ENCODE_CHALLENGER;

Internal use, this is to test a variation of a compiler. Supported by: JPEG, PNG, DDS, QOI, QOIX.

ENCODE_NORMAL
enum int ENCODE_NORMAL;

Do nothing particular. Supported by: JPEG, PNG, DDS, QOI, QOIX.

GAMUT_MAX_IMAGE_BYTES
enum long GAMUT_MAX_IMAGE_BYTES;

No Gamut Image can have a size that exceeds this value. Technically, the true maximum is MAX(size_t.max, GAMUT_MAX_IMAGE_BYTES). So this is worth 32gb. Cannot really exceed that size with just malloc/realloc. Not strictly needed, but such a large allocation is indicative of forged images / attacks anyway. For the decoders limitations themselves, see Issue # resolution.

GAMUT_MAX_IMAGE_HEIGHT
enum int GAMUT_MAX_IMAGE_HEIGHT;

No Gamut Image can exceed this height.

GAMUT_MAX_IMAGE_LAYERS
enum int GAMUT_MAX_IMAGE_LAYERS;

No Gamut Image can have this many layers.

GAMUT_MAX_IMAGE_WIDTH
enum int GAMUT_MAX_IMAGE_WIDTH;

No Gamut Image can exceed this width.

LAYOUT_BORDER_0
enum LayoutConstraints LAYOUT_BORDER_0;

No particular border constraint.

LAYOUT_BORDER_1
enum LayoutConstraints LAYOUT_BORDER_1;

The whole image has a border of at least 1 pixel addressable without segfault.

LAYOUT_BORDER_2
enum LayoutConstraints LAYOUT_BORDER_2;

The whole image has a border of at least 2 pixels addressable without segfault.

LAYOUT_BORDER_3
enum LayoutConstraints LAYOUT_BORDER_3;

The whole image has a border of at least 3 pixels addressable without segfault.

LAYOUT_DEFAULT
enum LayoutConstraints LAYOUT_DEFAULT;

Default / do-not-care layout options. This is what will give

LAYOUT_GAPLESS
enum LayoutConstraints LAYOUT_GAPLESS;

There must be no single trailing bytes between scanlines.

LAYOUT_MULTIPLICITY_1
enum LayoutConstraints LAYOUT_MULTIPLICITY_1;

No particular multiplicity requirements.

LAYOUT_MULTIPLICITY_2
enum LayoutConstraints LAYOUT_MULTIPLICITY_2;

Beginning at the start of a scanline, pixels can be READ 2 by 2 without segfault.

LAYOUT_MULTIPLICITY_4
enum LayoutConstraints LAYOUT_MULTIPLICITY_4;

Beginning at the start of a scanline, pixels can be READ 4 by 4 without segfault.

LAYOUT_MULTIPLICITY_8
enum LayoutConstraints LAYOUT_MULTIPLICITY_8;

Beginning at the start of a scanline, pixels can be READ 8 by 8 without segfault.

LAYOUT_SCANLINE_ALIGNED_1
enum LayoutConstraints LAYOUT_SCANLINE_ALIGNED_1;

No particular alignment for scanline.

LAYOUT_SCANLINE_ALIGNED_128
enum LayoutConstraints LAYOUT_SCANLINE_ALIGNED_128;

Scanlines required to be at least aligned on 128 bytes boundaries.

LAYOUT_SCANLINE_ALIGNED_16
enum LayoutConstraints LAYOUT_SCANLINE_ALIGNED_16;

Scanlines required to be at least aligned on 16 bytes boundaries.

LAYOUT_SCANLINE_ALIGNED_2
enum LayoutConstraints LAYOUT_SCANLINE_ALIGNED_2;

Scanlines required to be at least aligned on 2 bytes boundaries.

LAYOUT_SCANLINE_ALIGNED_32
enum LayoutConstraints LAYOUT_SCANLINE_ALIGNED_32;

Scanlines required to be at least aligned on 32 bytes boundaries.

LAYOUT_SCANLINE_ALIGNED_4
enum LayoutConstraints LAYOUT_SCANLINE_ALIGNED_4;

Scanlines required to be at least aligned on 4 bytes boundaries.

LAYOUT_SCANLINE_ALIGNED_64
enum LayoutConstraints LAYOUT_SCANLINE_ALIGNED_64;

Scanlines required to be at least aligned on 64 bytes boundaries.

LAYOUT_SCANLINE_ALIGNED_8
enum LayoutConstraints LAYOUT_SCANLINE_ALIGNED_8;

Scanlines required to be at least aligned on 8 bytes boundaries.

LAYOUT_TRAILING_0
enum LayoutConstraints LAYOUT_TRAILING_0;

Scanlines have no trailing requirements.

LAYOUT_TRAILING_1
enum LayoutConstraints LAYOUT_TRAILING_1;

Scanlines must be followed by at least 1 READABLE gap pixels.

LAYOUT_TRAILING_3
enum LayoutConstraints LAYOUT_TRAILING_3;

Scanlines must be followed by at least 3 READABLE gap pixels.

LAYOUT_TRAILING_7
enum LayoutConstraints LAYOUT_TRAILING_7;

Scanlines must be followed by at least 7 READABLE gap pixels.

LAYOUT_VERT_FLIPPED
enum LayoutConstraints LAYOUT_VERT_FLIPPED;

The whole image MUST be stored upside down. Can't be used with LAYOUT_VERT_STRAIGHT flag.

LAYOUT_VERT_STRAIGHT
enum LayoutConstraints LAYOUT_VERT_STRAIGHT;

The whole image MUST NOT be stored upside down. Can't be used with LAYOUT_VERT_FLIPPED flag.

LOAD_16BIT
enum LoadFlags LOAD_16BIT;

Load the image directly in 16-bit, can be faster than loading as 8-bit PNG and then converting to 16-bit. Can't be used with LOAD_8BIT or LOAD_FP32 flag.

LOAD_8BIT
enum LoadFlags LOAD_8BIT;

Load the image directly in 8-bit, can be faster than loading as 16-bit PNG and then converting to 8-bit. Can't be used with LOAD_10BIT or LOAD_FP32 flag.

LOAD_ALPHA
enum LoadFlags LOAD_ALPHA;

Load the image and adds an alpha channel (opaque if not existing). This will preserve the color channels. The resulting image will have 2 or 4 channels. Can't be used with LOAD_NO_ALPHA flag.

LOAD_FP32
enum LoadFlags LOAD_FP32;

Load the image directly in 32-bit floating point. Probably the same speed as just calling convertToFP32 after load though. Can't be used with LOAD_8BIT or LOAD_10BIT flag.

LOAD_GREYSCALE
enum LoadFlags LOAD_GREYSCALE;

Load the image in greyscale, can be faster than loading as RGB8 then converting to greyscale. This will preserve an alpha channel, if existing. The resulting image will have 1 or 2 channels. Can't be used with LOAD_RGB flag.

LOAD_NORMAL
enum LoadFlags LOAD_NORMAL;

No loading options. This will keep the original input pixel format, so as to make the least conversions possible.

LOAD_NO_ALPHA
enum LoadFlags LOAD_NO_ALPHA;

Load the image and drops an eventual alpha channel, if it exists. The resulting image will have 1 or 3 channels. Can't be used with LOAD_ALPHA flag.

LOAD_NO_PIXELS
enum LoadFlags LOAD_NO_PIXELS;

Only decode metadata, not the pixels themselves. NOT SUPPORTED YET!

LOAD_RGB
enum LoadFlags LOAD_RGB;

Load the image in RGB, can be faster than loading a greyscale image and then converting it RGB. The resulting image will have 3 or 4 channels. Can't be used with LOAD_GREYSCALE.

Meta