[compiz] [PATCH] Annotate shapes, text and dbus support

Mike Dransfield mike at blueroot.co.uk
Thu Nov 16 11:04:22 PST 2006


>
> I'm not sure what you mean by selection line but interactive drawing
> with these tools will require us to draw into an intermediate buffer
> that we blend on top of the previous content. We can add that later
> though.
>
>   
I think that is what I mean, something like the selection line
with screenshot.

>> I had a problem getting colors from dbus, it appears that they
>> are not supported yet.  I commented the code that should work
>> but doesn't.
>>     
>
> I fixed that.
>   
I cannot send colors over dbus still, I think it is because the dbus
plugin needs to be altered too, I will have a look at that and see if
I can fix it.  The problem I can see is that it will have to be sent as
a string, which means that plugin developers cannot use string
options which look like colors.  I doubt anyone would do this
though.

>
> I changes so all these tools are available only through the 'draw'
> option. We need do drawing to an intermediate buffer as I mentioned
> above before it makes sense to allow interactive use of these tools.
>
> I've pushed this out, but I haven't verified that it actually works. Let
> me know if I broke something while doing these changes.
>
>   

The line cap was not being set if the interactive drawing was
being used I am attaching a patch which makes it a parameter
of the draw line function so that in the future it can be controlled
as well.


-------------- next part --------------
--- ../../clean/plugins/annotate.c	2006-11-15 19:26:25.066461800 +0000
+++ annotate.c	2006-11-16 18:49:48.909001448 +0000
@@ -266,7 +266,8 @@
 	      double	     x2,
 	      double	     y2,
 	      double	     width,
-	      unsigned short *color)
+	      unsigned short *color,
+	      int 	     lineCap)
 {
     REGION reg;
     cairo_t *cr;
@@ -279,6 +280,7 @@
 	double ex1, ey1, ex2, ey2;
 
 	cairo_set_line_width (cr, width);
+	cairo_set_line_cap (cr, lineCap);
 	cairo_move_to (cr, x1, y1);
 	cairo_line_to (cr, x2, y2);
 	cairo_stroke_extents (cr, &ex1, &ey1, &ex2, &ey2);
@@ -376,7 +378,6 @@
 	    tool = getStringOptionNamed (option, nOption, "tool", "line");
 
 	    cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
-	    cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
 
 	    fillColor = ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.c;
 	    fillColor = getColorOptionNamed (option, nOption, "fill_color",
@@ -426,7 +427,8 @@
 		x2 = getFloatOptionNamed (option, nOption, "x2", 100);
 		y2 = getFloatOptionNamed (option, nOption, "y2", 100);
 
-		annoDrawLine (s, x1, y1, x2, y2, lineWidth, fillColor);
+		annoDrawLine (s, x1, y1, x2, y2, lineWidth, fillColor,
+			      CAIRO_LINE_CAP_ROUND);
 	    }
 	    else if (strcasecmp (tool, "text") == 0)
 	    {
@@ -687,7 +689,8 @@
 	    annoDrawLine (s,
 			  annoLastPointerX, annoLastPointerY,
 			  xRoot, yRoot,
-			  20.0, color);
+			  20.0, color,
+			  CAIRO_LINE_CAP_ROUND);
 	}
 	else
 	{
@@ -697,7 +700,8 @@
 			  annoLastPointerX, annoLastPointerY,
 			  xRoot, yRoot,
 			  ad->opt[ANNO_DISPLAY_OPTION_LINE_WIDTH].value.f,
-			  ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.c);
+			  ad->opt[ANNO_DISPLAY_OPTION_FILL_COLOR].value.c,
+			  CAIRO_LINE_CAP_ROUND);
 	}
 
 	annoLastPointerX = xRoot;


More information about the compiz mailing list