From: notaz Date: Sat, 17 Nov 2012 22:21:30 +0000 (+0200) Subject: fonts: add uyvy function X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e1124f989febba80ef582c1200153ed176226f0;p=libpicofe.git fonts: add uyvy function --- diff --git a/fonts.c b/fonts.c index cbad3c6..c1164b4 100644 --- a/fonts.c +++ b/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; diff --git a/fonts.h b/fonts.h index b66993c..e565c93 100644 --- a/fonts.h +++ b/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);