I want to use the function GetPixel or anything else to get each pixel and treat each color on the bitmap 
Author Message
 I want to use the function GetPixel or anything else to get each pixel and treat each color on the bitmap

Hi , I loaded a bitmap whit the function LoadImage and I want to use the
function GetPixel or anything else to get each pixel and treat each
color on the bitmap... It is possible ??

If a better solution exist can you give it to me....  I just want to
load a bmp image and treat each color on each pixel on it...

Thank you
Eric

THERE IS MY CODE  THAT I'VE TRIED

********************************

//-------------------------
COLORREF color;
//--------------------------

 m_pathbitmap = "c:\\temp\\pcany2.bmp";  //path du bitmap a aller
chercher
 m_ontest =1;

 // TODO: Add your control notification handler code here

 HBITMAP hBitmap = (HBITMAP)
::LoadImage(AfxGetInstanceHandle(),m_pathbitmap,IMAGE_BITMAP,0,0,LR_LOADFROMFILE
| LR_CREATEDIBSECTION);

 if(hBitmap){

  if(m_bitmap.DeleteObject()) m_bitmap.Detach();
  m_bitmap.Attach(hBitmap);

// --------------------------
  ----------------->color = GetPixel(????????,2,2);
//---------------------------
 }



Mon, 29 Jul 2002 03:00:00 GMT  
 I want to use the function GetPixel or anything else to get each pixel and treat each color on the bitmap
You're better off just getting the bitmap bits and walking over them.
10-100 times faster.
                        joe

On Thu, 10 Feb 2000 09:33:19 -0500, Eric Langevin

Quote:

>Hi , I loaded a bitmap whit the function LoadImage and I want to use the
>function GetPixel or anything else to get each pixel and treat each
>color on the bitmap... It is possible ??

>If a better solution exist can you give it to me....  I just want to
>load a bmp image and treat each color on each pixel on it...

>Thank you
>Eric

>THERE IS MY CODE  THAT I'VE TRIED

>********************************

>//-------------------------
>COLORREF color;
>//--------------------------

> m_pathbitmap = "c:\\temp\\pcany2.bmp";  //path du bitmap a aller
>chercher
> m_ontest =1;

> // TODO: Add your control notification handler code here

> HBITMAP hBitmap = (HBITMAP)
>::LoadImage(AfxGetInstanceHandle(),m_pathbitmap,IMAGE_BITMAP,0,0,LR_LOADFROMFILE
>| LR_CREATEDIBSECTION);

> if(hBitmap){

>  if(m_bitmap.DeleteObject()) m_bitmap.Detach();
>  m_bitmap.Attach(hBitmap);

>// --------------------------
>  ----------------->color = GetPixel(????????,2,2);
>//---------------------------
> }

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Mon, 29 Jul 2002 03:00:00 GMT  
 I want to use the function GetPixel or anything else to get each pixel and treat each color on the bitmap
CBitmap m_bitmap;
// Suppose it's already loaded and contains a valid image
CDC dc;
dc.CreateCompatibleDC(0);
CBitmap *pOldBmp = dc.SelectObject(&m_bitmap);
COLORREF cl = dc.GetPixel(2, 2);
// When you are done
dc.SelectObject(pOldBmp);

If you want faster access to pixel information in the bitmap, see
CBitmap::GetBitmapBits.

With best wishes,
    Igor Tandetnik


Quote:
> Hi , I loaded a bitmap whit the function LoadImage and I want to use
the
> function GetPixel or anything else to get each pixel and treat each
> color on the bitmap... It is possible ??

> If a better solution exist can you give it to me....  I just want to
> load a bmp image and treat each color on each pixel on it...

> Thank you
> Eric

> THERE IS MY CODE  THAT I'VE TRIED

> ********************************

> file://-------------------------
> COLORREF color;
> file://--------------------------

>  m_pathbitmap = "c:\\temp\\pcany2.bmp";  file://path du bitmap a
aller
> chercher
>  m_ontest =1;

>  // TODO: Add your control notification handler code here

>  HBITMAP hBitmap = (HBITMAP)

::LoadImage(AfxGetInstanceHandle(),m_pathbitmap,IMAGE_BITMAP,0,0,LR_LO
ADFROMFILE

- Show quoted text -

Quote:
> | LR_CREATEDIBSECTION);

>  if(hBitmap){

>   if(m_bitmap.DeleteObject()) m_bitmap.Detach();
>   m_bitmap.Attach(hBitmap);

> // --------------------------
>   ----------------->color = GetPixel(????????,2,2);
> file://---------------------------
>  }



Tue, 30 Jul 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. I want to use the function GetPixel or anything else to get each pixel and

2. CDC::GetPixel() returns a -1 as if the pixel is not in clip region

3. anything wrong when using pop function?

4. Debugging code that uses Pixel Format Functions

5. How Can we Read The Screen Contents Without Using GetPixel

6. RGB from GetPixel, using user32.dll

7. Confusion about treating malloc char* as char[] in function

8. Getting The Current Screen Resoultion In Pixels?

9. Getting Pixels From Bitmaps

10. getting the length of a text in pixels

11. Getting a pixel from a window

12. Getting Twips Per Pixel

 

 
Powered by phpBB® Forum Software