| 1 |
pngtopic |
| 2 |
|
| 3 |
ABOUT: |
| 4 |
|
| 5 |
Convert a png formatted graphics file into a format that may be |
| 6 |
inserted into a Microchip PIC .asm file. The main purpose is to allow |
| 7 |
graphics to be easily used with gpsim's graphic LCD driver. |
| 8 |
|
| 9 |
The gpsim graphics LCD driver supports only monochrome displays. Each |
| 10 |
pixel is thus either on or off. pngtopic will convert color to black |
| 11 |
and white by thresholding a color image. Or, if an image is already |
| 12 |
monochrome, pngtopic should handle it just fine too. |
| 13 |
|
| 14 |
|
| 15 |
COMPILE |
| 16 |
|
| 17 |
Compile with: |
| 18 |
|
| 19 |
gcc -g -o pngtopic pngtopic.c -lpng |
| 20 |
|
| 21 |
|
| 22 |
USAGE |
| 23 |
|
| 24 |
usage: pngtopic [-i] filename.png |
| 25 |
options: |
| 26 |
-i - invert pixels |
| 27 |
-p - preview ASCII image |
| 28 |
|
| 29 |
The optional '-i' will invert the pixel color (black and white are |
| 30 |
exchanged). |
| 31 |
|
| 32 |
The optional '-p' will display an ASCII image. This is useful for |
| 33 |
previewing the image to see if the color-to-monochrome conversion |
| 34 |
looks good or not. Also, the ASCII image can serve as assembly |
| 35 |
documentation. |
| 36 |
|
| 37 |
|
| 38 |
EXAMPLES: |
| 39 |
|
| 40 |
KDE has some small black and white icons. Here's one for konqueror: |
| 41 |
|
| 42 |
|
| 43 |
$ ./pngtopic -p -i konqueror16X16.png |
| 44 |
|
| 45 |
; pngtopic - png to gpasm PIC include file |
| 46 |
; for use with gpsim's graphic's LCD driver |
| 47 |
; Copyright 2005 - Scott Dattalo |
| 48 |
; Automatically converted from konqueror16X16.png |
| 49 |
; |
| 50 |
; |
| 51 |
; [] [][] . |
| 52 |
; [] [] [] [] . |
| 53 |
; [] [][][][] [] [] . |
| 54 |
; [] [][][][][] [][] []. |
| 55 |
; [] [][][][][][][] []. |
| 56 |
; [][][][][][][][] . |
| 57 |
; [][][][][][] . |
| 58 |
; [][] [][] . |
| 59 |
; [] . |
| 60 |
; [] . |
| 61 |
; [][][] . |
| 62 |
; [] [][][] []. |
| 63 |
; [] [][][][] []. |
| 64 |
; [] [][][][][] [] . |
| 65 |
; [] [][][][] [] . |
| 66 |
; [][] [] [][] . |
| 67 |
; |
| 68 |
db 0x10,0x02 ;width in pixels and height in bytes |
| 69 |
db 0x18,0x04,0x22,0xf8,0xfd,0x7e,0xfc,0xfe |
| 70 |
db 0x70,0x3c,0x08,0x01,0x01,0x02,0x04,0x18 |
| 71 |
db 0x18,0x20,0x40,0x80,0x81,0x06,0x04,0x7c |
| 72 |
db 0xf8,0x78,0x70,0xa0,0x80,0x40,0x20,0x18 |