Getting Pixels From Bitmaps 
Author Message
 Getting Pixels From Bitmaps

I have been debugging a program that involves the use of
the GetPixel function to get the colors of the pixels from
a user defined box on a bitmap that is loaded by the
program.  The verson of the GetPixel function I have been
using has the handle as an external element ie.
  GetWindowDC()->GetPixel(x - GetScrollPosition().x,y -
                          ScrollPosition().y);
I have ensured that the x,y coordinates that are input to
the function agree with the raster grid of the Bitmap (ie
if I want pixel (300,300) on the bitmap, then x=300,
y=300).

The problem that I have experienced is that when GetPixel
does not keep returning -1, the colors that are return do
not make sense when compared to the image on screen (ie.
black is returned when I know the pixel should be white).

Can someone please give me some advice. The subsequent
calculations that are preformed are of course greatly
affected by this problem which has stumped me for some
time now.



Mon, 08 Dec 2003 22:14:23 GMT  
 Getting Pixels From Bitmaps

Quote:
>   GetWindowDC()->GetPixel(x - GetScrollPosition().x,y -
>                           ScrollPosition().y);
> I have ensured that the x,y coordinates that are input to
> the function agree with the raster grid of the Bitmap (ie
> if I want pixel (300,300) on the bitmap, then x=300,
> y=300).

Have you checked, hwo it works, when you use x=299,y=299 for pixel (300,300)
? I am not sure, but it might be, that there is a zero based coordinate
system interfering with a one based.

regards,

sascha



Tue, 09 Dec 2003 00:01:06 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Pixel alignment of bitmaps in VC5 dialog editor

2. display the bitmaps that have semitransparent pixels.

3. Getting The Current Screen Resoultion In Pixels?

4. getting the length of a text in pixels

5. Getting a pixel from a window

6. Getting Twips Per Pixel

7. autoscrolling pixel by pixel RichEditCtrl

8. Scrolling text, pixel by pixel in a RichEditView

9. Bitmaps (state images) in a ListView Control not Getting Displayed in win 2000

10. Getting bitmaps from a scanner

11. Display bitmaps in Print Preview and printing bitmaps.

12. 8 bit (256 color) bitmaps vs 24 bit bitmaps

 

 
Powered by phpBB® Forum Software