aboutsummaryrefslogtreecommitdiff
path: root/src/textures.c
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2018-11-07 17:58:26 +0100
committerRay <raysan5@gmail.com>2018-11-07 17:58:26 +0100
commitb356ef5564e7fa2f4e26232cac451f9d63984ba5 (patch)
tree9c0dbc143c539aae545f249f74c55224323f415c /src/textures.c
parent065994219e32e661bd92c2933b70c9573b82fff0 (diff)
downloadraylib-b356ef5564e7fa2f4e26232cac451f9d63984ba5.tar.gz
raylib-b356ef5564e7fa2f4e26232cac451f9d63984ba5.zip
Modifies some Image functions
REVIEWED: ImageDrawRectangle() ADDED: ImageDrawRectangleLines()
Diffstat (limited to 'src/textures.c')
-rw-r--r--src/textures.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/textures.c b/src/textures.c
index 17f2ae8a..6249287d 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -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)
{