<tt>Hi, I'm trying to paint an image in gimp &quot;overlay&quot; mode.</tt><br>
<tt>I've found the algorithm for overlay:</tt><br>
<br>
<tt>* Perform an RGB[A] overlay operation between the pixel sources</tt><br>
<tt>* ctx-&gt;A and ctx-&gt;B, using the generalized algorithm:</tt><br>
<tt>* D =&nbsp; A * (B + (2 * B) * (255 - A))</tt><br>
<br>
<tt>But I don't know where to go from that. Is there some kind of filter</tt><br>
<tt>feature in cairo, that runs a function on all pixels?</tt><br>
<br>
<tt>I think I need to create an offscreen image, and update that one each</tt><br>
<tt>time the user changes the gtk theme (not very often)</tt><br>
<br>
<tt>Right now, I paint the image using this code:</tt><br>
<br>
<tt>cr = widget.window.cairo_create()</tt><br>
<tt>surface = cairo.ImageSurface.create_from_png(imgpath)</tt><br>
<tt>cr.rectangle (event.area.x, event.area.y, event.area.width,</tt><br>
<tt>event.area.height)</tt><br>
<tt>cr.set_source_surface(surface, 0, 0)</tt><br>
<tt>pattern = cr.get_source()</tt><br>
<tt>pattern.set_extend(cairo.EXTEND_REPEAT)</tt><br>
<tt>cr.fill()</tt><br>
<br>
<tt>Yes it is python code, but I guess the way it works is the same.</tt><br>
<br>
<tt>Can I somehow create an offscreen surface, that I can paint in the</tt><br>
<tt>backgroundcolor and append that overlay algorithm?</tt><br>
<br>
<tt>Also how do I get the pixeldata from the imagesurface?</tt><br>
<br>
<tt>-- </tt><br>
<tt>Best Regards, Thomas</tt><br>
<br>