Re: 32 bitmap buffer Question
- From: "Michael Phillips, Jr." <mphillips53@xxxxxxxxxxxxxxx>
- Date: Wed, 17 May 2006 15:51:36 -0400
// Find the byte on which this scanline begins
DWORD ByteIndex = (bmHeight - y - 1) *bmWidthBytes;
// Find the byte containing this pixel
ByteIndex += x*4;
// get the pixel's colors
BYTE B = buffer[ByteIndex]; // blue
BYTE G = buffer[ByteIndex+1];// green
BYTE R = buffer[ByteIndex+2];// red
BYTE A = buffer[ByteIndex+3];// alpha
// the color itself
COLORREF color = RGB(R,G,B);
where x ranges from 0..bmWidth
where y ranges from 0..bmHeight
The above will guide you through a 32bpp bitmap.
"BartMan" <MaskProg@xxxxxxxxxxxxxxxx> wrote in message
news:54ADBA52-6CB5-429F-9E8E-28BE7D1D4166@xxxxxxxxxxxxxxxx
Greetings,
I am currently working with a 32 bit bitmap buffer with a size of 640x480.
My question is how can I get information from within the buffer according
to
the pixel positions.
I have the raw buffer, and I want to move within the buffer by using some
sort of offsets to get specific data.
For Example:
BYTE* myBuffer contains the information for a 640x480 32 bitmap.
The actual size of the bitmap buffer is: 640*480*4 = 1228800.
Now I want information from a specific section.
(ie:) pixel (10,10) to (15,10).
Or how would I get a full line of information?
(ie:) (0,1) to (0,679)
I would like to come up with some sort of offset system to move around in
the buffer, but I can't seem to get it to work correctly.
Thanks in advance for any suggestions!
.
- Prev by Date: Re: Desktop pixel manipulation
- Next by Date: Re: 'Out of Memory' exception when trying to Clone a Bitmap
- Previous by thread: Desktop pixel manipulation
- Next by thread: Re: 'Out of Memory' exception when trying to Clone a Bitmap
- Index(es):
Relevant Pages
|