[cairo] Fill not overlapping stroke?

Stuart Axon stuaxo2 at yahoo.com
Wed Jun 2 10:29:49 PDT 2010


Hi,
  I tried Bill and Davids suggestion, + changed my drawing method to the code below; but I seemed to lose all alpha information.
I'll try the intermediate surface next - I wonder if theres a performance hit though ?

     def draw(self):
            self.traverse_path()  ## e.g, rectangle etc

            cairo_ctx.push_group_with_content( cairo.CONTENT_COLOR_ALPHA )
           
            if fillcolor:
                cairo_ctx.set_source_rgba(*fillcolor)
                if strokecolor:
                    cairo_ctx.fill_preserve()
                else:
                    cairo_ctx.fill()

            cairo_ctx.set_operator(cairo.OPERATOR_SOURCE)

            if strokecolor:
                cairo_ctx.set_line_width(strokewidth)
                cairo_ctx.set_source_rgba(*strokecolor)
                cairo_ctx.stroke()

            cairo_ctx.pop_group_to_source()
            cairo_ctx.set_operator(cairo.OPERATOR_DEST_OVER)
            cairo_ctx.paint()

 S++



      


More information about the cairo mailing list