Visibility against an unknown background

Grant Edwards grante at visi.com
Tue Oct 24 13:46:42 EDT 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
> time,

Possibly -- depending on your defnition of "crap". ;)

> and doesn't work at all on medium gray or b/w dithered
> patterns.

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
well.

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
                                                   movies!!



More information about the Python-list mailing list