It seems like GDI+ TextureBrush Bug

217 views Asked by At

before mention, I Cant Speak Enginlish That very well

Recently I make Windows Desktop Application(On Windows7) using GDI+

I think Gdiplus::TextureBrush has a bug. I hope anyone found this bug like me.

that bug is like below

step1. there is a image that has 500dpi, 6250 * 7819 size

step2 Loading the image by using Gdiplus::Image::FromStream() the image name is "image1"

step3. Creating Graphics graphics(HDC);

step3. Creating Gdiplus::TextureBrush brush = Gdiplus::TextureBrush(image1);

step4 graphics.FillPath(brush); currently everything is ok, you can see the right image on screen

step5 creating another Graphics from a bitmap Graphics::Bitmap* bitmap = new Graphics::Bitmap(size.CX, size.CY), PixelFormat32bppARG); Graphics* anotherGraphics = Gdiplus::Graphics::FromImage(bitmap);

step6 (Here Bug Occur) anotherGraphics.DrawImage(image1); and then detach the new image from anotherGraphics. but new image is weird, new image like filled entirely by one pixel from the origin image

but next time, it never happens again.. only one time during the app life time

what is wrong....

1

There are 1 answers

0
SkyLuckyGuy On

Bitmap::FromStream method has second arg that is useEmbededColorManagement (not sure that is correct name anyway) I did put the True in it and then its working well. The arg looks like not related this bug.

I still don't know why its working but I solved this problem.