[PyQt] Simple Draw/Erase on image
Aaron Digulla
digulla at hepe.com
Wed Apr 30 21:44:46 BST 2008
Jake Richards schrieb:
> Hello:
> I am looking to write just a simple drawing program that would load an
> image, and then allow me to draw and erase on top of it. I looked at the
> scribble example and it has basically everything I need except the ability
> to erase any marks I've made over the source image. What would be the best
> way to erase any drawn lines I've created over the image? I tried setting
> the image to ARGB and then switching the pen to (0,0,0,0) but that draws
> nothing (I was hoping it would draw 0,0,0,0 instead of adding color*alpha).
> Is there a way to use the source image as my pen color (basically painting
> with a texture)? Thanks for any help!
Two solutions:
1. Draw the line again with the background color (for example,
white+full opaque: 255,255,255,255)
2. Use a QGraphiceView and delete the line object from the scene when
you click on it with the "delete tool" (see
http://doc.trolltech.com/4.3/graphicsview.html)
Regards,
--
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://darkviews.blogspot.com/ http://www.pdark.de/
More information about the PyQt
mailing list