forked from pyrite-dev/milsko
ft2, stbtt: draw letters over each other so that they don't clip each other
This commit is contained in:
parent
a652514ab0
commit
42af900127
2 changed files with 22 additions and 8 deletions
|
|
@ -74,10 +74,17 @@ static int ft2_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const c
|
|||
int oy = y + (ttf->face->height * ttf->px / ttf->face->units_per_EM) - ttf->face->glyph->bitmap_top + cy + (ttf->face->descender * ttf->px / ttf->face->units_per_EM);
|
||||
unsigned char* opx = &px[(oy * tw + ox) * 4];
|
||||
|
||||
opx[0] = color->common.red;
|
||||
opx[1] = color->common.green;
|
||||
opx[2] = color->common.blue;
|
||||
opx[3] = bmp->buffer[cy * bmp->pitch + cx];
|
||||
if(opx[3] == 0) {
|
||||
opx[0] = color->common.red;
|
||||
opx[1] = color->common.green;
|
||||
opx[2] = color->common.blue;
|
||||
opx[3] = bmp->buffer[cy * bmp->pitch + cx];
|
||||
} else {
|
||||
opx[0] = (opx[0] / color->common.red) / 255;
|
||||
opx[1] = (opx[1] / color->common.green) / 255;
|
||||
opx[2] = (opx[2] / color->common.blue) / 255;
|
||||
opx[3] = bmp->buffer[cy * bmp->pitch + cx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,17 @@ static int stbtt_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const
|
|||
int oy = y + ceil(ttf->ascent * ttf->scale) + y0 + cy;
|
||||
unsigned char* opx = &px[(oy * tw + ox) * 4];
|
||||
|
||||
opx[0] = color->common.red;
|
||||
opx[1] = color->common.green;
|
||||
opx[2] = color->common.blue;
|
||||
opx[3] = out[cy * ow + cx];
|
||||
if(opx[3] == 0) {
|
||||
opx[0] = color->common.red;
|
||||
opx[1] = color->common.green;
|
||||
opx[2] = color->common.blue;
|
||||
opx[3] = out[cy * ow + cx];
|
||||
} else {
|
||||
opx[0] = (opx[0] / color->common.red) / 255;
|
||||
opx[1] = (opx[1] / color->common.green) / 255;
|
||||
opx[2] = (opx[2] / color->common.blue) / 255;
|
||||
opx[3] = out[cy * ow + cx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue