mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Added new functions to draw text on image
This commit is contained in:
@ -1090,6 +1090,25 @@ Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int spacing,
|
||||
return imText;
|
||||
}
|
||||
|
||||
// Draw text (default font) within an image (destination)
|
||||
void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color)
|
||||
{
|
||||
ImageDrawTextEx(dst, position, GetDefaultFont(), text, fontSize, 0, color);
|
||||
}
|
||||
|
||||
// Draw text (custom sprite font) within an image (destination)
|
||||
void ImageDrawTextEx(Image *dst, Vector2 position, SpriteFont font, const char *text, int fontSize, int spacing, Color color)
|
||||
{
|
||||
Image imText = ImageTextEx(font, text, fontSize, spacing, color);
|
||||
|
||||
Rectangle srcRec = { 0, 0, imText.width, imText.height };
|
||||
Rectangle dstRec = { (int)position.x, (int)position.y, imText.width, imText.height };
|
||||
|
||||
ImageDraw(dst, imText, srcRec, dstRec);
|
||||
|
||||
UnloadImage(imText);
|
||||
}
|
||||
|
||||
// Flip image vertically
|
||||
void ImageFlipVertical(Image *image)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user