473,395 Members | 1,681 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

GDI color vs GDI+ color

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);
Nov 16 '05 #1
4 5262
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


"pixel" <pi****@poczta.onet.pl> wrote in message
news:ce**********@nettle.mcnet.pl...
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);

Nov 16 '05 #2
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
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);

Nov 16 '05 #3
thanx bob
simplest way is always the nearest

pixel
Nov 16 '05 #4
thanx man
that's why i like groups :)
there is many ways to solve a problem

btw
dzieki marcin :))

pixel
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Wiktor Zychla | last post by:
today we've found a critical issue regarding the ListView from Windows.Forms. it was confirmed on several machines with Win2K and XP. here's the problem: create a ListView with about 50000 rows....
1
by: Valerie Hough | last post by:
I have an object derived from Control and I place an icon in it during Paint handler. I now want to get the color of a particular pixel in my control. In C++ I could use CDC::GetPixel(x,y). Is...
0
by: Steve McLellan | last post by:
Hi, I need to convert a System.Drawing.Bitmap into a GDI bitmap, store the GDI bitmap, and then later display it using BitBlt. The storing part is giving me a little trouble. Given a paint...
0
by: Brian Keating | last post by:
hi there i've a test program that creates a treeview and destroys it over and over, i keep track of the gdi object count for the process and see if they are ok. However when i switch on...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
by: Lloyd Dupont | last post by:
In the same OnPaint() method I could mix GDI+ and GDI drawing. I have some hard to track nasty bug that appears sometimes (mainly when I print) and I wonder if any of the things I do are not...
14
by: James Wong | last post by:
Hi everybody, I'm facing a serious trouble relating to GDI+ generic error. The error message is "A Generic error occured in GDI+" and the following information is stored in Excepton object:...
2
by: rejidasan | last post by:
Hello All, I have a MFC Dialog based application. I am not using GDI or GDI+ libraries. I need to load PNG and JPEG images in this Dialog Based application. Can you suggest me how to to do...
5
by: Jonathan Boivin | last post by:
Hi, I've got some problems with loading bills using a bill usercontrol I built. If I load all current bills in my test environment (156) everything is fine once, but repeating the operation...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.