mirror of
https://github.com/raysan5/raylib.git
synced 2026-07-05 08:55:14 +00:00
ADDED: New image drawing functions, aligned with texture/text drawing -WIP-
The new functions are direct maps of the Texture2D equivalents, they can be useful for a future mapping Texture2D --> Image; an alternative 2d software renderer...
This commit is contained in:
@@ -1431,8 +1431,10 @@ RLAPI void ImageDrawTriangleStrip(Image *dst, const Vector2 *points, int pointCo
|
||||
RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image
|
||||
RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
|
||||
RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
|
||||
RLAPI void ImageDrawRectanglePro(Image *dst, Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters within and image
|
||||
RLAPI void ImageDrawRectangleLines(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle lines within an image
|
||||
RLAPI void ImageDrawRectangleLinesEx(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image with line thickness
|
||||
RLAPI void ImageDrawRectangleGradientEx(Image *dst, Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw rectangle with gradient colors within an image, counter-clockwise color order
|
||||
RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
|
||||
RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
|
||||
RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
|
||||
@@ -1440,10 +1442,12 @@ RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color c
|
||||
RLAPI void ImageDrawCircleGradient(Image *dst, Vector2 center, float radius, Color inner, Color outer); // Draw a gradient-filled circle within an image
|
||||
|
||||
RLAPI void ImageDrawImage(Image *dst, Image src, int posX, int posY, Color tint); // Draw an image within an image
|
||||
RLAPI void ImageDrawImageEx(Image *dst, Image src, Vector2 position, float rotation, float scale, Color tint); // Draw an image with scaling and rotation within an image
|
||||
RLAPI void ImageDrawImageRec(Image *dst, Image src, Rectangle srcRec, Vector2 position, Color tint); // Draw a part of an image defined by a rectangle within an image
|
||||
RLAPI void ImageDrawImagePro(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Vector2 origin, float rotation, Color tint); // Draw a part of an image defined by a rectangle into destination rectangle, with scaling and rotation, within an image
|
||||
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
|
||||
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
|
||||
RLAPI void ImageDrawTextPro(Image *dst, Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint); // Draw text using Font and pro parameters (rotation)
|
||||
|
||||
// Texture loading functions
|
||||
// NOTE: These functions require GPU access
|
||||
|
||||
@@ -3918,6 +3918,12 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a color-filled rectangle with pro parameters within and image
|
||||
void ImageDrawRectanglePro(Image *dst, Rectangle rec, Vector2 origin, float rotation, Color color)
|
||||
{
|
||||
// TODO: NEW: Implement ImageDrawRectanglePro()
|
||||
}
|
||||
|
||||
// Draw rectangle lines within an image
|
||||
void ImageDrawRectangleLines(Image *dst, int posX, int posY, int width, int height, Color color)
|
||||
{
|
||||
@@ -3934,6 +3940,12 @@ void ImageDrawRectangleLinesEx(Image *dst, Rectangle rec, int thick, Color color
|
||||
ImageDrawRectangle(dst, (int)rec.x, (int)(rec.y + rec.height - thick), (int)rec.width, thick, color);
|
||||
}
|
||||
|
||||
// Draw rectangle with gradient colors within an image, counter-clockwise color order
|
||||
void ImageDrawRectangleGradientEx(Image *dst, Rectangle rec, Color col1, Color col2, Color col3, Color col4)
|
||||
{
|
||||
// TODO: NEW: Implement ImageDrawRectangleGradientEx()
|
||||
}
|
||||
|
||||
// Draw circle within an image
|
||||
void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color)
|
||||
{
|
||||
@@ -4001,7 +4013,7 @@ void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color)
|
||||
// Draw a gradient-filled circle within an image
|
||||
void ImageDrawCircleGradient(Image *dst, Vector2 center, float radius, Color inner, Color outer)
|
||||
{
|
||||
// TODO: Implement gradient circle drawing
|
||||
// TODO: NEW: Implement ImageDrawCircleGradient()
|
||||
}
|
||||
|
||||
// Draw an image within an image
|
||||
@@ -4012,6 +4024,12 @@ void ImageDrawImage(Image *dst, Image src, int posX, int posY, Color tint)
|
||||
ImageDrawImagePro(dst, src, srcRec, dstRec, (Vector2){ 0 }, 0.0f, tint);
|
||||
}
|
||||
|
||||
// Draw an image with scaling and rotation within an image
|
||||
void ImageDrawImageEx(Image *dst, Image src, Vector2 position, float rotation, float scale, Color tint)
|
||||
{
|
||||
// TODO: NEW: Implement ImageDrawImageEx()
|
||||
}
|
||||
|
||||
// Draw a part of an image defined by a rectangle within an image
|
||||
void ImageDrawImageRec(Image *dst, Image src, Rectangle srcRec, Vector2 position, Color tint)
|
||||
{
|
||||
@@ -4020,8 +4038,7 @@ void ImageDrawImageRec(Image *dst, Image src, Rectangle srcRec, Vector2 position
|
||||
}
|
||||
|
||||
// Draw a part of an image defined by a rectangle into destination rectangle, with scaling and rotation, within an image
|
||||
// NOTE: Color tint is applied to source image
|
||||
// TODO: WARNING: origin and rotation are not implemented
|
||||
// TODO: REVIEW: ImageDrawImagePro(), implement origin and rotation for image drawing
|
||||
void ImageDrawImagePro(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Vector2 origin, float rotation, Color tint)
|
||||
{
|
||||
// Security check to avoid program crash
|
||||
@@ -4199,6 +4216,12 @@ void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position,
|
||||
UnloadImage(imText);
|
||||
}
|
||||
|
||||
// Draw text using Font and pro parameters (rotation)
|
||||
void ImageDrawTextPro(Image *dst, Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint)
|
||||
{
|
||||
// TODO: NEW: Implement ImageDrawImageEx()
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Texture loading functions
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user