|
Post by dhinson on Feb 17, 2014 9:45:13 GMT -8
Fonts 17 and 19 printed in 4.5 of the GD2 book show what looks to be partial sets of the standard VGA code page 437 font. Does anyone know if full CP437 is supported?
Thanks
|
|
|
Post by jamesbowman on Feb 17, 2014 16:11:51 GMT -8
Yes, CP437 is implemented in a few ways. 8x8 characters are implemented in fonts 16 and 17. Font 16 is characters 0-127, font 17 is characters 128-255. 8x16 are similarly split across fonts 18 and 19. There is also a "VGA" format for bitmaps, so you can create a memory-mapped character display in VGA format like this: GD.Clear(); GD.BitmapSource(0); GD.BitmapLayout(TEXTVGA, 2 * 60, 17); GD.BitmapSize(NEAREST, BORDER, BORDER, 480, 272); GD.Begin(BITMAPS); GD.Vertex2ii(0,0);
and now graphics memory from address 0 upwards is a VGA-format screen, 60 characters wide. So for example to fill it with random characters: void loop() { GD.wr(random(2 * 60 * 17), random(256)); } 
|
|
|
Post by dhinson on Feb 17, 2014 20:15:55 GMT -8
Very nice! Thanks.
|
|
|
Post by dhinson on Feb 19, 2014 13:31:52 GMT -8
James, when in TEXTVGA mode the low nibble of the attribute byte behaves as expected but the high nibble seems to have no effect (usually background color?). Is this by design or am I missing something? Is there another way to accomplish different background colors for text? I tried overwriting a solid fill char (0xDB) with another text char to see if the backgrounds were alpha'd but apparently not.
Regards
|
|
|
Post by jamesbowman on Feb 19, 2014 17:35:09 GMT -8
Right, transparency TEXTVGA is a bit tricky. TEXTVGA gives an alpha of zero to the background pixels - this makes them transparent. To make the background pixels opaque the blend function needs to be set to replace pixels, i.e. ignore the bitmap's alpha channel. So adding this command before the Vertex2ii(): GD.BlendFunc(ONE, ZERO); gives:  The book describes BlendFunc() on page 53.
|
|
|
Post by dhinson on Feb 20, 2014 12:33:43 GMT -8
Works as advertised.
Thanks
|
|