?
Solved

How to change a pixel color with out using SetPixel() function

Posted on 2008-11-10
5
Medium Priority
?
875 Views
Last Modified: 2013-12-14
Hi,
        How can I change the Pixel color of our window DC with out using the function SetPixel() function
in Vc++, I am searching for a method for getting the direct pointer address of our window DC location.
So I can change the RGB value using memory address (Pointer)
0
Comment
Question by:inampudi1
  • 3
  • 2
5 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 1500 total points
ID: 22928806
Hi inampudi,

IMO direct access to pixel's RGB values of a window's DC is not possible. For example see this discussion: http://discuss.joelonsoftware.com/default.asp?joel.3.674212.14

You can create a memory device context (CreateCompatibleDC). For this you can create DIB (i.e. CreateDIBSection) and access the pixels there - then use BitBlt to draw this bitmap to the window ...

Hope that helps,

ZOPPO

0
 

Author Comment

by:inampudi1
ID: 22929110
Hi experts,
                      can We create a DIB which will automatically refresh to the DC with out calling BitBlt or StretchBlt etc like functions . Because i want a very fast method. Is BitBlt() copy the entire image to the DC or Just set The pointer.Or is there any method to directly set out DIB pointer to our Window DC.
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 22929156
Hi again,

no, IMO you can't do anything else than blitting the bitmap to the real DC (at least not in Windows GDI) - the problem simply is you would need to have access to the graphics-card's memory which is blocked - the only way to achive such things would be to use DirectX/DirectDraw. Anyway, how fast do you want to have it? BitBlt isn't such slow - for example I once wrote a bitmap roation test program which managed to rotate and paint a 800x600 pixel image on a 2,4 GHz machine with about 160 fps.

BitBlt copies the image (or a part of it) to the real DC ...

ZOPPO
0
 

Author Closing Comment

by:inampudi1
ID: 31515426
HI Zoppo,
                     Your Guidance is Good, it is well cleared..
And it is very helpfull to me...
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 22929216
That's fine, I'm glad I could help ...

Have a nice day,

best regards,

ZOPPO
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question