urgent..How to use GetDeviceCaps() n GetPixel() problem
-
my pgm was using GetPixel() function, but i realize not all device support the function and that we can use GetDeviceCap() to check its RC_BITBLT capability. so though i'm not exactly sure how to use the function, i tried the following..
int test = dc->GetDeviceCaps(RASTERCAPS);
(1)It returns me a negative value(-4349)...what does this mean? What shld the function return me if my device has RC_BITBLT capability anyway? (2)If my device doesnt have the capability, what can i do to have the capability? And what determines whether a device has the capability? thks -
my pgm was using GetPixel() function, but i realize not all device support the function and that we can use GetDeviceCap() to check its RC_BITBLT capability. so though i'm not exactly sure how to use the function, i tried the following..
int test = dc->GetDeviceCaps(RASTERCAPS);
(1)It returns me a negative value(-4349)...what does this mean? What shld the function return me if my device has RC_BITBLT capability anyway? (2)If my device doesnt have the capability, what can i do to have the capability? And what determines whether a device has the capability? thksI think it is merely:
bool bPelSupport=dc->GetDeviceCaps(RASTERCAPS)!=RC_NONE;
If your display doesn't support raster operations, then I guess there are no pixels? ;-) Render to an offscreen bitmap and test that or directly test against the model from which the display is drawn. (if it is yours)
-
I think it is merely:
bool bPelSupport=dc->GetDeviceCaps(RASTERCAPS)!=RC_NONE;
If your display doesn't support raster operations, then I guess there are no pixels? ;-) Render to an offscreen bitmap and test that or directly test against the model from which the display is drawn. (if it is yours)
bool bPelSupport=dc->GetDeviceCaps(RASTERCAPS)!=RC_NONE;
gives me compilation error...should there be a bracket somewhere? anyway my dc is defined as below,in my CView class...so shouldnt it have pixels?..CDC *dc=this->GetDC();
Anyway how do i render to an offscreen bitmap? thks -
bool bPelSupport=dc->GetDeviceCaps(RASTERCAPS)!=RC_NONE;
gives me compilation error...should there be a bracket somewhere? anyway my dc is defined as below,in my CView class...so shouldnt it have pixels?..CDC *dc=this->GetDC();
Anyway how do i render to an offscreen bitmap? thksYou render to an offscreen bitmap by creating a memory device context for the bmp, or MemDC. You can then blt (BitBlt) to the memDC before blitting to the screen (or other DC). Something like: CDC MemDC; // Get the current DC and create a compatible memDC MemDC.CreateCompatibleDC(pDC); // Can now Blt to the MemDC... // Do stuff - draw, render, etc... // Don't forget to clean up.. MemDC.SelectObject();
-
You render to an offscreen bitmap by creating a memory device context for the bmp, or MemDC. You can then blt (BitBlt) to the memDC before blitting to the screen (or other DC). Something like: CDC MemDC; // Get the current DC and create a compatible memDC MemDC.CreateCompatibleDC(pDC); // Can now Blt to the MemDC... // Do stuff - draw, render, etc... // Don't forget to clean up.. MemDC.SelectObject();
-
You render to an offscreen bitmap by creating a memory device context for the bmp, or MemDC. You can then blt (BitBlt) to the memDC before blitting to the screen (or other DC). Something like: CDC MemDC; // Get the current DC and create a compatible memDC MemDC.CreateCompatibleDC(pDC); // Can now Blt to the MemDC... // Do stuff - draw, render, etc... // Don't forget to clean up.. MemDC.SelectObject();
But if the display device doesn't support blit operations (RASTERCAPS was RC_NONE) then he won't be able to draw to the offscreen image and blit as the last step. He will have to draw to both DCs instead, using the offscreen image merely for examination.