Visibility against an unknown background

Paul McGuire ptmcg at austin.rr._bogus_.com
Tue Oct 24 11:23:02 EDT 2006


"Odalrick" <odalrick at hotmail.com> wrote in message 
news:1161701658.722683.46230 at e3g2000cwe.googlegroups.com...
>I need to draw visible lines on pictures with wxPython. That means I
> can't simply use, for instance, a black line since it wont be visible
> on a black or dark picture.
>
> Painting applications like the GIMP accomplish this by altering the
> colour of the line based on the colour of the pixel it covers, but the
> only way I can think of doing that is getting each pixel, transforming
> the colour then painting it on the screen, which seems like a horribly
> inefficient way do it.
>
> I could use alternating colour on the lines, but I don't think that
> will be good enough for my taste.
>
> I think I will use a partially transparent bitmap with a hole in the
> appropriate place and move the hole as needed.
>
> I realized the last solution as I was writing this and I think it will
> work fairly well, but I'm still wondering if there is another, better
> solution i might have missed.
>
> /Odalrick
>
You could try outlining in a light color.  For example, draw a 3-pixel-wide 
white or light gray line, and then overlay your 1-pixel-wide black line. 
Over light backgrounds, the outline will disappear; over dark backgrounds, 
the outline will look like a hole in the background to show your black line.

-- Paul





More information about the Python-list mailing list