G
Guest
Hello,
I have a 16 bit grayscale bitmap and want to draw this bitmap into another
one.
Look at the code:
void Test(void)
{
// Beep(200,200);
System:rawing::Bitmap* pBmpSrc=NULL;
System:rawing::Bitmap* pBmpDst=NULL;
System:rawing::Graphics* pGr=NULL;
try
{
pBmpSrc=new
Bitmap(50,50,System:rawing::Imaging:ixelFormat::Format16bppGrayScale);
pBmpDst=new
Bitmap(50,50,System:rawing::Imaging:ixelFormat::Format32bppPArgb);
pGr=Graphics::FromImage(pBmpDst);
pGr->DrawImageUnscaled(pBmpSrc,0,0);
}
__finally
{
if(pGr) {pGr->Dispose();}
if(pBmpSrc) {pBmpSrc->Dispose();}
if(pBmpDst) {pBmpDst->Dispose();}
}
}
The line
pGr->DrawImageUnscaled(pBmpSrc,0,0);
throws an System::ArgumentException.
How can I convert a Format16bppGrayScale-bitmap to a Format32bppPArgb bitmap?
Help is recommended, so much thanks in advance.
Michael
I have a 16 bit grayscale bitmap and want to draw this bitmap into another
one.
Look at the code:
void Test(void)
{
// Beep(200,200);
System:rawing::Bitmap* pBmpSrc=NULL;
System:rawing::Bitmap* pBmpDst=NULL;
System:rawing::Graphics* pGr=NULL;
try
{
pBmpSrc=new
Bitmap(50,50,System:rawing::Imaging:ixelFormat::Format16bppGrayScale);
pBmpDst=new
Bitmap(50,50,System:rawing::Imaging:ixelFormat::Format32bppPArgb);
pGr=Graphics::FromImage(pBmpDst);
pGr->DrawImageUnscaled(pBmpSrc,0,0);
}
__finally
{
if(pGr) {pGr->Dispose();}
if(pBmpSrc) {pBmpSrc->Dispose();}
if(pBmpDst) {pBmpDst->Dispose();}
}
}
The line
pGr->DrawImageUnscaled(pBmpSrc,0,0);
throws an System::ArgumentException.
How can I convert a Format16bppGrayScale-bitmap to a Format32bppPArgb bitmap?
Help is recommended, so much thanks in advance.
Michael