HDC's

Reply

Join Date: Jul 2007
Posts: 15
Reputation: Fromethius is an unknown quantity at this point 
Solved Threads: 0
Fromethius Fromethius is offline Offline
Newbie Poster

HDC's

 
0
  #1
Jul 24th, 2007
Hello everyone,

I have this code:

  1. Image* newImage = Image::FromFile(szFileName);
  2. Bitmap image(50, 50);
  3. Graphics graphics(&image);
  4. HDC gfxHDC = graphics.GetHDC();
  5. graphics.DrawImage(newImage, 0, 0);
  6. int pixel, row;
  7. for (pixel = 1, row = 1; row <= 50; pixel++)
  8. if (GetPixel(gfxHDC, pixel, row) != RGB(255, 255, 255))

Anyways, whenever I use GetPixel, the IF statement ALWAYS runs. Even if it is a completely white image. I suspect that either DrawImage isn't drawing it onto gfxHDC or that GetPixel isn't reading the pixels from gfxHDC or I don't even know. The point is, it isn't working and I need some help.

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: HDC's

 
1
  #2
Jul 24th, 2007
Get the return value of GetPixel and RGB functions to seperate variables. See if the values are infact what you expect, rather than just comparing them.

Also read the remarks section of the GetPixel documentation.
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC