| | |
HDC's
![]() |
•
•
Join Date: Jul 2007
Posts: 15
Reputation:
Solved Threads: 0
Hello everyone,
I have this code:
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.
I have this code:
C++ Syntax (Toggle Plain Text)
Image* newImage = Image::FromFile(szFileName); Bitmap image(50, 50); Graphics graphics(&image); HDC gfxHDC = graphics.GetHDC(); graphics.DrawImage(newImage, 0, 0); int pixel, row; for (pixel = 1, row = 1; row <= 50; pixel++) 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.
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.
Also read the remarks section of the GetPixel documentation.
バルサミコ酢やっぱいらへんで
![]() |
Similar Threads
- Want to write script to back-up up Linux hdb drive to hdc drice (*nix Hardware Configuration)
- Drawing bitmap on window - how to clear window/HDC? (C)
- Visual C++ Form Project - need to get HDC for drawing bitmaps (C++)
- a non-destructive repartitioning tool? (*nix Software)
- "missing storage-class or type specifiers" error (C++)
- Red Hat 9 and Windows 2000 dual boot (*nix Software)
- LS-120 drive (*nix Hardware Configuration)
- GDI (C)
Other Threads in the C++ Forum
- Previous Thread: why return an int from main?
- Next Thread: Q: in Link List (Daubly Linked List)
| Thread Tools | Search this Thread |
action api array auto based beginner binary bitmap c++ c/c++ calculator challenge char class classes code coding compile console conversion count createcopyofanyfileinc delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game garbage givemetehcodez graph gui hmenu homeworkhelp homeworkhelper iamthwee ifstream input insert int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node noob output parameter pointer primenumbersinrange problem program programming project python random read recursion reference rpg sockets string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets






