I have an array of Gray level values.
i want to display this on document area.
i know to display it with SetPixel function.
but i want something, to display it fast.
can i use the pointer corresponding to the display and for this purpose ????
Printable View
I have an array of Gray level values.
i want to display this on document area.
i know to display it with SetPixel function.
but i want something, to display it fast.
can i use the pointer corresponding to the display and for this purpose ????
Could you draw those values into a bitmap in some initialization code or are the values changing a lot? If they are not changing, draw them into a memory DC with a bitmap selected into it, then when you want to draw, just call BitBlt. If you want some code to do this, I can post some.
Chris Richardson
http://www.geometriccomputing.com
http://www.imagesensing.com
http://www.autoscope.com
thanx 4 the suggetion,
how can i transfer the array in to bitmap,
r u saying about DC ?
then
Shoud i use SetPixel() itself for that
bye 4 now
You should look at some of the DIB classes found in the Bitmap section. Using one,
you can directly access the pixels before drawing to your document. And it is
so much faster compared to using SetPixel().
good luck.
Hey man, I want to do the same thing. I'm a beginner to Visual C++, but I know some C/C++.
I want to read BMP-file, play with it a bit(array is preferable), and the display it. And I want to do it the easy understandable way. Back in the old days(DOS-based compilers) it wasn't that hard to read a BMP-file. I thought it would be lot easier with Visuall C++...
You could use SetPixel if you wanted to. Otherwise, you could directly access the pixels without using SetPixel. You just need to use CreateDIBSection. This function will give you an HBITMAP (which can be used for drawing), and it will also give you direct access to the bits.
Chris Richardson
http://www.geometriccomputing.com
http://www.imagesensing.com
http://www.autoscope.com