add Refresh_Image_Info
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
d34310a7df
commit
2798067d54
|
@ -63,6 +63,20 @@ REFRESHAPI uint8_t* Refresh_Image_Load(
|
|||
int32_t *len
|
||||
);
|
||||
|
||||
/* Get image dimensions without fully decoding the image.
|
||||
*
|
||||
* w: Filled with the width of the image.
|
||||
* h: Filled with the height of the image.
|
||||
* len: Filled with the length of pixel data in bytes.
|
||||
*/
|
||||
REFRESHAPI uint8_t Refresh_Image_Info(
|
||||
uint8_t *bufferPtr,
|
||||
int32_t bufferLength,
|
||||
int32_t *w,
|
||||
int32_t *h,
|
||||
int32_t *len
|
||||
);
|
||||
|
||||
/* Frees memory returned by Refresh_Image_Load. Do NOT free the memory yourself!
|
||||
*
|
||||
* mem: A pointer previously returned by Refresh_Image_LoadPNG.
|
||||
|
|
|
@ -232,6 +232,32 @@ uint8_t* Refresh_Image_Load(
|
|||
return result;
|
||||
}
|
||||
|
||||
uint8_t Refresh_Image_Info(
|
||||
uint8_t *bufferPtr,
|
||||
int32_t bufferLength,
|
||||
int32_t *w,
|
||||
int32_t *h,
|
||||
int32_t *len
|
||||
) {
|
||||
int32_t format;
|
||||
int32_t result;
|
||||
|
||||
result = stbi_info_from_memory(
|
||||
bufferPtr,
|
||||
bufferLength,
|
||||
w,
|
||||
h,
|
||||
&format
|
||||
);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_ERROR, "Image info failed: %s", stbi_failure_reason());
|
||||
}
|
||||
|
||||
return (uint8_t) result;
|
||||
}
|
||||
|
||||
void Refresh_Image_Free(uint8_t *mem)
|
||||
{
|
||||
SDL_SIMDFree(mem);
|
||||
|
|
Loading…
Reference in New Issue