Graphic: Format16bppGrayScale bitmap ?

  • Thread starter Thread starter Guest
  • Start date Start date
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::Drawing::Bitmap* pBmpSrc=NULL;
System::Drawing::Bitmap* pBmpDst=NULL;
System::Drawing::Graphics* pGr=NULL;
try
{
pBmpSrc=new
Bitmap(50,50,System::Drawing::Imaging::PixelFormat::Format16bppGrayScale);
pBmpDst=new
Bitmap(50,50,System::Drawing::Imaging::PixelFormat::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
 
Hi,

Currently I am researching the issue and we will reply here with more
information as soon as possible.
If you have any more concerns on it, please feel free to post here.

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi

I have discussed the issue with related support team engineer.
He said that GDI+ doesn't support the gray-scale pixel formats. Their
inclusion in the headers was a mistake.
You'll need to perform the conversion yourself, without using GDI+.

I am sorry for the convenience.
If you still have any concern, please feel free to post here.

BTW:
For GDI issue, you may try to post in the newsgroup below.
microsoft.public.win32.programmer.gdi

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top