Understanding bitmaps in PocketC

Discuss PocketC for Palm OS (including Desktop Edition)

Postby iebnn on Sat Feb 17, 2001 1:41 am

I'm working on a more advanced and easier to use program that will convert bitmaps to hex.
I'm having trouble with getting the hex to come out right (as I'm not quite sure exactly how the bitmap format works in pocketc).
Could someone post something that would tell me how I would program something to find out the hex for the bitmap? I'm a bit confused about the four pixels thing. I got it to convert to hex properly, but it has the hex value for every pixel, not the hex value for four pixels combined (if I'm approaching this properly). Thanks
iebnn
 
Posts: 42
Joined: Fri Feb 09, 2001 8:40 pm

Postby wossname on Sat Feb 24, 2001 7:18 am

Quite simple, if you know how hex/binary work.

Bitmap(20,30,"018");

this above line of code draws a single dot on the screen at the co-ords (20,30).

the string that is used as the last argument is a hex string, the first 2 digits define the width of your bitmap in pixels, thus "01" is one pixel wide. As you will know, each hex character takes the place of 4 binary bits therefore the leftmost of those 4 bits is worth 8 in the binary system.

so a square of dots 3x3 printed at the same coordimates would be drawn as...

bitmap(20,30,"03F78");

<font face=Courier New>
XXX --> first 3 bits of "F"
X X --> last bit of "F" and first 2 bits of 7
XXX --> last 2 bits of 7 and first bit of 8, the last 3 bits of 8 are white</font id=Courier New>

Okay?

Wossname :)
Wossname :)
Are you <i>local</i>?
wossname
 
Posts: 275
Joined: Sat Feb 24, 2001 7:18 am

Postby iebnn on Tue Feb 27, 2001 8:10 pm

hmm looks pretty simple
I'll try coding it and if I can't get it to work I'll post the algorithm here and maybe ya could give me some help? :)
iebnn
 
Posts: 42
Joined: Fri Feb 09, 2001 8:40 pm

Postby wossname on Wed Feb 28, 2001 5:47 pm

sure, just email me, wossnamex@talk21.com

Wossname :)
Wossname :)
Are you <i>local</i>?
wossname
 
Posts: 275
Joined: Sat Feb 24, 2001 7:18 am


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 2 guests

cron