2007-01-14

GDI+ の謎

GDI+ については、2006-09-12に軽く触れたが、もう少し使う機会があったのでメモしておく。

Bitmapクラスで256色のPNGを読み込みSetpixelを実行するとInvalidParameterで失敗した。

散々悩んだ挙句、MSDNのGraphics::FromImageの説明内に以下の記述を発見した。

This method also fails if the image has one of the following pixel formats: 

PixelFormatUndefined
PixelFormatDontCare
PixelFormat1bppIndexed
PixelFormat4bppIndexed
PixelFormat8bppIndexed
PixelFormat16bppGrayScale
PixelFormat16bppARGB1555

Graphicsクラスの説明なのでBitmap::Setpixelは関係無いはずだが、24bitカラーのBitmapへのSetpixelを試行したところ成功した。正直なところ訳がわからない。


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours? Valid XHTML 1.0 Transitional