libui-ng
A portable GUI library for C
|
A container for an image to be displayed on screen. More...
#include <ui.h>
Public Member Functions | |
uiImage * | uiNewImage (double width, double height) |
Creates a new image container. More... | |
void | uiFreeImage (uiImage *i) |
Frees the image container and all associated resources. More... | |
void | uiImageAppend (uiImage *i, void *pixels, int pixelWidth, int pixelHeight, int byteStride) |
Appends a new image representation. More... | |
A container for an image to be displayed on screen.
The container can hold multiple representations of the same image with the same aspect ratio but in different resolutions to support high-density displays.
Common image dimension scale factors are 1x
and 2x
. Providing higher density representations is entirely optional.
The system will automatically determine the correct image to render depending on the screen's pixel density.
uiImage only supports premultiplied 32-bit RGBA images.
No image file loading or image format conversion utilities are provided.
void uiFreeImage | ( | uiImage * | i | ) |
Frees the image container and all associated resources.
i | uiImage instance. |
void uiImageAppend | ( | uiImage * | i, |
void * | pixels, | ||
int | pixelWidth, | ||
int | pixelHeight, | ||
int | byteStride | ||
) |
Appends a new image representation.
i | uiImage instance. |
pixels | Byte array of premultiplied pixels in [R G B A] order.((uint8_t *) pixels)[0] equals the R of the first pixel, [3] the A of the first pixel.pixels must be at least byteStride * pixelHeight bytes long.Data is copied internally. Ownership is not transferred. |
pixelWidth | Width in pixels. |
pixelHeight | Height in pixels. |
byteStride | Number of bytes per row of the pixel array. |
see if we either need the stride or can provide a way to get the OS-preferred stride (in cairo we do)
use const void * for const correctness
uiImage * uiNewImage | ( | double | width, |
double | height | ||
) |
Creates a new image container.
Dimensions are measured in points. This is most commonly the pixel size of the 1x
scaled image.
width | Width in points. |
height | Height in points. |