Visibility against an unknown background
grante at visi.com
Tue Oct 24 19:46:42 CEST 2006
On 2006-10-24, Fredrik Lundh <fredrik at pythonware.com> wrote:
> Sergei Organov wrote:
>> There is a better way to do it. Check if the toolkit has line
>> drawing mode that XORs the line color with the background,
>> then draw using this mode and white color of the line.
> which means that the selection looks like crap most of the
Possibly -- depending on your defnition of "crap". ;)
> and doesn't work at all on medium gray or b/w dithered
That depends on what you use as your source color. Mostly
people use use white like I mentioned. I wouldn't say it
doesn't work "at all", since I've always been able to see a
slightly different gray or stippled line, but there are
colors/patterns where an XOR'ed white line doesn't stand out
Xoring a color other than white will should show up better on
gray. There will still be colors/patterns that any color won't
show up on when Xor'ed, but by picking a color other than
white, you'll probably run across it less often.
> for most cases, "marching ants" is a much better approach
> (usually done by drawing alternating stippled patterns).
That's what the GIMP does, and it is highly visible on any
background. However, it's far more complex (it requires both
animation and some sort of backing store). It's especially
difficult to do with curved or diagonal lines.
Grant Edwards grante Yow! The PILLSBURY
at DOUGHBOY is CRYING for
visi.com an END to BURT REYNOLDS
More information about the Python-list