Rotate a PixelFormat1bppIndexed bitmap in GDI+?

Rotate a PixelFormat1bppIndexed bitmap in GDI+?

Post by izk » Tue, 27 Jul 2004 18:31:11


GDI+ crashes whenever I try to RotateFlip() a monochrome Bitmap with
pixelFormat = PixelFormat1bppIndexed. Has anyone succeeded in doing
this?
Is this a known GDI+ limitation/bug?
 
 
 

Rotate a PixelFormat1bppIndexed bitmap in GDI+?

Post by izk » Thu, 29 Jul 2004 17:21:33

I'm creating a Bitmap from a DIBSection. If the DIBSection is 1 bpp,
the resulting Bitmap crashes on RotateFlip.

8-bpp and 24-bpp Bitmaps work fine.

I tried Cloning the 1 bpp Bitmap and, lo and behold, it works. I can
rotate the cloned Bitmap which is also 1 bpp. However, if I delete the
original Bitmap, the cloned Bitmap is no longer useable (it crashes).

Can someone *please* explain...
1) why does the original Bitmap crash on rotate while the cloned
version does not.
2) how can I free the original Bitmap (the one created directly from
the DIBSection) without invalidating the cloned version.

I'm storing an array of Bitmaps in memory and therefore I'm interested
in reducing the memory requirements to minimum. I know that I can't
delete the dibsection handle until I'm done with the Bitmap - that's
ok but I don't want to keep 2 versions of the Bitmap for every image.