Introduce imlib_load_image_frame_mem

This commit is contained in:
NRK 2022-08-01 17:44:00 +06:00 committed by Kim Woelders
parent 06eb5ab315
commit cd4f0c0419
2 changed files with 37 additions and 0 deletions

View File

@ -2869,6 +2869,25 @@ typedef struct {
*/
EAPI Imlib_Image imlib_load_image_frame(const char *file, int frame);
/**
* Load image frame form memory
*
* Loads the specified frame within the image from memory.
* The file name @p file is only used to guess the file format.
* On success an image handle is returned, otherwise NULL is returned
* (e.g. if the requested frame does not exist).
* The image is loaded immediately.
*
* @param file File name
* @param frame Frame number
* @param data Image data
* @param size Image data size
*
* @return Image handle (NULL on failure)
*/
EAPI Imlib_Image imlib_load_image_frame_mem(const char *file, int frame,
const void *data, size_t size);
/**
* Get information about current image frame
*

View File

@ -919,6 +919,24 @@ imlib_load_image_frame(const char *file, int frame)
return im;
}
EAPI Imlib_Image
imlib_load_image_frame_mem(const char *file, int frame, const void *data,
size_t size)
{
Imlib_Image im;
ImlibLoadArgs ila = { ILA0(ctx, 1, 0),.frame = frame };
CHECK_PARAM_POINTER_RETURN("file", file, NULL);
CHECK_PARAM_POINTER_RETURN("data", data, NULL);
ila.fdata = data;
ila.fsize = size;
im = __imlib_LoadImage(file, &ila);
return im;
}
EAPI void
imlib_image_get_frame_info(Imlib_Frame_Info * info)
{