Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code to create a contrasting color
Message
From
26/10/2010 01:13:43
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01486509
Message ID:
01486950
Views:
38
Rather than XORing with 0xFFFFFF you could use 0x808080. This will always give you a contrasting colour. Of course, there is a difference between contrasting and "pleasing to the eye" or "readable", but since you are just after a border that will always be visible, this should be fine.

Ian Simcock.


>>>>I have an app where I am cropping images. Everything works great thanks to GdiPlusX. I create a shape object with MouseDown / MouseMove to mark the crop area. My question is how to get the contrasting color so the shape border will show against all the different colors in the image. I know I can get the color at the mouse down point but how do I get a light color if the image is dark, etc. I assume this is an easy one if you know what you are doing.
>>>
>>>What if you use XOR operation to draw the selection box border?
>>
>>
>>I looked at that but how would I use it. I have one value; the current color. What would be the 2nd value?
>
>Try
>
>lnNewColor = BITXOR(lnCurrentColor, 0xFFFFFFFF)
>
Previous
Reply
Map
View

Click here to load this message in the networking platform