next part in the plotter refactor, this removes the seperate rectangle
and fill calls (yay).  Again tested on gtk and framebuffer. Needs
compiling and testing on RISC OS, Amiga and Beos.
  
-- 
Regards Vincent
http://www.kyllikki.org/
Index: render/html_redraw.c
===================================================================
--- render/html_redraw.c	(revision 8373)
+++ render/html_redraw.c	(working copy)
@@ -153,7 +153,7 @@
 	if (c->data.html.background_colour != TRANSPARENT)
 		pstyle_fill_bg.fill_colour = c->data.html.background_colour;
 
-	result &= plot.fill(clip_x0, clip_y0, clip_x1, clip_y1, &pstyle_fill_bg);
+	result &= plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, &pstyle_fill_bg);
 
 	result &= html_redraw_box(box, x, y,
 			clip_x0, clip_y0, clip_x1, clip_y1,
@@ -315,23 +315,22 @@
 
 	/* dotted debug outlines */
 	if (html_redraw_debug) {
-		if (!plot.rectangle(x, y, padding_width, padding_height,
-				1, 0x0000ff, true, false))
+		if (!plot.rectangle(x, y, 
+				    x + padding_width, y + padding_height,
+				    plot_style_stroke_red))
 			return false;
-		if (!plot.rectangle(x + padding_left, y + padding_top,
-				width, height, 1, 0xff0000, true, false))
+		if (!plot.rectangle(x + padding_left, 
+				    y + padding_top,
+				    x + padding_left + width, 
+				    y + padding_top + height, 
+				    plot_style_stroke_blue))
 			return false;
-		if (!plot.rectangle(x - (box->border[LEFT] +
-				box->margin[LEFT]) * scale,
-				y - (box->border[TOP] +
-				box->margin[TOP]) * scale,
-				padding_width + (box->border[LEFT] +
-				box->margin[LEFT] + box->border[RIGHT] +
-				box->margin[RIGHT]) * scale,
-				padding_height + (box->border[TOP] +
-				box->margin[TOP] + box->border[BOTTOM] +
-				box->margin[BOTTOM]) * scale,
-				1, 0x00ffff, true, false))
+		if (!plot.rectangle(
+			    x - (box->border[LEFT] + box->margin[LEFT]) * scale,
+			    y - (box->border[TOP] + box->margin[TOP]) * scale,
+			    (x - (box->border[LEFT] + box->margin[LEFT]) * scale) + (padding_width + (box->border[LEFT] + box->margin[LEFT] + box->border[RIGHT] + box->margin[RIGHT]) * scale),
+			    (y - (box->border[TOP] + box->margin[TOP]) * scale) + (padding_height + (box->border[TOP] + box->margin[TOP] + box->border[BOTTOM] + box->margin[BOTTOM]) * scale),
+			    plot_style_stroke_yellow))
 			return false;
 	}
 
@@ -858,7 +857,7 @@
 				pstyle_fill_hback = plot_style_fill_black;
 
 			/* highlighted portion */
-			if (!plot.fill(x + startx, y, x + endx,
+			if (!plot.rectangle(x + startx, y, x + endx,
 					y + height * scale,
 					pstyle_fill_hback))
 				return false;
@@ -1319,7 +1318,7 @@
 	if (z == 0)
 		z = 1;
 
-	if (!(plot.fill(x, y, x + width, y + height, &pstyle_fill_wbasec) &&
+	if (!(plot.rectangle(x, y, x + width, y + height, &pstyle_fill_wbasec) &&
 		plot.line(x, y, x + width, y, 1, dark, false, false) &&
 		plot.line(x, y, x, y + height, 1, dark, false, false) &&
 		plot.line(x + width, y, x + width, y + height, 1, lite,
@@ -1331,7 +1330,7 @@
 	if (selected) {
 		if (width < 12 || height < 12) {
 			/* render a solid box instead of a tick */
-			if (!plot.fill(x + z + z, y + z + z,
+			if (!plot.rectangle(x + z + z, y + z + z,
 				x + width - z, y + height - z,
 				&pstyle_fill_wblobc))
 				return false;
@@ -1605,7 +1604,7 @@
 			pstyle_fill_bg.fill_colour =
 					background->style->background_color;
 			if (plot_colour)
-				if (!plot.fill(clip_x0, clip_y0,
+				if (!plot.rectangle(clip_x0, clip_y0,
 						clip_x1, clip_y1,
 						&pstyle_fill_bg))
 					return false;
@@ -1774,7 +1773,7 @@
 				box->style->background_color;
 
 		if (plot_colour)
-			if (!plot.fill(clip_x0, clip_y0,
+			if (!plot.rectangle(clip_x0, clip_y0,
 					clip_x1, clip_y1,
 					&pstyle_fill_bg))
 				return false;
@@ -2012,7 +2011,7 @@
 				y + padding_height - 2,
 				css_scrollbar_fg_colour, false);
 		/* left arrow icon background */
-		if (!plot.fill(x + 2,
+		if (!plot.rectangle(x + 2,
 				y + padding_height - w + 2,
 				x + w - 2,
 				y + padding_height - 2,
@@ -2028,7 +2027,7 @@
 		if (!plot.polygon(v, 3, css_scrollbar_arrow_colour))
 			return false;
 		/* scroll well background */
-		if (!plot.fill(x + w - 1,
+		if (!plot.rectangle(x + w - 1,
 				y + padding_height - w + 1,
 				x + w + well_width + (vscroll ? 2 : 1),
 				y + padding_height - 1,
@@ -2040,7 +2039,7 @@
 				x + w + bar_left + bar_width + (vscroll? 1 : 0),
 				y + padding_height - 2,
 				css_scrollbar_fg_colour, false);
-		if (!plot.fill(x + w + bar_left + 1,
+		if (!plot.rectangle(x + w + bar_left + 1,
 				y + padding_height - w + 2,
 				x + w + bar_left + bar_width + (vscroll? 1 : 0),
 				y + padding_height - 2,
@@ -2053,7 +2052,7 @@
 				y + padding_height - 2,
 				css_scrollbar_fg_colour, false);
 		/* right arrow icon background */
-		if (!plot.fill(x + w + well_width + 3,
+		if (!plot.rectangle(x + w + well_width + 3,
 				y + padding_height - w + 2,
 				x + w + well_width + w - (vscroll ? 1 : 2),
 				y + padding_height - 2,
@@ -2084,7 +2083,7 @@
 				x + padding_width - 2,
 				y + w - 2,
 				css_scrollbar_fg_colour, false);
-		if (!plot.fill(x + padding_width - w + 2,
+		if (!plot.rectangle(x + padding_width - w + 2,
 				y + 2,
 				x + padding_width - 2,
 				y + w - 2,
@@ -2100,7 +2099,7 @@
 		if (!plot.polygon(v, 3, css_scrollbar_arrow_colour))
 			return false;
 		/* scroll well background */
-		if (!plot.fill(x + padding_width - w + 1,
+		if (!plot.rectangle(x + padding_width - w + 1,
 				y + w - 1,
 				x + padding_width - 1,
 				y + padding_height - w + 1,
@@ -2112,7 +2111,7 @@
 				x + padding_width - 2,
 				y + w + bar_top + bar_height,
 				css_scrollbar_fg_colour, false);
-		if (!plot.fill(x + padding_width - w + 2,
+		if (!plot.rectangle(x + padding_width - w + 2,
 				y + w + bar_top + 1,
 				x + padding_width - 2,
 				y + w + bar_top + bar_height,
@@ -2124,7 +2123,7 @@
 				x + padding_width - 2,
 				y + padding_height - 2,
 				css_scrollbar_fg_colour, false);
-		if (!plot.fill(x + padding_width - w + 2,
+		if (!plot.rectangle(x + padding_width - w + 2,
 				y + padding_height - w + 2,
 				x + padding_width - 2,
 				y + padding_height - 2,
Index: render/textplain.c
===================================================================
--- render/textplain.c	(revision 8373)
+++ render/textplain.c	(working copy)
@@ -358,7 +358,7 @@
 	if (line1 < line0)
 		line1 = line0;
 
-	if (!plot.fill(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white))
+	if (!plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white))
 		return false;
 
 	if (!line)
@@ -437,9 +437,9 @@
 
 				if (highlighted) {
 					int sy = y + (lineno * scaled_line_height);
-					if (!plot.fill(tx, sy,
-							ntx, sy + scaled_line_height,
-							plot_style_highlight))
+					if (!plot.rectangle(tx, sy, 
+							    ntx, sy + scaled_line_height,
+							    plot_style_highlight))
 						return false;
 				}
 			}
Index: framebuffer/framebuffer.c
===================================================================
--- framebuffer/framebuffer.c	(revision 8373)
+++ framebuffer/framebuffer.c	(working copy)
@@ -198,16 +198,32 @@
 }
 
 static bool 
-framebuffer_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
+framebuffer_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
 {
-    nsfb_bbox_t rect;
-    rect.x0 = x0;
-    rect.y0 = y0;
-    rect.x1 = x1;
-    rect.y1 = y1;
+	nsfb_bbox_t rect;
+	bool dotted = false; 
+	bool dashed = false;
 
-    return nsfb_plot_rectangle_fill(nsfb, &rect, style->fill_colour);
+	rect.x0 = x0;
+	rect.y0 = y0;
+	rect.x1 = x1;
+	rect.y1 = y1;
 
+	if (style->fill_type != PLOT_OP_TYPE_NONE) {  
+		nsfb_plot_rectangle_fill(nsfb, &rect, style->fill_colour);
+	}
+    
+	if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+		if (style->stroke_type == PLOT_OP_TYPE_DOT) 
+			dotted = true;
+
+		if (style->stroke_type == PLOT_OP_TYPE_DASH) 
+			dashed = true;
+
+		nsfb_plot_rectangle(nsfb, &rect, style->stroke_width, style->stroke_colour, dotted, dashed); 
+	}
+
+	return true;
 }
 
 static bool framebuffer_plot_flush(void)
@@ -229,10 +245,9 @@
 }
 
 struct plotter_table plot = {
-	.rectangle = nsfb_lplot_rectangle,
+	.rectangle = framebuffer_plot_rectangle,
 	.line = nsfb_lplot_line,
 	.polygon = nsfb_lplot_polygon,
-	.fill = framebuffer_plot_fill,
 	.clip = nsfb_lplot_clip,
 	.text = framebuffer_plot_text,
 	.disc = nsfb_lplot_disc,
Index: gtk/gtk_print.c
===================================================================
--- gtk/gtk_print.c	(revision 8373)
+++ gtk/gtk_print.c	(working copy)
@@ -45,14 +45,12 @@
 #include "utils/log.h"
 #include "utils/utils.h"
 
-static bool nsgtk_print_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed);
+static bool nsgtk_print_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
 static bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed);
 static bool nsgtk_print_plot_polygon(const int *p, unsigned int n, colour fill);
 static bool nsgtk_print_plot_path(const float *p, unsigned int n, colour fill, 
 		float width, colour c, const float transform[6]);
-static bool nsgtk_print_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
 static bool nsgtk_print_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1);
 static bool nsgtk_print_plot_text(int x, int y, const struct css_style *style,
@@ -91,7 +89,6 @@
 	.rectangle = nsgtk_print_plot_rectangle,
 	.line = nsgtk_print_plot_line,
 	.polygon = nsgtk_print_plot_polygon,
-	.fill = nsgtk_print_plot_fill,
 	.clip = nsgtk_print_plot_clip,
 	.text = nsgtk_print_plot_text,
 	.disc = nsgtk_print_plot_disc,
@@ -108,31 +105,61 @@
 	gtk_print_end
 };
 
-bool nsgtk_print_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed)
+bool nsgtk_print_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
 {
-	LOG(("Plotting rectangle. width: %i ; height: %i", width, height));
+	LOG(("x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", x0,y0,x1,y1));
 
-	nsgtk_print_set_colour(c);
+        if (style->fill_type != PLOT_OP_TYPE_NONE) { 
 
-	if (dotted)
-		nsgtk_print_set_dotted();
-	else if (dashed)
-		nsgtk_print_set_dashed();
-	else
+		nsgtk_print_set_colour(style->fill_colour);
 		nsgtk_print_set_solid();
+	
+		/* Normalize boundaries of the area - to prevent overflows.
+		 * See comment in pdf_plot_fill. */
+		x0 = min(max(x0, 0), settings->page_width);
+		y0 = min(max(y0, 0), settings->page_height);
+		x1 = min(max(x1, 0), settings->page_width);
+		y1 = min(max(y1, 0), settings->page_height);
 
-	if (line_width == 0)
-		line_width = 1;
+		cairo_set_line_width(gtk_print_current_cr, 0);
+		cairo_rectangle(gtk_print_current_cr, x0, y0, x1 - x0, y1 - y0);
+		cairo_fill(gtk_print_current_cr);
+		cairo_stroke(gtk_print_current_cr);
+	}
 
-	cairo_set_line_width(gtk_print_current_cr, line_width);
-	cairo_rectangle(gtk_print_current_cr, x0, y0, width, height);
-	cairo_stroke(gtk_print_current_cr);
+        if (style->stroke_type != PLOT_OP_TYPE_NONE) { 
+                nsgtk_print_set_colour(style->stroke_colour);
 
+                switch (style->stroke_type) {
+                case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+                default:
+                        nsgtk_print_set_solid();
+                        break;
+
+                case PLOT_OP_TYPE_DOT: /**< Doted plot */
+                        nsgtk_print_set_dotted();
+                        break;
+
+                case PLOT_OP_TYPE_DASH: /**< dashed plot */
+                        nsgtk_print_set_dashed();
+                        break;
+                }
+
+                if (style->stroke_width == 0) 
+                        cairo_set_line_width(gtk_print_current_cr, 1);
+                else
+                        cairo_set_line_width(gtk_print_current_cr, style->stroke_width);
+
+		cairo_rectangle(gtk_print_current_cr, x0, y0, x1 - x0, y1 - y0);
+		cairo_stroke(gtk_print_current_cr);
+	}
+	
 	return true;
 }
 
 
+
+
 bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed)
 {
@@ -183,30 +210,8 @@
 }
 
 
-bool nsgtk_print_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
-	LOG(("Plotting fill. x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", 
-			x0,y0,x1,y1));
 
-	nsgtk_print_set_colour(style->fill_colour);
-	nsgtk_print_set_solid();
-	
-	/* Normalize boundaries of the area - to prevent overflows.
-	 * See comment in pdf_plot_fill. */
-	x0 = min(max(x0, 0), settings->page_width);
-	y0 = min(max(y0, 0), settings->page_height);
-	x1 = min(max(x1, 0), settings->page_width);
-	y1 = min(max(y1, 0), settings->page_height);
 
-	cairo_set_line_width(gtk_print_current_cr, 0);
-	cairo_rectangle(gtk_print_current_cr, x0, y0, x1 - x0, y1 - y0);
-	cairo_fill(gtk_print_current_cr);
-	cairo_stroke(gtk_print_current_cr);
-	
-	return true;
-}
-
-
 bool nsgtk_print_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1)
 {
Index: gtk/gtk_plotters.c
===================================================================
--- gtk/gtk_plotters.c	(revision 8373)
+++ gtk/gtk_plotters.c	(working copy)
@@ -49,14 +49,12 @@
 GdkGC *current_gc;
 cairo_t *current_cr;
 
-static bool nsgtk_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed);
 static bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed);
 static bool nsgtk_plot_polygon(const int *p, unsigned int n, colour fill);
 static bool nsgtk_plot_path(const float *p, unsigned int n, colour fill, float width,
                     colour c, const float transform[6]);
-static bool nsgtk_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
+static bool nsgtk_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
 static bool nsgtk_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1);
 static bool nsgtk_plot_text(int x, int y, const struct css_style *style,
@@ -80,7 +78,6 @@
 	.rectangle = nsgtk_plot_rectangle,
 	.line = nsgtk_plot_line,
 	.polygon = nsgtk_plot_polygon,
-	.fill = nsgtk_plot_fill,
 	.clip = nsgtk_plot_clip,
 	.text = nsgtk_plot_text,
 	.disc = nsgtk_plot_disc,
@@ -91,28 +88,47 @@
 };
 
 
-bool nsgtk_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed)
+bool nsgtk_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
 {
-	nsgtk_set_colour(c);
-        if (dotted)
-                nsgtk_set_dotted();
-        else if (dashed)
-                nsgtk_set_dashed();
-        else
+        if (style->fill_type != PLOT_OP_TYPE_NONE) { 
+                nsgtk_set_colour(style->fill_colour);
                 nsgtk_set_solid();
 
-	if (line_width == 0)
-		line_width = 1;
+                cairo_set_line_width(current_cr, 0);
+                cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0);
+                cairo_fill(current_cr);
+                cairo_stroke(current_cr);
+        }
 
-	cairo_set_line_width(current_cr, line_width);
-	cairo_rectangle(current_cr, x0 + 0.5, y0 + 0.5, width, height);
-	cairo_stroke(current_cr);
+        if (style->stroke_type != PLOT_OP_TYPE_NONE) { 
+                nsgtk_set_colour(style->stroke_colour);
 
+                switch (style->stroke_type) {
+                case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+                default:
+                        nsgtk_set_solid();
+                        break;
+
+                case PLOT_OP_TYPE_DOT: /**< Doted plot */
+                        nsgtk_set_dotted();
+                        break;
+
+                case PLOT_OP_TYPE_DASH: /**< dashed plot */
+                        nsgtk_set_dashed();
+                        break;
+                }
+
+                if (style->stroke_width == 0) 
+                        cairo_set_line_width(current_cr, 1);
+                else
+                        cairo_set_line_width(current_cr, style->stroke_width);
+
+                cairo_rectangle(current_cr, x0 + 0.5, y0 + 0.5, x1 - x0, y1 - y0);
+                cairo_stroke(current_cr);
+        }
 	return true;
 }
 
-
 bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed)
 {
@@ -155,20 +171,6 @@
 }
 
 
-bool nsgtk_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
-	nsgtk_set_colour(style->fill_colour);
-	nsgtk_set_solid();
-
-	cairo_set_line_width(current_cr, 0);
-	cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0);
-	cairo_fill(current_cr);
-	cairo_stroke(current_cr);
-
-	return true;
-}
-
-
 bool nsgtk_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1)
 {
Index: gtk/gtk_thumbnail.c
===================================================================
--- gtk/gtk_thumbnail.c	(revision 8373)
+++ gtk/gtk_thumbnail.c	(working copy)
@@ -95,7 +95,7 @@
 #ifdef CAIRO_VERSION
 	current_cr = gdk_cairo_create(current_drawable);
 #endif
-	plot.fill(0, 0, cwidth, cwidth, plot_style_fill_white);
+	plot.rectangle(0, 0, cwidth, cwidth, plot_style_fill_white);
 
 	/* render the content */
 	content_redraw(content, 0, 0, content->width, content->width,
Index: beos/beos_plotters.cpp
===================================================================
--- beos/beos_plotters.cpp	(revision 8373)
+++ beos/beos_plotters.cpp	(working copy)
@@ -61,14 +61,12 @@
  * the right-bottom pixel is actually part of the BRect!
  */
 
-static bool nsbeos_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed);
+static bool nsbeos_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
 static bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed);
 static bool nsbeos_plot_polygon(const int *p, unsigned int n, colour fill);
 static bool nsbeos_plot_path(const float *p, unsigned int n, colour fill, float width,
                     colour c, const float transform[6]);
-static bool nsbeos_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
 static bool nsbeos_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1);
 static bool nsbeos_plot_text(int x, int y, const struct css_style *style,
@@ -97,7 +95,6 @@
 	nsbeos_plot_rectangle,
 	nsbeos_plot_line,
 	nsbeos_plot_polygon,
-	nsbeos_plot_fill,
 	nsbeos_plot_clip,
 	nsbeos_plot_text,
 	nsbeos_plot_disc,
@@ -139,53 +136,99 @@
 	current_view = view;
 }
 
-bool nsbeos_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed)
+bool nsbeos_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
 {
-	pattern pat = B_SOLID_HIGH;
-	BView *view;
+	if (style->fill_type != PLOT_OP_TYPE_NONE) { 
+		BView *view;
 
-	if (dotted)
-		pat = kDottedPattern;
-	else if (dashed)
-		pat = kDashedPattern;
+		view = nsbeos_current_gc/*_lock*/();
+		if (view == NULL) {
+			warn_user("No GC", 0);
+			return false;
+		}
 
-	view = nsbeos_current_gc/*_lock*/();
-	if (view == NULL) {
-		warn_user("No GC", 0);
-		return false;
+		nsbeos_set_colour(style->fill_colour);
+
+		BRect rect(x0, y0, x1 - 1, y1 - 1);
+		view->FillRect(rect);
+
+		//nsbeos_current_gc_unlock();
+
+#if 0 /* GTK */
+		nsbeos_set_colour(style->fill_colour);
+		nsbeos_set_solid();
+#ifdef CAIRO_VERSION
+		if (option_render_cairo) {
+			cairo_set_line_width(current_cr, 0);
+			cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0);
+			cairo_fill(current_cr);
+			cairo_stroke(current_cr);
+		} else
+#endif
+			gdk_draw_rectangle(current_drawable, current_gc,
+					   TRUE, x0, y0, x1 - x0, y1 - y0);
+#endif
 	}
 
-	nsbeos_set_colour(c);
+        if (style->stroke_type != PLOT_OP_TYPE_NONE) { 
+		pattern pat; 
+		BView *view;
 
-	float pensize = view->PenSize();
-	view->SetPenSize(line_width);
+                switch (style->stroke_type) {
+                case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+                default:
+                        pat = B_SOLID_HIGH;
+                        break;
 
-	BRect rect(x0, y0, x0 + width - 1, y0 + height - 1);
-	view->StrokeRect(rect, pat);
+                case PLOT_OP_TYPE_DOT: /**< Doted plot */
+			pat = kDottedPattern;
+                        break;
 
-	view->SetPenSize(pensize);
+                case PLOT_OP_TYPE_DASH: /**< dashed plot */
+			pat = kDashedPattern;
+                        break;
+                }
 
-	//nsbeos_current_gc_unlock();
+		view = nsbeos_current_gc/*_lock*/();
+		if (view == NULL) {
+			warn_user("No GC", 0);
+			return false;
+		}
 
+		nsbeos_set_colour(style->stroke_colour);
+
+		float pensize = view->PenSize();
+		view->SetPenSize(style->stroke_width);
+
+		BRect rect(x0, y0, x1, y1);
+		view->StrokeRect(rect, pat);
+
+		view->SetPenSize(pensize);
+
+		//nsbeos_current_gc_unlock();
+
 #if 0 /* GTK */
 #ifdef CAIRO_VERSION
-	if (option_render_cairo) {
-		if (line_width == 0)
-			line_width = 1;
+		if (option_render_cairo) {
+			if (line_width == 0)
+				line_width = 1;
 
-		cairo_set_line_width(current_cr, line_width);
-		cairo_rectangle(current_cr, x0, y0, width, height);
-		cairo_stroke(current_cr);
-	} else
+			cairo_set_line_width(current_cr, line_width);
+			cairo_rectangle(current_cr, x0, y0, width, height);
+			cairo_stroke(current_cr);
+		} else
 #endif
-	gdk_draw_rectangle(current_drawable, current_gc,
-			FALSE, x0, y0, width, height);
+			gdk_draw_rectangle(current_drawable, current_gc,
+					   FALSE, x0, y0, width, height);
+		return true;
+#endif
+	}
+
 	return true;
-#endif
 }
 
 
+
 bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed)
 {
@@ -301,41 +344,8 @@
 }
 
 
-bool nsbeos_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
-	BView *view;
 
-	view = nsbeos_current_gc/*_lock*/();
-	if (view == NULL) {
-		warn_user("No GC", 0);
-		return false;
-	}
 
-	nsbeos_set_colour(style->fill_colour);
-
-	BRect rect(x0, y0, x1 - 1, y1 - 1);
-	view->FillRect(rect);
-
-	//nsbeos_current_gc_unlock();
-
-#if 0 /* GTK */
-	nsbeos_set_colour(style->fill_colour);
-	nsbeos_set_solid();
-#ifdef CAIRO_VERSION
-	if (option_render_cairo) {
-		cairo_set_line_width(current_cr, 0);
-		cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0);
-		cairo_fill(current_cr);
-		cairo_stroke(current_cr);
-	} else
-#endif
-	gdk_draw_rectangle(current_drawable, current_gc,
-			TRUE, x0, y0, x1 - x0, y1 - y0);
-#endif
-	return true;
-}
-
-
 bool nsbeos_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1)
 {
Index: riscos/plotters.c
===================================================================
--- riscos/plotters.c	(revision 8373)
+++ riscos/plotters.c	(working copy)
@@ -34,8 +34,7 @@
 #include "utils/log.h"
 
 
-static bool ro_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed);
+static bool ro_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
 static bool ro_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed);
 static bool ro_plot_draw_path(const draw_path * const path, int width,
@@ -43,7 +42,6 @@
 static bool ro_plot_polygon(const int *p, unsigned int n, colour fill);
 static bool ro_plot_path(const float *p, unsigned int n, colour fill, float width,
 		colour c, const float transform[6]);
-static bool ro_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
 static bool ro_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1);
 static bool ro_plot_text(int x, int y, const struct css_style *style,
@@ -62,7 +60,6 @@
 	.rectangle = ro_plot_rectangle,
 	.line = ro_plot_line,
 	.polygon = ro_plot_polygon,
-	.fill = ro_plot_fill,
 	.clip = ro_plot_clip,
 	.text = ro_plot_text,
 	.disc = ro_plot_disc,
@@ -81,29 +78,72 @@
 
 
 
-
-bool ro_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed)
+bool ro_plot_rectangle(int x0, int y0, int x1, int y1, plot_style_t *style)
 {
-	const int path[] = { draw_MOVE_TO,
-			(ro_plot_origin_x + x0 * 2) * 256,
-			(ro_plot_origin_y - y0 * 2 - 1) * 256,
-			draw_LINE_TO,
-			(ro_plot_origin_x + (x0 + width) * 2) * 256,
-			(ro_plot_origin_y - y0 * 2 - 1) * 256,
-			draw_LINE_TO,
-			(ro_plot_origin_x + (x0 + width) * 2) * 256,
-			(ro_plot_origin_y - (y0 + height) * 2 - 1) * 256,
-			draw_LINE_TO,
-			(ro_plot_origin_x + x0 * 2) * 256,
-			(ro_plot_origin_y - (y0 + height) * 2 - 1) * 256,
-			draw_CLOSE_LINE,
-			(ro_plot_origin_x + x0 * 2) * 256,
-			(ro_plot_origin_y - y0 * 2 - 1) * 256,
-			draw_END_PATH };
+	os_error *error;
 
-	return ro_plot_draw_path((const draw_path *) path, line_width, c,
-			dotted, dashed);
+        if (style->fill_type != PLOT_OP_TYPE_NONE) { 
+
+		error = xcolourtrans_set_gcol(style->fill_colour << 8, 
+					      colourtrans_USE_ECFS_GCOL,
+					      os_ACTION_OVERWRITE, 0, 0);
+		if (error) {
+			LOG(("xcolourtrans_set_gcol: 0x%x: %s",
+			     error->errnum, error->errmess));
+			return false;
+		}
+
+		error = xos_plot(os_MOVE_TO,
+				 ro_plot_origin_x + x0 * 2,
+				 ro_plot_origin_y - y0 * 2 - 1);
+		if (error) {
+			LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
+			return false;
+		}
+
+		error = xos_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
+				 ro_plot_origin_x + x1 * 2 - 1,
+				 ro_plot_origin_y - y1 * 2);
+		if (error) {
+			LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
+			return false;
+		}
+	}
+
+        if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+		bool dotted = false; 
+		bool dashed = false;
+ 
+		const int path[] = { draw_MOVE_TO,
+				     (ro_plot_origin_x + x0 * 2) * 256,
+				     (ro_plot_origin_y - y0 * 2 - 1) * 256,
+				     draw_LINE_TO,
+				     (ro_plot_origin_x + (x1) * 2) * 256,
+				     (ro_plot_origin_y - y0 * 2 - 1) * 256,
+				     draw_LINE_TO,
+				     (ro_plot_origin_x + (x1) * 2) * 256,
+				     (ro_plot_origin_y - (y1) * 2 - 1) * 256,
+				     draw_LINE_TO,
+				     (ro_plot_origin_x + x0 * 2) * 256,
+				     (ro_plot_origin_y - (y1) * 2 - 1) * 256,
+				     draw_CLOSE_LINE,
+				     (ro_plot_origin_x + x0 * 2) * 256,
+				     (ro_plot_origin_y - y0 * 2 - 1) * 256,
+				     draw_END_PATH };
+
+		if (style->stroke_type == PLOT_OP_TYPE_DOT) 
+			dotted = true;
+
+		if (style->stroke_type == PLOT_OP_TYPE_DASH) 
+			dashed = true;
+
+		ro_plot_draw_path((const draw_path *)path, 
+				  style->stroke_width, 
+				  style->stroke_colour,
+				  dotted, dashed);
+	}
+
+	return true;
 }
 
 
@@ -303,39 +343,8 @@
 }
 
 
-bool ro_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
-	os_error *error;
 
-	error = xcolourtrans_set_gcol(style->fill_colour << 8, 
-                                      colourtrans_USE_ECFS_GCOL,
-                                      os_ACTION_OVERWRITE, 0, 0);
-	if (error) {
-		LOG(("xcolourtrans_set_gcol: 0x%x: %s",
-				error->errnum, error->errmess));
-		return false;
-	}
 
-	error = xos_plot(os_MOVE_TO,
-			ro_plot_origin_x + x0 * 2,
-			ro_plot_origin_y - y0 * 2 - 1);
-	if (error) {
-		LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
-		return false;
-	}
-
-	error = xos_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
-			ro_plot_origin_x + x1 * 2 - 1,
-			ro_plot_origin_y - y1 * 2);
-	if (error) {
-		LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
-		return false;
-	}
-
-	return true;
-}
-
-
 bool ro_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1)
 {
Index: riscos/print.c
===================================================================
--- riscos/print.c	(revision 8373)
+++ riscos/print.c	(working copy)
@@ -97,12 +97,10 @@
 static bool print_send_printtypeknown(wimp_message *m);
 static bool print_document(struct gui_window *g, const char *filename);
 static const char *print_declare_fonts(struct content *content);
-static bool print_fonts_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed);
+static bool print_fonts_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
 static bool print_fonts_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed);
 static bool print_fonts_plot_polygon(const int *p, unsigned int n, colour fill);
-static bool print_fonts_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
 static bool print_fonts_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1);
 static bool print_fonts_plot_text(int x, int y, const struct css_style *style,
@@ -128,7 +126,6 @@
 	.rectangle = print_fonts_plot_rectangle,
 	.line = print_fonts_plot_line,
 	.polygon = print_fonts_plot_polygon,
-	.fill = print_fonts_plot_fill,
 	.clip = print_fonts_plot_clip,
 	.text = print_fonts_plot_text,
 	.disc = print_fonts_plot_disc,
@@ -807,12 +804,12 @@
 }
 
 
-bool print_fonts_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed)
+bool print_fonts_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
 {
 	return true;
 }
 
+
 bool print_fonts_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed)
 {
@@ -824,10 +821,6 @@
 	return true;
 }
 
-bool print_fonts_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
-	return true;
-}
 
 bool print_fonts_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1)
Index: desktop/save_pdf/pdf_plotters.c
===================================================================
--- desktop/save_pdf/pdf_plotters.c	(revision 8373)
+++ desktop/save_pdf/pdf_plotters.c	(working copy)
@@ -45,12 +45,10 @@
 /* #define PDF_DEBUG */
 /* #define PDF_DEBUG_DUMPGRID */
 
-static bool pdf_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed);
+static bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
 static bool pdf_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed);
 static bool pdf_plot_polygon(const int *p, unsigned int n, colour fill);
-static bool pdf_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
 static bool pdf_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1);
 static bool pdf_plot_text(int x, int y, const struct css_style *style,
@@ -126,7 +124,6 @@
 	.rectangle = pdf_plot_rectangle,
 	.line = pdf_plot_line,
 	.polygon = pdf_plot_polygon,
-	.fill = pdf_plot_fill,
 	.clip = pdf_plot_clip,
 	.text = pdf_plot_text,
 	.disc = pdf_plot_disc,
@@ -146,20 +143,60 @@
 static char *owner_pass;
 static char *user_pass;
 
-bool pdf_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed)
+bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *pstyle)
 {
+	DashPattern_e dash;
 #ifdef PDF_DEBUG
-	LOG(("."));
+	LOG(("%d %d %d %d %f %X", x0, y0, x1, y1, page_height - y0, style->fill_colour));
 #endif
 
-	apply_clip_and_mode(false, TRANSPARENT, c, line_width,
-			(dotted) ? DashPattern_eDotted :
-			((dashed) ? DashPattern_eDash : DashPattern_eNone));
+	if (pstyle->fill_type != PLOT_OP_TYPE_NONE) {
 
-	HPDF_Page_Rectangle(pdf_page, x0, page_height - y0, width, -height);
-	HPDF_Page_Stroke(pdf_page);
+		apply_clip_and_mode(false, pstyle->fill_colour, TRANSPARENT, 0., DashPattern_eNone);
 
+		/* Normalize boundaries of the area - to prevent
+		   overflows.  It is needed only in a few functions,
+		   where integers are subtracted.  When the whole
+		   browser window is meant min and max int values are
+		   used what must be handled in paged output.
+		*/
+		x0 = min(max(x0, 0), page_width);
+		y0 = min(max(y0, 0), page_height);
+		x1 = min(max(x1, 0), page_width);
+		y1 = min(max(y1, 0), page_height);
+
+		HPDF_Page_Rectangle(pdf_page, x0, page_height - y1, x1 - x0, y1 - y0);
+		HPDF_Page_Fill(pdf_page);
+
+	}
+
+	if (pstyle->stroke_type != PLOT_OP_TYPE_NONE) {
+
+		switch (pstyle->stroke_type) {
+		case PLOT_OP_TYPE_DOT:
+			dash = DashPattern_eDotted;
+			break;
+
+		case PLOT_OP_TYPE_DASH:
+			dash = DashPattern_eDash;
+			break;
+
+		default:
+			dash = DashPattern_eNone;
+			break;
+
+		}
+
+		apply_clip_and_mode(false, 
+				    TRANSPARENT, 
+				    pstyle->stroke_colour, 
+				    pstyle->stroke_width,
+				    dash);
+
+		HPDF_Page_Rectangle(pdf_page, x0, page_height - y0, x1 - x0, -(y1 - y0));
+		HPDF_Page_Stroke(pdf_page);
+	}
+
 	return true;
 }
 
@@ -214,30 +251,7 @@
 	return true;
 }
 
-bool pdf_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
-#ifdef PDF_DEBUG
-	LOG(("%d %d %d %d %f %X", x0, y0, x1, y1, page_height - y0, style->fill_colour));
-#endif
 
-	apply_clip_and_mode(false, style->fill_colour, TRANSPARENT, 0., DashPattern_eNone);
-
-	/*Normalize boundaries of the area - to prevent overflows.
-	  It is needed only in a few functions, where integers are subtracted.
-	  When the whole browser window is meant min and max int values are used
-	  what must be handled in paged output.
-	*/
-	x0 = min(max(x0, 0), page_width);
-	y0 = min(max(y0, 0), page_height);
-	x1 = min(max(x1, 0), page_width);
-	y1 = min(max(y1, 0), page_height);
-
-	HPDF_Page_Rectangle(pdf_page, x0, page_height - y1, x1 - x0, y1 - y0);
-	HPDF_Page_Fill(pdf_page);
-
-	return true;
-}
-
 /**here the clip is only queried */
 bool pdf_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1)
 {
Index: desktop/history_core.c
===================================================================
--- desktop/history_core.c	(revision 8373)
+++ desktop/history_core.c	(working copy)
@@ -628,6 +628,11 @@
 	int tailsize = 5;
 	int xoffset = x - x0;
 	int yoffset = y - y0;
+        plot_style_t pstyle_history_rect = { 
+            .stroke_type = PLOT_OP_TYPE_SOLID,
+            .stroke_colour = c,
+            .stroke_width = entry == history->current ? 2 : 1,
+        };
 
 	if (clip) {
 		if(!plot.clip(x0 + xoffset, y0 + yoffset, x1 + xoffset, y1 + yoffset))
@@ -637,9 +642,11 @@
 	if (!plot.bitmap(entry->x + xoffset, entry->y + yoffset, WIDTH, HEIGHT,
 			entry->bitmap, 0xffffff, 0))
 		return false;
-	if (!plot.rectangle(entry->x - 1 + xoffset, entry->y - 1 + yoffset,
-			WIDTH + 1, HEIGHT + 1,
-			entry == history->current ? 2 : 1, c, false, false))
+	if (!plot.rectangle(entry->x - 1 + xoffset, 
+                            entry->y - 1 + yoffset,
+                            entry->x + xoffset + WIDTH, 
+                            entry->y + yoffset + HEIGHT,
+                            &pstyle_history_rect))
 		return false;
 
 	if (!nsfont.font_position_in_string(&css_base_style, entry->page.title,
Index: desktop/textarea.c
===================================================================
--- desktop/textarea.c	(revision 8373)
+++ desktop/textarea.c	(working copy)
@@ -41,11 +41,17 @@
 #define BORDER_COLOR 0x000000
 #define SELECTION_COL 0xFFDDDD
 
-static plot_style_t plot_style_fill_selection = { 
+static plot_style_t pstyle_fill_selection = { 
     .fill_type = PLOT_OP_TYPE_SOLID,
     .fill_colour = SELECTION_COL,
 };
 
+static plot_style_t pstyle_stroke_border = { 
+    .stroke_type = PLOT_OP_TYPE_SOLID,
+    .stroke_colour = BORDER_COLOR,
+    .stroke_width = 1,
+};
+
 struct line_info {
 	unsigned int b_start;		/**< Byte offset of line start */
 	unsigned int b_length;		/**< Byte length of line */
@@ -782,9 +788,10 @@
 		y1 = ta->y + ta->vis_height;
 	
 	plot.clip(x0, y0, x1, y1);
-	plot.fill(x0, y0, x1, y1, &plot_style_fill_bg);
-	plot.rectangle(ta->x, ta->y, ta->vis_width - 1, ta->vis_height - 1, 1,
-			BORDER_COLOR, false, false);
+	plot.rectangle(x0, y0, x1, y1, &plot_style_fill_bg);
+	plot.rectangle(ta->x, ta->y, 
+		       ta->x + ta->vis_width - 1, ta->y + ta->vis_height - 1, 
+		       &pstyle_stroke_border);
 	
 	if (x0 < ta->x + MARGIN_LEFT)
 		x0 = ta->x + MARGIN_LEFT;
@@ -864,13 +871,13 @@
 					b_start]),
 					b_end, &x1);
 			x1 += x0;
-			plot.fill(x0 - ta->scroll_x, ta->y +
-					line * ta->line_height
-					+ 1 - ta->scroll_y,
-					x1 - ta->scroll_x,
-     					ta->y + (line + 1) * ta->line_height -
-					1 - ta->scroll_y,
-				 	&plot_style_fill_selection);
+			plot.rectangle(x0 - ta->scroll_x, ta->y +
+				       line * ta->line_height
+				       + 1 - ta->scroll_y,
+				       x1 - ta->scroll_x,
+				       ta->y + (line + 1) * ta->line_height -
+				       1 - ta->scroll_y,
+				       &pstyle_fill_selection);
 			
 		}
 		
Index: desktop/plotters.h
===================================================================
--- desktop/plotters.h	(revision 8373)
+++ desktop/plotters.h	(working copy)
@@ -55,6 +55,9 @@
 extern plot_style_t *plot_style_fill_white;
 extern plot_style_t *plot_style_fill_red;
 extern plot_style_t *plot_style_fill_black;
+extern plot_style_t *plot_style_stroke_red;
+extern plot_style_t *plot_style_stroke_blue;
+extern plot_style_t *plot_style_stroke_yellow;
 
 /** Set of target specific plotting functions.
  *
@@ -115,12 +118,10 @@
  *  3 | | | | | |
  */
 struct plotter_table {
-	bool (*rectangle)(int x0, int y0, int width, int height,
-			int line_width, colour c, bool dotted, bool dashed);
+	bool (*rectangle)(int x0, int y0, int x1, int y1, const plot_style_t *style);
 	bool (*line)(int x0, int y0, int x1, int y1, int width,
 			colour c, bool dotted, bool dashed);
 	bool (*polygon)(const int *p, unsigned int n, colour fill);
-	bool (*fill)(int x0, int y0, int x1, int y1, plot_style_t *style);
 	bool (*clip)(int x0, int y0, int x1, int y1);
 	bool (*text)(int x, int y, const struct css_style *style,
 			const char *text, size_t length, colour bg, colour c);
Index: desktop/knockout.c
===================================================================
--- desktop/knockout.c	(revision 8373)
+++ desktop/knockout.c	(working copy)
@@ -91,9 +91,30 @@
 	.fill_colour = 0x0,
 };
 
+static plot_style_t plot_style_stroke_red_static = {
+	.stroke_type = PLOT_OP_TYPE_SOLID,
+	.stroke_colour = 0x000000ff,
+	.stroke_width = 1,
+};
+
+static plot_style_t plot_style_stroke_blue_static = {
+	.stroke_type = PLOT_OP_TYPE_SOLID,
+	.stroke_colour = 0x00ff0000,
+	.stroke_width = 1,
+};
+
+static plot_style_t plot_style_stroke_yellow_static = {
+	.stroke_type = PLOT_OP_TYPE_SOLID,
+	.stroke_colour = 0x0000ffff,
+	.stroke_width = 1,
+};
+
 plot_style_t *plot_style_fill_white = &plot_style_fill_white_static;
 plot_style_t *plot_style_fill_red = &plot_style_fill_red_static;
 plot_style_t *plot_style_fill_black = &plot_style_fill_black_static;
+plot_style_t *plot_style_stroke_red = &plot_style_stroke_red_static;
+plot_style_t *plot_style_stroke_blue = &plot_style_stroke_blue_static;
+plot_style_t *plot_style_stroke_yellow = &plot_style_stroke_yellow_static;
 
 struct knockout_box;
 struct knockout_entry;
@@ -105,12 +126,10 @@
 static bool knockout_plot_bitmap_recursive(struct knockout_box *box,
 		struct knockout_entry *entry);
 
-static bool knockout_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed);
 static bool knockout_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed);
 static bool knockout_plot_polygon(const int *p, unsigned int n, colour fill);
-static bool knockout_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *plot_style);
+static bool knockout_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *plot_style);
 static bool knockout_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1);
 static bool knockout_plot_text(int x, int y, const struct css_style *style,
@@ -132,7 +151,6 @@
 	.rectangle = knockout_plot_rectangle,
 	.line = knockout_plot_line,
 	.polygon = knockout_plot_polygon,
-	.fill = knockout_plot_fill,
 	.clip = knockout_plot_clip,
 	.text = knockout_plot_text,
 	.disc = knockout_plot_disc,
@@ -181,12 +199,9 @@
 		struct {
 			int x0;
 			int y0;
-			int width;
-			int height;
-			int line_width;
-			colour c;
-			bool dotted;
-			bool dashed;
+			int x1;
+			int y1;
+			plot_style_t plot_style;
 		} rectangle;
 		struct {
 			int x0;
@@ -337,15 +352,12 @@
 	for (i = 0; i < knockout_entry_cur; i++) {
 		switch (knockout_entries[i].type) {
 		case KNOCKOUT_PLOT_RECTANGLE:
-			success &= plot.rectangle(
-					knockout_entries[i].data.rectangle.x0,
-					knockout_entries[i].data.rectangle.y0,
-					knockout_entries[i].data.rectangle.width,
-					knockout_entries[i].data.rectangle.height,
-					knockout_entries[i].data.rectangle.line_width,
-					knockout_entries[i].data.rectangle.c,
-					knockout_entries[i].data.rectangle.dotted,
-					knockout_entries[i].data.rectangle.dashed);
+                        success &= plot.rectangle(
+                                knockout_entries[i].data.rectangle.x0,
+                                knockout_entries[i].data.rectangle.y0,
+                                knockout_entries[i].data.rectangle.x1,
+                                knockout_entries[i].data.rectangle.y1,
+                                &knockout_entries[i].data.rectangle.plot_style);
 			break;
 		case KNOCKOUT_PLOT_LINE:
 			success &= plot.line(
@@ -370,7 +382,7 @@
 				success &= knockout_plot_fill_recursive(box,
 						&knockout_entries[i].data.fill.plot_style);
 			else if (!knockout_entries[i].box->deleted)
-				success &= plot.fill(
+				success &= plot.rectangle(
 						knockout_entries[i].data.fill.x0,
 						knockout_entries[i].data.fill.y0,
 						knockout_entries[i].data.fill.x1,
@@ -605,11 +617,11 @@
 		if (parent->child)
 			knockout_plot_fill_recursive(parent->child, plot_style);
 		else
-			success &= plot.fill(parent->bbox.x0,
-					parent->bbox.y0,
-					parent->bbox.x1,
-					parent->bbox.y1,
-					plot_style);
+			success &= plot.rectangle(parent->bbox.x0,
+                                                  parent->bbox.y0,
+                                                  parent->bbox.x1,
+                                                  parent->bbox.y1,
+                                                  plot_style);
 	}
 	return success;
 }
@@ -643,26 +655,57 @@
 	return success;
 }
 
+bool knockout_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *pstyle)
+{
+	int kx0, ky0, kx1, ky1;
 
+        if (pstyle->fill_type != PLOT_OP_TYPE_NONE) {
+		/* filled draw */
 
-bool knockout_plot_rectangle(int x0, int y0, int width, int height,
-		int line_width, colour c, bool dotted, bool dashed)
-{
-	knockout_entries[knockout_entry_cur].data.rectangle.x0 = x0;
-	knockout_entries[knockout_entry_cur].data.rectangle.y0 = y0;
-	knockout_entries[knockout_entry_cur].data.rectangle.width = width;
-	knockout_entries[knockout_entry_cur].data.rectangle.height = height;
-	knockout_entries[knockout_entry_cur].data.rectangle.line_width = line_width;
-	knockout_entries[knockout_entry_cur].data.rectangle.c = c;
-	knockout_entries[knockout_entry_cur].data.rectangle.dotted = dotted;
-	knockout_entries[knockout_entry_cur].data.rectangle.dashed = dashed;
-	knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_RECTANGLE;
-	if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
-		knockout_plot_flush();
+		/* get our bounds */
+		kx0 = (x0 > clip_x0_cur) ? x0 : clip_x0_cur;
+		ky0 = (y0 > clip_y0_cur) ? y0 : clip_y0_cur;
+		kx1 = (x1 < clip_x1_cur) ? x1 : clip_x1_cur;
+		ky1 = (y1 < clip_y1_cur) ? y1 : clip_y1_cur;
+		if ((kx0 > clip_x1_cur) || (kx1 < clip_x0_cur) ||
+		    (ky0 > clip_y1_cur) || (ky1 < clip_y0_cur))
+			return true;
+
+		/* fills both knock out and get knocked out */
+		knockout_calculate(kx0, ky0, kx1, ky1, NULL);
+		knockout_boxes[knockout_box_cur].bbox.x0 = x0;
+		knockout_boxes[knockout_box_cur].bbox.y0 = y0;
+		knockout_boxes[knockout_box_cur].bbox.x1 = x1;
+		knockout_boxes[knockout_box_cur].bbox.y1 = y1;
+		knockout_boxes[knockout_box_cur].deleted = false;
+		knockout_boxes[knockout_box_cur].child = NULL;
+		knockout_boxes[knockout_box_cur].next = knockout_list;
+		knockout_list = &knockout_boxes[knockout_box_cur];
+		knockout_entries[knockout_entry_cur].box = &knockout_boxes[knockout_box_cur];
+		knockout_entries[knockout_entry_cur].data.fill.x0 = x0;
+		knockout_entries[knockout_entry_cur].data.fill.y0 = y0;
+		knockout_entries[knockout_entry_cur].data.fill.x1 = x1;
+		knockout_entries[knockout_entry_cur].data.fill.y1 = y1;
+		knockout_entries[knockout_entry_cur].data.fill.plot_style = *pstyle;
+		knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_FILL;
+		if ((++knockout_entry_cur >= KNOCKOUT_ENTRIES) ||
+		    (++knockout_box_cur >= KNOCKOUT_BOXES))
+			knockout_plot_flush();
+        } else if (pstyle->stroke_type != PLOT_OP_TYPE_NONE) {
+		/* not a filled area */
+
+		knockout_entries[knockout_entry_cur].data.rectangle.x0 = x0;
+		knockout_entries[knockout_entry_cur].data.rectangle.y0 = y0;
+		knockout_entries[knockout_entry_cur].data.rectangle.x1 = x1;
+		knockout_entries[knockout_entry_cur].data.rectangle.y1 = y1;
+		knockout_entries[knockout_entry_cur].data.fill.plot_style = *pstyle;
+		knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_RECTANGLE;
+		if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
+			knockout_plot_flush();
+        }
 	return true;
 }
 
-
 bool knockout_plot_line(int x0, int y0, int x1, int y1, int width,
 		colour c, bool dotted, bool dashed)
 {
@@ -719,43 +762,6 @@
 }
 
 
-bool knockout_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *plot_style)
-{
-	int kx0, ky0, kx1, ky1;
-
-	/* get our bounds */
-	kx0 = (x0 > clip_x0_cur) ? x0 : clip_x0_cur;
-	ky0 = (y0 > clip_y0_cur) ? y0 : clip_y0_cur;
-	kx1 = (x1 < clip_x1_cur) ? x1 : clip_x1_cur;
-	ky1 = (y1 < clip_y1_cur) ? y1 : clip_y1_cur;
-	if ((kx0 > clip_x1_cur) || (kx1 < clip_x0_cur) ||
-			(ky0 > clip_y1_cur) || (ky1 < clip_y0_cur))
-		return true;
-
-	/* fills both knock out and get knocked out */
-	knockout_calculate(kx0, ky0, kx1, ky1, NULL);
-	knockout_boxes[knockout_box_cur].bbox.x0 = x0;
-	knockout_boxes[knockout_box_cur].bbox.y0 = y0;
-	knockout_boxes[knockout_box_cur].bbox.x1 = x1;
-	knockout_boxes[knockout_box_cur].bbox.y1 = y1;
-	knockout_boxes[knockout_box_cur].deleted = false;
-	knockout_boxes[knockout_box_cur].child = NULL;
-	knockout_boxes[knockout_box_cur].next = knockout_list;
-	knockout_list = &knockout_boxes[knockout_box_cur];
-	knockout_entries[knockout_entry_cur].box = &knockout_boxes[knockout_box_cur];
-	knockout_entries[knockout_entry_cur].data.fill.x0 = x0;
-	knockout_entries[knockout_entry_cur].data.fill.y0 = y0;
-	knockout_entries[knockout_entry_cur].data.fill.x1 = x1;
-	knockout_entries[knockout_entry_cur].data.fill.y1 = y1;
-	knockout_entries[knockout_entry_cur].data.fill.plot_style = *plot_style;
-	knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_FILL;
-	if ((++knockout_entry_cur >= KNOCKOUT_ENTRIES) ||
-			(++knockout_box_cur >= KNOCKOUT_BOXES))
-		knockout_plot_flush();
-	return true;
-}
-
-
 bool knockout_plot_clip(int clip_x0, int clip_y0,
 		int clip_x1, int clip_y1)
 {
Index: amiga/plotters.c
===================================================================
--- amiga/plotters.c	(revision 8373)
+++ amiga/plotters.c	(working copy)
@@ -64,7 +64,6 @@
 	.rectangle = ami_rectangle,
 	.line = ami_line,
 	.polygon = ami_polygon,
-	.fill = ami_fill,
 	.clip = ami_clip,
 	.text = ami_text,
 	.disc = ami_disc,
@@ -122,42 +121,84 @@
 	return true;
 }
 
-bool ami_rectangle(int x0, int y0, int width, int height,
-			int line_width, colour c, bool dotted, bool dashed)
+
+
+bool ami_rectangle(int x0, int y0, int x1, int y1, plot_style_t *style)
 {
+	if (style->fill_type != PLOT_OP_TYPE_NONE) {  
 #ifndef NS_AMIGA_CAIRO_ALL
-	currp->PenWidth = line_width;
-	currp->PenHeight = line_width;
+		p96RectFill(currp,x0,y0,x1-1,y1-1,
+			    p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour));
+#else
+		ami_cairo_set_colour(glob.cr, style->fill_colour);
+		ami_cairo_set_solid(glob.cr);
 
-	currp->LinePtrn = PATT_LINE;
-	if(dotted) currp->LinePtrn = PATT_DOT;
-	if(dashed) currp->LinePtrn = PATT_DASH;
+		cairo_set_line_width(glob.cr, 0);
+		cairo_rectangle(glob.cr, x0, y0, x1 - x0, y1 - y0);
+		cairo_fill(glob.cr);
+		cairo_stroke(glob.cr);
+#endif
+	}
+	if (style->stroke_type != PLOT_OP_TYPE_NONE) {
 
-	SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
-					TAG_DONE);
-	Move(currp,x0,y0);
-	Draw(currp,x0+width,y0);
-	Draw(currp,x0+width,y0+height);
-	Draw(currp,x0,y0+height);
-	Draw(currp,x0,y0);
+#ifndef NS_AMIGA_CAIRO_ALL
+		currp->PenWidth = style->stroke_width;
+		currp->PenHeight = style->stroke_width;
 
-	currp->PenWidth = 1;
-	currp->PenHeight = 1;
-	currp->LinePtrn = PATT_LINE;
+                switch (style->stroke_type) {
+                case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+                default:
+			currp->LinePtrn = PATT_LINE;
+                        break;
+
+                case PLOT_OP_TYPE_DOT: /**< Doted plot */
+                        currp->LinePtrn = PATT_DOT;
+                        break;
+
+                case PLOT_OP_TYPE_DASH: /**< dashed plot */
+                        currp->LinePtrn = PATT_DASH;
+                        break;
+                }
+
+		SetRPAttrs(currp, RPTAG_APenColor, 
+			   p96EncodeColor(RGBFB_A8B8G8R8, style->stroke_colour),
+			   TAG_DONE);
+		Move(currp, x0, y0);
+		Draw(currp, x0 + width, y0);
+		Draw(currp, x0 + width, y0 + height);
+		Draw(currp, x0, y0 + height);
+		Draw(currp, x0, y0);
+
+		currp->PenWidth = 1;
+		currp->PenHeight = 1;
+		currp->LinePtrn = PATT_LINE;
 #else
-	ami_cairo_set_colour(glob.cr,c);
-	if (dotted) ami_cairo_set_dotted(glob.cr);
-        else if (dashed) ami_cairo_set_dashed(glob.cr);
-        else ami_cairo_set_solid(glob.cr);
+		ami_cairo_set_colour(glob.cr, style->stroke_colour);
 
-	if (line_width == 0)
-		line_width = 1;
+                switch (style->stroke_type) {
+                case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+                default:
+			ami_cairo_set_solid(glob.cr);
+                        break;
 
-	cairo_set_line_width(glob.cr, line_width);
-	cairo_rectangle(glob.cr, x0, y0, width, height);
-	cairo_stroke(glob.cr);
+                case PLOT_OP_TYPE_DOT: /**< Doted plot */
+                        ami_cairo_set_dotted(glob.cr);
+                        break;
+
+                case PLOT_OP_TYPE_DASH: /**< dashed plot */
+                        ami_cairo_set_dashed(glob.cr);
+                        break;
+                }
+
+                if (style->stroke_width == 0) 
+                        cairo_set_line_width(current_cr, 1);
+                else
+                        cairo_set_line_width(current_cr, style->stroke_width);
+
+		cairo_rectangle(glob.cr, x0, y0, x1 - x0, y1 - y0);
+		cairo_stroke(glob.cr);
 #endif
-
+	}
 	return true;
 }
 
@@ -235,23 +276,7 @@
 	return true;
 }
 
-bool ami_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
-#ifndef NS_AMIGA_CAIRO_ALL
-	p96RectFill(currp,x0,y0,x1-1,y1-1,
-		p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour));
-#else
-	ami_cairo_set_colour(glob.cr, style->fill_colour);
-	ami_cairo_set_solid(glob.cr);
 
-	cairo_set_line_width(glob.cr, 0);
-	cairo_rectangle(glob.cr, x0, y0, x1 - x0, y1 - y0);
-	cairo_fill(glob.cr);
-	cairo_stroke(glob.cr);
-#endif
-	return true;
-}
-
 bool ami_clip(int x0, int y0, int x1, int y1)
 {
 	struct Region *reg = NULL;
Index: amiga/plotters.h
===================================================================
--- amiga/plotters.h	(revision 8373)
+++ amiga/plotters.h	(working copy)
@@ -23,12 +23,10 @@
 extern const struct plotter_table amiplot;
 
 bool ami_clg(colour c);
-bool ami_rectangle(int x0, int y0, int width, int height,
-			int line_width, colour c, bool dotted, bool dashed);
+bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
 bool ami_line(int x0, int y0, int x1, int y1, int width,
 			colour c, bool dotted, bool dashed);
 bool ami_polygon(const int *p, unsigned int n, colour fill);
-bool ami_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
 bool ami_clip(int x0, int y0, int x1, int y1);
 bool ami_text(int x, int y, const struct css_style *style,
 			const char *text, size_t length, colour bg, colour c);

Attachment: signature.asc
Description: Digital signature



Reply via email to