LDKImage
typedef struct LDKImage LDKImage;
Image pixel formats, loading, memory ownership, and pixel-buffer operations.
typedef struct LDKImage LDKImage;
typedef enum LDKImageFormat{
LDK_IMAGE_FORMAT_RGBA8_UNORM=0,
LDK_IMAGE_FORMAT_RGBA16_UNORM
}LDKImageFormat;
typedef struct LDKImageInfo{
u32 width;
u32 height;
u32 channel_count;
u32 bytes_per_channel;
LDKImageFormat format;
u64 byte_count;
u8 const *pixels;
}LDKImageInfo;
Create an RGBA8 UNORM image.
LDK_API LDKImage * ldk_image_create(
u32 width,
u32 height,
void const *pixels
);
u32 widthu32 heightvoid const *pixelsPointer to the requested object or data; NULL when unavailable.
Create an image from raw interleaved RGBA pixels in the requested format.
LDK_API LDKImage * ldk_image_create_format(
u32 width,
u32 height,
LDKImageFormat format,
void const *pixels
);
u32 widthu32 heightLDKImageFormat formatvoid const *pixelsPointer to the requested object or data; NULL when unavailable.
Load an image file. 16-bit sources remain RGBA16 UNORM; other sources use RGBA8.
LDK_API LDKImage * ldk_image_load(char const *path);
char const *pathPointer to the requested object or data; NULL when unavailable.
Create an image from pixel data in memory.
LDK_API LDKImage * ldk_image_create_from_memory(
void const *data,
u32 data_size
);
void const *datau32 data_sizePointer to the requested object or data; NULL when unavailable.
Destroy the image.
LDK_API void ldk_image_destroy(LDKImage *image);
LDKImage *imageRead the image format and dimension metadata.
LDK_API bool ldk_image_get_info(
LDKImage const *image,
LDKImageInfo *out_info
);
LDKImage const *imageLDKImageInfo *out_infoTrue if the operation succeeds; false otherwise.
Read the image width in pixels.
LDK_API u32 ldk_image_get_width(LDKImage const *image);
LDKImage const *imageThe resulting numeric value.
Read the image height in pixels.
LDK_API u32 ldk_image_get_height(LDKImage const *image);
LDKImage const *imageThe resulting numeric value.
Get the number of color channels in the image format.
LDK_API u32 ldk_image_get_channel_count(LDKImage const *image);
LDKImage const *imageNumber of matching entries.
Query the number of bytes used per image channel.
LDK_API u32 ldk_image_get_bytes_per_channel(LDKImage const *image);
LDKImage const *imageThe resulting numeric value.
Get the image pixel format.
LDK_API LDKImageFormat ldk_image_get_format(LDKImage const *image);
LDKImage const *imageThe requested value.
Get the image pixel buffer.
LDK_API u8 const * ldk_image_get_pixels(LDKImage const *image);
LDKImage const *imagePointer to the requested object or data; NULL when unavailable.
Get the size of the image pixel buffer in bytes.
LDK_API u64 ldk_image_get_byte_count(LDKImage const *image);
LDKImage const *imageNumber of matching entries.