Added new functions to draw text on image
This commit is contained in:
parent
7053724fd6
commit
d0e7195a16
@ -697,9 +697,11 @@ Image ImageCopy(Image image);
|
|||||||
void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
|
void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
|
||||||
void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering)
|
void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering)
|
||||||
void ImageResizeNN(Image *image,int newWidth,int newHeight); // Resize and image (Nearest-Neighbor scaling algorithm)
|
void ImageResizeNN(Image *image,int newWidth,int newHeight); // Resize and image (Nearest-Neighbor scaling algorithm)
|
||||||
void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image
|
|
||||||
Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
|
Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
|
||||||
Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int spacing, Color tint); // Create an image from text (custom sprite font)
|
Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int spacing, Color tint); // Create an image from text (custom sprite font)
|
||||||
|
void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image
|
||||||
|
void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color); // Draw text (default font) within an image (destination)
|
||||||
|
void ImageDrawTextEx(Image *dst, Vector2 position, SpriteFont font, const char *text, int fontSize, int spacing, Color color); // Draw text (custom sprite font) within an image (destination)
|
||||||
void ImageFlipVertical(Image *image); // Flip image vertically
|
void ImageFlipVertical(Image *image); // Flip image vertically
|
||||||
void ImageFlipHorizontal(Image *image); // Flip image horizontally
|
void ImageFlipHorizontal(Image *image); // Flip image horizontally
|
||||||
void ImageColorTint(Image *image, Color color); // Modify image color: tint
|
void ImageColorTint(Image *image, Color color); // Modify image color: tint
|
||||||
|
@ -1090,6 +1090,25 @@ Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int spacing,
|
|||||||
return imText;
|
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
|
// Flip image vertically
|
||||||
void ImageFlipVertical(Image *image)
|
void ImageFlipVertical(Image *image)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user