Added some image manipulation functions

Added (or completed functions):

Image ImageText(const char *text, int fontSize, Color color);
Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int
spacing, Color tint);
void ImageFlipVertical(Image *image);
void ImageFlipHorizontal(Image *image);
void ImageColorTint(Image *image, Color color);
void ImageColorInvert(Image *image);
void ImageColorGrayscale(Image *image);
void ImageColorContrast(Image *image, float contrast);
void ImageColorBrightness(Image *image, int brightness);
This commit is contained in:
Ray 2015-10-25 01:50:15 +02:00
parent 8c117cfb57
commit afdf357fbe
3 changed files with 233 additions and 55 deletions

View file

@ -279,9 +279,7 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color)
Vector2 position = { (float)posX, (float)posY };
int defaultFontSize = 10; // Default Font chars height in pixel
if (fontSize < defaultFontSize) fontSize = defaultFontSize;
int spacing = fontSize / defaultFontSize;
DrawTextEx(defaultFont, text, position, fontSize, spacing, color);
@ -380,7 +378,7 @@ Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int
for (int i = 0; i < len; i++)
{
textWidth += spriteFont.charRecs[(int)text[i] - FONT_FIRST_CHAR].width;
if (text[i] != '\n') textWidth += spriteFont.charRecs[(int)text[i] - FONT_FIRST_CHAR].width;
}
if (fontSize <= spriteFont.charRecs[0].height) scaleFactor = 1.0f;