delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/23/02:02:06

From: jaster32 AT hotmail DOT com (Jaster)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Kinda long bitmap question...
Date: Tue, 23 Dec 1997 06:24:00 GMT
Organization: NssM Software
Lines: 41
Message-ID: <349f589b.30192598@news.earthlink.net>
References: <349ea65f DOT 126291690 AT news DOT earthlink DOT net> <199712222001 DOT PAA10650 AT delorie DOT com>
NNTP-Posting-Host: 207.217.143.134
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Mon, 22 Dec 1997 20:01:43 GMT, Alexander Bokovoy
<bokovoy AT bspu DOT ac DOT by> wrote:

>
>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 ==---

Thank you very much =) I didn't realize what that I had the struct an
int.. and thank you also for giving me an answer without being a
dick.. I've had problems with some whiners in this group.. but you
seem to be a nice guy .. thanks

Jaster...


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019