GDIPlusX: SetRemapTable comments

Developer
Nov 16, 2007 at 8:04 PM
Instead of doing this for each color I want replaced, is there an easy way to pass an array of color pairs?

! START - Convert white pixels to RGB(254,254,254) pixels
m.loColorMap.OldColor = .Color.White
m.loColorMap.NewColor = .Color.FromRGB(254,254,254)
! Apply remap table to Image Attributes
m.loAttributes.SetRemapTable(m.loColorMap)
m.loGraphics.DrawImage(m.loBitmap, m.loRect, m.loRect, .GraphicsUnit.Pixel, m.loAttributes)
! END - Convert white pixels to RGB(254,254,254) pixels

I would be great if I could just create a VFP array like:

Local array laColorPairs(10,2)
m.laColorPairs(1,1) = .Color.White
m.laColorPairs(1,2) = .Color.FromRGB(254,254,254)
.
.
.
and the pass that array to SetRemapTable:

m.loAttributes.SetRemapTable(m.laColorPairs)

I suspect that somehow I can create an array of ColorMaps, but dont see how, to .Netish to be easy to understand :-)

Carlos
Nov 19, 2007 at 11:23 AM
Hi Carlos,

This is totally possible. GdiPlus.dll fully supports that, although this possibility is not present in the .NET original classes. When I worked with GdiPlus.dll with direct API calls I used to pass multiple colors at one time exactly the way you propose.

I'll transform this to a WorkItem, and hope to add this functionality ASAP.

Thanks for the suggestion

Regards

Cesar
Nov 19, 2007 at 11:27 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Developer
Nov 19, 2007 at 2:58 PM
Thank you Cesar.