How to display the Bitmap that created by CreateBitmap function?
-
In addition to the above post, you must bitblit the content from memdc to dc in the CThumbBmpView::OnPaint()function after the statement OnDraw(&memDC);
nave
I agree only on this (see my reply above). Additionally, the OP have to first select the bitmap inside the memDC. To summarize, the OP has to: (1) Create a compatible (memory) DC (2) Select the bitmap inside the memory DC. (3) Preform Perform
BitBlt
from the MemDC to the actual one. Hope that helps :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
I agree only on this (see my reply above). Additionally, the OP have to first select the bitmap inside the memDC. To summarize, the OP has to: (1) Create a compatible (memory) DC (2) Select the bitmap inside the memory DC. (3) Preform Perform
BitBlt
from the MemDC to the actual one. Hope that helps :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
I don't think this is the problem. Actually I don't think it is a problem.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
CPallini wrote:
(1) Create a compatible (memory) DC (2) Select the bitmap inside the memory DC.
I think the CXTPBufferDC will be hadling this.
nave
-
And why? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
i did all what u asked me to do. i converted CDC to CClientDc. But still it doesn't work. i am doing this for the first time and so can u please explain me a little more clearly?? or can u give me any related link that can help me???
Regards, Srinivas
if(!bitmap.CreateBitmap(1000,500,1,32,Buffer)) The bitmap file not only contains the pixel data information. It also contain a file header. But the CreateBitmap funtion only need bufffer information. So you must remove the header information from the buffer before passing it to CreateBitmap function. But still I dont understand why you directly read the bitmap. My suggestion is to use the LoadImage() instead of this.
nave
-
if(!bitmap.CreateBitmap(1000,500,1,32,Buffer)) The bitmap file not only contains the pixel data information. It also contain a file header. But the CreateBitmap funtion only need bufffer information. So you must remove the header information from the buffer before passing it to CreateBitmap function. But still I dont understand why you directly read the bitmap. My suggestion is to use the LoadImage() instead of this.
nave
Naveen R wrote:
But still I dont understand why you directly read the bitmap. My suggestion is to use the LoadImage() instead of this.
its because i don't have the File name or the file path with me. i just have the addresses of the starting sector and ending sector of the image file to work with. i am then reading the data between those sectors (which is nothing but the data of the image file) into a buffer. now i want to show the preview of that image by just using the data in the buffer before storing it as a file. i am still not able to succeed in what i am trying to do.
Regards, Srinivas
-
Naveen R wrote:
But still I dont understand why you directly read the bitmap. My suggestion is to use the LoadImage() instead of this.
its because i don't have the File name or the file path with me. i just have the addresses of the starting sector and ending sector of the image file to work with. i am then reading the data between those sectors (which is nothing but the data of the image file) into a buffer. now i want to show the preview of that image by just using the data in the buffer before storing it as a file. i am still not able to succeed in what i am trying to do.
Regards, Srinivas