From 762784c01baec27dffcf1437b2427a45d82a59de Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 8 Apr 2009 21:39:21 +0000 Subject: add font glyph plotting support svn path=/trunk/libnsfb/; revision=7068 --- test/plottest.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'test') diff --git a/test/plottest.c b/test/plottest.c index 992fdd9..f2008fa 100644 --- a/test/plottest.c +++ b/test/plottest.c @@ -14,6 +14,56 @@ extern const struct { unsigned char pixel_data[132 * 135 * 4 + 1]; } nsglobe; +const struct { + unsigned int w; + unsigned int h; + unsigned char data[16]; +} Mglyph1 = { + 8, 16, { + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0xc6, /* 11000110 */ + 0xee, /* 11101110 */ + 0xfe, /* 11111110 */ + 0xfe, /* 11111110 */ + 0xd6, /* 11010110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0xc6, /* 11000110 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + 0x00, /* 00000000 */ + } +}; + +const struct { + unsigned int w; + unsigned int h; + unsigned char data[16 * 8]; +} Mglyph8 = { + 8, 16, { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */ + 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, /* 00000000 */ + 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */ + 0xaa, 0xff, 0xff, 0x00, 0xff, 0xff, 0xaa, 0x00, /* 11101110 */ + 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaa, 0x00, /* 11111110 */ + 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaa, 0x00, /* 11111110 */ + 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11010110 */ + 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */ + 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */ + 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */ + 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */ + 0xaa, 0xff, 0x00, 0x00, 0x00, 0xff, 0xaa, 0x00, /* 11000110 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00000000 */ + } +}; + int main(int argc, char **argv) { nsfb_t *nsfb; @@ -147,6 +197,26 @@ int main(int argc, char **argv) nsfb_plot_bitmap(nsfb, &box3, (nsfb_colour_t *)nsglobe.pixel_data, nsglobe.width, nsglobe.height, nsglobe.width, true); + /* test glyph plotting */ + for (loop = 100; loop < 200; loop+= Mglyph1.w) { + box3.x0 = loop; + box3.y0 = 20; + box3.x1 = box3.x0 + Mglyph8.w; + box3.y1 = box3.y0 + Mglyph8.h; + + nsfb_plot_glyph1(nsfb, &box3, Mglyph1.data, Mglyph1.w, 0xff000000); + } + + /* test glyph plotting */ + for (loop = 100; loop < 200; loop+= Mglyph8.w) { + box3.x0 = loop; + box3.y0 = 50; + box3.x1 = box3.x0 + Mglyph8.w; + box3.y1 = box3.y0 + Mglyph8.h; + + nsfb_plot_glyph8(nsfb, &box3, Mglyph8.data, Mglyph8.w, 0xff000000); + } + nsfb_release(nsfb, &box); /* random rectangles in clipped area*/ -- cgit v1.2.1