Re: 32 bitmap buffer Question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



// 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!



.



Relevant Pages

  • Re: Question on Animation
    ... a bitmap on a picture box ... ... So by recreating it you would have the additional ... buffer, then use a subsection of the buffer if the size gets smaller. ... There is, however, a price to pay: Getting a 10x10 pixel image from ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Question on Animation
    ... Infact I always draw on a trasparent bitmap. ... At the present I recreate bitmap and graphics each time. ... buffer, then use a subsection of the buffer if the size gets smaller. ... There is, however, a price to pay: Getting a 10x10 pixel image from ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: how do you do freehand drawing on a panel
    ... you need to know what to do someone drags something over your panel so ... you need to buffer what ever you've drawn so you can redraw it when it ... You'll need to know how to set a single pixel or range of pixels, ... simplicity to set up the bitmap ...
    (microsoft.public.dotnet.languages.csharp)
  • =?iso-8859-1?Q?Re:_CopyFromScreen_Bitmap_als_Bild_speichern_und_Gr=F6=DFe?= =?iso-8859&#
    ... wenn du mit der Auflösung festlegst, dass in einem Zoll 96 Pixel darzustellen sind, dann belegen 200 Pixel etwa 55 mm. ... Dim bmp As Bitmap = New Bitmap ... g.DrawImage(bmp, 0, 0, breite, hoehe) ... Wie Du erkennen kannst ist die Linke Grafik nur noch halb so breit wie die Obere, ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: count colors in bitmap
    ... But on my own two machines your code DOES crash on a 1024 x 768 bitmap! ... And it also DOES crashes on a 3200 x 2400 pixel bitmap. ... Why don't you just believe me, and check things out further yourself, perhaps on the machines of other people you might know, specifically on machines that might be differently configured and running different vesions of the OS than your own. ... Private Declare Function LoadImage Lib "user32" Alias _ ...
    (microsoft.public.vb.general.discussion)