PixMapImage

A class that provides a convenient interface for working with images. Represents a one-dimensional array.

Constructors

this
this(size_t width, size_t height, RGBColor color)

A constructor for creating an image with given dimensions (length and width) and starting color for pixels. By default, all values ​​are zero, and black (i.e: RGBColor(0, 0, 0)) is used as the starting color.

Members

Aliases

height
alias height = getHeight

Returns actual height of image as size_t value

width
alias width = getWidth

Returns actual width of image as size_t value

Functions

array
RGBColor[] array()

Returns the entire internal one-dimensional pixel array of the image.

array
void array(RGBColor[] image)

Sets the inner pixel array of the image by feeding the outer array. The size of the array must be equal to the actual size of the image (i.e. the size of the given one-dimensional array must be equal to the product of the length of the image and its width)

changeCapacity
void changeCapacity(size_t x, size_t y)

Resizing an image according to its given length and width. Note: If the length and/or width are smaller than the original values, then a literal cropping to the desired dimensions will be performed (not interpolation or approximation, but real cropping!). If the size parameters are larger than the original ones, then the image size will be increased by adding the default color to the end of the image (real array addition will be performed, not interpolation).

opIndex
RGBColor opIndex(size_t x, size_t y)

Getting a color value from an individual pixel through a two-index indexing operation. Note: It is allowed to use as indices values ​​greater than the length and width (or less than 0) as indices, since the values ​​will be converted to the actual length of the image array.

opIndex
RGBColor opIndex(size_t x)

Assigning a color value to an individual pixel through a one-index indexing operation. Note: It is allowed to use an index greater than the actual length of the array or less than 0, since it is bound to the real length of the internal array of the image.

opIndexAssign
RGBColor opIndexAssign(RGBColor color, size_t x, size_t y)

Assigning a color value to an individual pixel through a two-index indexing operation. Note: It is allowed to use as indices values ​​greater than the length and width (or less than 0) as indices, since the values ​​will be converted to the actual length of the image array.

opIndexAssign
RGBColor opIndexAssign(RGBColor color, size_t x)

Assigning a color value to an individual pixel through a one-index indexing operation. Note: It is allowed to use an index greater than the actual length of the array or less than 0, since it is bound to the real length of the internal array of the image.

toString
string toString()

The string representation of the image. Returns a string representing the image as a two-dimensional array of RGBColor objects.

Meta