Visibility against an unknown background

Grant Edwards grante at visi.com
Tue Oct 24 11:27:23 EDT 2006


On 2006-10-24, Odalrick <odalrick at hotmail.com> wrote:

> 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,

Yup.

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

That's not how it's generally done.  When you draw a line, most
graphics toolkits allow you to specify an "operator" that is
applied to the existing pixel and the line-color to determine
the new pixel color.  The traditional way to draw lines on
something with varying colors is to use the "xor" operator when
drawing the lines.

-- 
Grant Edwards                   grante             Yow!  Can you MAIL a BEAN
                                  at               CAKE?
                               visi.com            



More information about the Python-list mailing list