mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-04 22:47:44 -04:00
fonts: add uyvy function
This commit is contained in:
parent
9227a7770e
commit
3e1124f989
2 changed files with 41 additions and 0 deletions
40
fonts.c
40
fonts.c
|
@ -261,6 +261,46 @@ void basic_text_out16_nf(void *fb, int w, int x, int y, const char *text)
|
|||
}
|
||||
}
|
||||
|
||||
void basic_text_out_uyvy_nf(void *fb, int w, int x, int y, const char *text)
|
||||
{
|
||||
int i, l;
|
||||
unsigned short *screen;
|
||||
|
||||
screen = (unsigned short *)fb + x + y * w;
|
||||
for (i = 0; ; i++, screen += 8)
|
||||
{
|
||||
char c = text[i];
|
||||
if (c == 0)
|
||||
break;
|
||||
if (c == ' ')
|
||||
continue;
|
||||
|
||||
for (l = 0; l < 8; l++)
|
||||
{
|
||||
unsigned char fd = fontdata8x8[c * 8 + l];
|
||||
unsigned char *s = (void *)(screen + l * w);
|
||||
unsigned char fd1, fdp = 0;
|
||||
|
||||
if (fd&0x80) s[0 * 2 + 1] = 235;
|
||||
if (fd&0x40) s[1 * 2 + 1] = 235;
|
||||
if (fd&0x20) s[2 * 2 + 1] = 235;
|
||||
if (fd&0x10) s[3 * 2 + 1] = 235;
|
||||
if (fd&0x08) s[4 * 2 + 1] = 235;
|
||||
if (fd&0x04) s[5 * 2 + 1] = 235;
|
||||
if (fd&0x02) s[6 * 2 + 1] = 235;
|
||||
if (fd&0x01) s[7 * 2 + 1] = 235;
|
||||
|
||||
// draw "shadow"
|
||||
if (l > 0)
|
||||
fdp = fontdata8x8[c * 8 + l - 1];
|
||||
|
||||
for (fd1 = 0x80; fd1 != 0; fd1 >>= 1, s += 2)
|
||||
if (!(fd & (fd1 >> 1)) && ((fdp | fd) & fd1))
|
||||
s[1] /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void basic_text_out16(void *fb, int w, int x, int y, const char *texto, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
1
fonts.h
1
fonts.h
|
@ -4,3 +4,4 @@ extern unsigned char fontdata6x8[256-32][8];
|
|||
|
||||
void basic_text_out16_nf(void *fb, int w, int x, int y, const char *text);
|
||||
void basic_text_out16(void *fb, int w, int x, int y, const char *texto, ...);
|
||||
void basic_text_out_uyvy_nf(void *fb, int w, int x, int y, const char *text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue