summaryrefslogtreecommitdiffhomepage
path: root/src/text.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-05-09 12:05:00 +0200
committerraysan5 <[email protected]>2020-05-09 12:05:00 +0200
commit959447d8ed69e63b279bc5b72354c9d14a266e8f (patch)
treed5f948766f9f893dfb20eaa6e4cf6137be447539 /src/text.c
parent4e29294caa2ff80bb3dadbeb8bb495b5150fd764 (diff)
downloadraylib-959447d8ed69e63b279bc5b72354c9d14a266e8f.tar.gz
raylib-959447d8ed69e63b279bc5b72354c9d14a266e8f.zip
Reorganized texture functions
Removed ImageAlphaMask() dependency on [text] LoadBMFont()
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/text.c b/src/text.c
index c85d27b6..8439472d 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1733,8 +1733,17 @@ static Font LoadBMFont(const char *fileName)
if (imFont.format == UNCOMPRESSED_GRAYSCALE)
{
// Convert image to GRAYSCALE + ALPHA, using the mask as the alpha channel
- ImageAlphaMask(&imFont, imFont);
- for (int p = 0; p < (imFont.width*imFont.height*2); p += 2) ((unsigned char *)(imFont.data))[p] = 0xff;
+ Image imFontAlpha = ImageCopy(imFont);
+ ImageFormat(&imFontAlpha, UNCOMPRESSED_GRAY_ALPHA);
+
+ for (int p = 0, i = 0; p < (imFont.width*imFont.height*2); p += 2, i++)
+ {
+ ((unsigned char *)(imFontAlpha.data))[p] = 0xff;
+ ((unsigned char *)(imFontAlpha.data))[p + 1] = ((unsigned char *)imFont.data)[i];
+ }
+
+ UnloadImage(imFont);
+ imFont = imFontAlpha;
}
font.texture = LoadTextureFromImage(imFont);