Mail Archives: djgpp/1997/12/22/15:03:32
On Mon, 22 Dec 1997 17:47:22 GMT jaster32 AT hotmail DOT com (Jaster) wrote:
>
> Ok.. in 320x200 graphics mode, I want to have a buffer[64000] that I
> can copy to a BITMAP * using memcpy.. for example
>
> memcpy(bitmap->line[0],buffer,64000);
>
> now my question is.. when I fill buffer[64000] with the int 4 and then
> memcpy it to a bitmap (320x200) that I have previously made.. instead
> of filling the whole bitmap with the color red.. it only fills
> everyother verticle line with red.. I'm not trying to use this as a
> clear_to_color() but I eventually hope to edit the buffer[64000]
> thereby being able to edit the bitmap...
If we assume that you use 256-color mode then the result of memcpy
operation was right. You should know that DJGPP's int is a 32-bit value.
So when you typed
int buffer[64000];
you defined buffer for 4*64000 bytes. memcpy gets first 64000 bytes of
them and transfers to bitmap. In memory your int 4 get 4 bytes:
0x04 0x00 0x00 0x00 and when you repeate it you'll have each 4th pixel
in line red and other pixels black. Of course 320/4=80 so you'll have 80
vertical lines on the screen divided by 3-pixel-wide black lines.
You should define your buffer as array of bytes and fill it with byte 4.
Alexander Bokovoy, <bokovoy AT bspu DOT ac DOT by>
---== The Soft Age coming soon ==---
- Raw text -