[cairo] Cropping Tool

Gerdus van Zyl gerdusvanzyl at gmail.com
Sun Jul 13 02:45:58 PDT 2008


Drawing the rectangle with dotted line is as simple as: (in
Python,C-calls are similar)
ctx.rectangle(0,0,self.width,self.height)
ctx.set_line_width(2)

setColour(ctx,"#000000")  <-- non cairo function set colour
ctx.stroke_preserve()

setColour(ctx,"#FFFFFF")  <-- non cairo function set colour
ctx.set_dash((8,4),dashoffset)

ctx.stroke()

Cairo can't "remove" anything it has drawn. So you would need to
seperately draw your image and then draw the selection on top, then if
there is no selection/canceled you only draw the image.

~Gerdus

On Fri, Jul 11, 2008 at 11:08 PM, Mr SZ <sk8in_zombi at yahoo.com.au> wrote:
> Hi
> I'm using a cairo widget in pygtk to create a simple image cropping
> application.Can anyone suggest me a way to draw thin dotted lines along the
> rectangle selected by the user(the to be cropped area).and then remove the
> rectangle when user cancels the operation.
>
> Thanks,
> SZ
>
> " life isn't heavy enough,it flies away and floats far above action"
> ________________________________
> Start at the new Yahoo!7 for a better online experience - Start Here.
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list