mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-11 22:08:15 +00:00
Modifies some Image functions
REVIEWED: ImageDrawRectangle() ADDED: ImageDrawRectangleLines()
This commit is contained in:
@@ -1731,17 +1731,22 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
||||
}
|
||||
|
||||
// Draw rectangle within an image
|
||||
void ImageDrawRectangle(Image *dst, Vector2 position, Rectangle rec, Color color)
|
||||
void ImageDrawRectangle(Image *dst, Rectangle rec, Color color)
|
||||
{
|
||||
Image imRec = GenImageColor((int)rec.width, (int)rec.height, color);
|
||||
|
||||
Rectangle dstRec = { position.x, position.y, (float)imRec.width, (float)imRec.height };
|
||||
|
||||
ImageDraw(dst, imRec, rec, dstRec);
|
||||
|
||||
ImageDraw(dst, imRec, (Rectangle){ 0, 0, rec.width, rec.height }, rec);
|
||||
UnloadImage(imRec);
|
||||
}
|
||||
|
||||
// Draw rectangle lines within an image
|
||||
void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color)
|
||||
{
|
||||
ImageDrawRectangle(&dst, (Rectangle){ rec.x, rec.y, rec.width, thick }, color);
|
||||
ImageDrawRectangle(&dst, (Rectangle){ rec.x, rec.y + thick, thick, rec.height - thick*2 }, color);
|
||||
ImageDrawRectangle(&dst, (Rectangle){ rec.x + rec.width - thick, rec.y + thick, thick, rec.height - thick*2 }, color);
|
||||
ImageDrawRectangle(&dst, (Rectangle){ rec.x, rec.height - thick, rec.width, thick }, color);
|
||||
}
|
||||
|
||||
// Draw text (default font) within an image (destination)
|
||||
void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color)
|
||||
{
|
||||
|
Reference in New Issue
Block a user