GetImageAlphaBorder() return 0 in case of blank image
This commit is contained in:
parent
9f699af138
commit
237972652d
1 changed files with 6 additions and 2 deletions
|
@ -301,7 +301,7 @@ Image LoadImage(const char *fileName)
|
|||
// NOTE: Creates a copy of pixels data array
|
||||
Image LoadImageEx(Color *pixels, int width, int height)
|
||||
{
|
||||
Image image;
|
||||
Image image = { 0 };
|
||||
image.data = NULL;
|
||||
image.width = width;
|
||||
image.height = height;
|
||||
|
@ -710,7 +710,11 @@ Rectangle GetImageAlphaBorder(Image image, float threshold)
|
|||
}
|
||||
}
|
||||
|
||||
crop = (Rectangle){ xMin, yMin, (xMax + 1) - xMin, (yMax + 1) - yMin };
|
||||
// Check for empty blank image
|
||||
if ((xMin != 65536) && (xMax != 65536))
|
||||
{
|
||||
crop = (Rectangle){ xMin, yMin, (xMax + 1) - xMin, (yMax + 1) - yMin };
|
||||
}
|
||||
|
||||
RL_FREE(pixels);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue