diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-01-21 02:52:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-01-21 02:52:48 +0300 |
commit | 6f4c03a0911dd27e5b6bcd659d204db7c2ee2d38 (patch) | |
tree | 5c3740c902765262b13fe2f4fc2861a9b7346781 /intern/bmfont | |
parent | 3d7271f059d5cb5c6f2c7adfaec8d35858485da1 (diff) |
opengl stamp wasnt working right, stamp assumed an alpha channel existed.
Diffstat (limited to 'intern/bmfont')
-rw-r--r-- | intern/bmfont/BMF_Api.h | 3 | ||||
-rw-r--r-- | intern/bmfont/intern/BMF_Api.cpp | 4 | ||||
-rw-r--r-- | intern/bmfont/intern/BMF_BitmapFont.cpp | 10 | ||||
-rw-r--r-- | intern/bmfont/intern/BMF_BitmapFont.h | 3 |
4 files changed, 13 insertions, 7 deletions
diff --git a/intern/bmfont/BMF_Api.h b/intern/bmfont/BMF_Api.h index 1b4a4ee3129..4465242e9fa 100644 --- a/intern/bmfont/BMF_Api.h +++ b/intern/bmfont/BMF_Api.h @@ -152,8 +152,9 @@ void BMF_DrawStringTexture(BMF_Font* font, char* string, float x, float y, float * @param fbuf float image buffer, when NULL to not operate on it. * @param w image buffer width. * @param h image buffer height. + * @param channels number of channels in the image (3 or 4 - currently) */ -void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h); +void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels); #ifdef __cplusplus diff --git a/intern/bmfont/intern/BMF_Api.cpp b/intern/bmfont/intern/BMF_Api.cpp index eaa8ffb939d..24e053515fb 100644 --- a/intern/bmfont/intern/BMF_Api.cpp +++ b/intern/bmfont/intern/BMF_Api.cpp @@ -180,7 +180,7 @@ void BMF_DrawStringTexture(BMF_Font* font, char *string, float x, float y, float ((BMF_BitmapFont*)font)->DrawStringTexture(string, x, y, z); } -void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h) { +void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels) { if (!font) return; - ((BMF_BitmapFont*)font)->DrawStringBuf(str, posx, posy, col, buf, fbuf, w, h); + ((BMF_BitmapFont*)font)->DrawStringBuf(str, posx, posy, col, buf, fbuf, w, h, channels); } diff --git a/intern/bmfont/intern/BMF_BitmapFont.cpp b/intern/bmfont/intern/BMF_BitmapFont.cpp index 8e670c099a3..afdcf7fbfbb 100644 --- a/intern/bmfont/intern/BMF_BitmapFont.cpp +++ b/intern/bmfont/intern/BMF_BitmapFont.cpp @@ -241,7 +241,7 @@ void BMF_BitmapFont::DrawStringTexture(char *str, float x, float y, float z) } #define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val)) -void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h) +void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels) { int x, y; @@ -277,7 +277,9 @@ void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, un pixel[0] = colch[0]; pixel[1] = colch[1]; pixel[2] = colch[2]; - pixel[4] = 1; /*colch[3];*/ + if (channels==4) { + pixel[4] = 1; /*colch[3];*/ + } } } @@ -310,7 +312,9 @@ void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, un pixel[0] = col[0]; pixel[1] = col[1]; pixel[2] = col[2]; - pixel[3] = 1; /*col[3];*/ + if (channels==4) { + pixel[3] = 1; /*col[3];*/ + } } } } diff --git a/intern/bmfont/intern/BMF_BitmapFont.h b/intern/bmfont/intern/BMF_BitmapFont.h index 986de2bb399..f8d3d5370dd 100644 --- a/intern/bmfont/intern/BMF_BitmapFont.h +++ b/intern/bmfont/intern/BMF_BitmapFont.h @@ -130,8 +130,9 @@ public: * @param fbuf float image buffer, when NULL to not operate on it. * @param w image buffer width. * @param h image buffer height. + * @param channels number of channels in the image (3 or 4 - currently) */ - void DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h); + void DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels); protected: /** Pointer to the font data. */ |