LuciadCPillar 2024.0.08
|
An image with a width, height and pixel data in a specified pixel format. More...
#include <luciad/drawing/Image.h>
Public Member Functions | |
~Image ()=default | |
const ByteBuffer & | getBytes () const |
Returns the bytes that make up the pixels of this image. More... | |
Color | getColor (size_t x, size_t y) const |
Returns the color value at the given image location. More... | |
size_t | getHeight () const |
Returns the height of this image in pixels. More... | |
PixelFormat | getPixelFormat () const |
Returns the pixel format of this image. More... | |
size_t | getWidth () const |
Returns the width of this image in pixels. More... | |
bool | isAlphaPreMultiplied () const |
Returns whether the image is using premultiplied alpha. More... | |
Static Public Member Functions | |
static std::shared_ptr< Image > | create (size_t width, size_t height, bool isAlphaPreMultiplied, PixelFormat pixelFormat, ByteBuffer data) |
Creates an Image. More... | |
An image with a width, height and pixel data in a specified pixel format.
The origin of an image (pixel (0, 0)) is defined at the top left corner, with the x axis pointing right, and the y axis pointing down.
|
default |
|
static |
Creates an Image.
width | the width of the new image |
height | the height of the new image |
isAlphaPreMultiplied | true to indicate that the colors in the data buffer contain premultiplied alpha |
pixelFormat | the pixel format |
data | the pixel data. The buffer contains rows (left to right) of color data. The rows are ordered from top to bottom. The size of each color, and so also the size of the data buffer, is determined by the used PixelFormat. |
const ByteBuffer & luciad::Image::getBytes | ( | ) | const |
Returns the bytes that make up the pixels of this image.
The bytes must be immutable; multiple calls to this method must always result in the same bytes.
The amount of bytes that makes up one pixel depends on the PixelFormat
of this image (see getPixelFormat()
and luciad::sizeInBytes(PixelFormat)
). In other words, the size of this array is equal to: getWidth() * getHeight() * luciad::sizeInBytes(getPixelFormat())
.
The pixels are arranged in row-major order, starting in the upper-left corner.
Color luciad::Image::getColor | ( | size_t | x, |
size_t | y | ||
) | const |
Returns the color value at the given image location.
This will be an rgba color for Image instance with:
This will be a greyscale Color for Image instance with:
x | the x-coordinate of the pixel. A value of 0 corresponds with a left-most pixel. |
y | the y-coordinate of the pixel. A value of 0 corresponds with a top-most pixel. |
size_t luciad::Image::getHeight | ( | ) | const |
Returns the height of this image in pixels.
PixelFormat luciad::Image::getPixelFormat | ( | ) | const |
Returns the pixel format of this image.
size_t luciad::Image::getWidth | ( | ) | const |
Returns the width of this image in pixels.
bool luciad::Image::isAlphaPreMultiplied | ( | ) | const |
Returns whether the image is using premultiplied alpha.