GDI color vs GDI+ color

P

pixel

hi

GDI ExtFloodFill doesn't "see" GDI+ colors
..ToArgb() doesn't work at all

any suggestions

br
pixel

sample code
Graphics

gIm = Graphics.FromImage(im);

gIm.DrawEllipse(new Pen(Color.Red), 10, 10, 50, 50);

IntPtr

hIm = gIm.GetHdc(),

hBitmap = CreateCompatibleBitmap(hIm, 100, 100),

hDC = CreateCompatibleDC(hIm);

IntPtr

hOldBitmap = SelectObject(hDC, hBitmap);

BitBlt(hDC, 0, 0, 100, 100, hIm, 0, 0, SRCCOPY);

IntPtr

hOldBrush = SelectObject(hDC, GetStockObject(GRAY_BRUSH));

ExtFloodFill(hDC, e.X, e.Y, Color.Red.ToArgb(), FLOODFILLBORDER);

SelectObject(hDC, hOldBrush);

BitBlt(hIm, 0, 0, 100, 100, hDC, 0, 0, SRCCOPY);

SelectObject(hDC, hOldBitmap);

DeleteDC(hDC);

gIm.ReleaseHdc(hIm);
 
B

Bob Powell [MVP]

Use the ColorTranslator to create a GDI compatible COLORREF from the .NET
Color structure.

--
Bob Powell [MVP]
Visual C#, System.Drawing

The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
?

=?ISO-8859-2?Q?Marcin_Grz=EAbski?=

Hi,

If i worked with OLE_COLOR then it have required
inversion of GDI+ RGB.

You can do it easily by:

uint uColor=(uint)( (color.B<<16) | (color.G<<8) | color.R );

If this code doesn't solve your problem then only i can
blame the BITMAP pixel format (different than 32/24 bpp).

Regards

Marcin
 
P

pixel

thanx man
that's why i like groups :)
there is many ways to solve a problem

btw
dzieki marcin :))

pixel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top