[dia] DiaRenderer: replace fill_rounded_rect with extended draw_rounded_rect
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] DiaRenderer: replace fill_rounded_rect with extended draw_rounded_rect
- Date: Thu, 1 May 2014 10:49:49 +0000 (UTC)
commit f7f5c8cec391b5ac1a5467ee20b119f623a4aadc
Author: Hans Breuer <hans breuer org>
Date: Sun Apr 27 21:48:57 2014 +0200
DiaRenderer: replace fill_rounded_rect with extended draw_rounded_rect
Fully optimized versions for: GDK, Import, DRS, SVG, diasvg.py, WMF
Not fully optimized: PGF
Base class is good enough for: cairo
Object code adapted everywhere: Custom, Flowchart, IStar, KAOS,
bindings/dia-renderer.cpp | 12 +---
bindings/dia-renderer.h | 6 +--
lib/diagdkrenderer.c | 76 ++++++++++++-----------------
lib/diaimportrenderer.c | 29 ++---------
lib/diarenderer.c | 75 +++-------------------------
lib/diarenderer.h | 7 +--
objects/Istar/goal.c | 5 +-
objects/UML/activity.c | 4 +-
objects/UML/state.c | 7 ++-
objects/UML/state_term.c | 3 -
objects/custom/custom_object.c | 8 ++--
objects/flowchart/box.c | 13 ++---
objects/standard/box.c | 16 +++---
plug-ins/cairo/diacairo-renderer.c | 72 ---------------------------
plug-ins/drs/dia-render-script-import.c | 6 +--
plug-ins/drs/dia-render-script-renderer.c | 25 +++-------
plug-ins/pgf/render_pgf.c | 18 +++++--
plug-ins/python/diadissect.py | 4 +-
plug-ins/python/diasvg.py | 10 +---
plug-ins/python/pydia-render.c | 55 ++++++---------------
plug-ins/svg/render_svg.c | 53 ++++----------------
plug-ins/wmf/wmf.cpp | 53 ++++++++------------
22 files changed, 146 insertions(+), 411 deletions(-)
---
diff --git a/bindings/dia-renderer.cpp b/bindings/dia-renderer.cpp
index 535a3aa..625bab9 100644
--- a/bindings/dia-renderer.cpp
+++ b/bindings/dia-renderer.cpp
@@ -215,17 +215,11 @@ dia::Renderer::draw_rounded_polyline (Point *points, int num_points, Color *colo
}
// specialized draw_rect() with round corners
void
-dia::Renderer::draw_rounded_rect (Point *ul_corner, Point *lr_corner, Color *color, real radius)
+dia::Renderer::draw_rounded_rect (Point *ul_corner, Point *lr_corner,
+ Color *fill, Color *stroke, real radius)
{
assert (self);
- DIA_RENDERER_GET_CLASS(self)->draw_rounded_rect (self, ul_corner, lr_corner, color, radius);
-}
-// specialized draw_rect() with round corners
-void
-dia::Renderer::fill_rounded_rect (Point *ul_corner, Point *lr_corner, Color *color, real radius)
-{
- assert (self);
- DIA_RENDERER_GET_CLASS(self)->fill_rounded_rect (self, ul_corner, lr_corner, color, radius);
+ DIA_RENDERER_GET_CLASS(self)->draw_rounded_rect (self, ul_corner, lr_corner, fill, stroke, radius);
}
// specialized draw_line() for renderers with an own concept of Arrow
void
diff --git a/bindings/dia-renderer.h b/bindings/dia-renderer.h
index d994ce8..4158b99 100644
--- a/bindings/dia-renderer.h
+++ b/bindings/dia-renderer.h
@@ -131,10 +131,8 @@ public :
virtual void draw_rounded_polyline (Point *points, int num_points, Color *color, double radius);
//! specialized draw_rect() with round corners
//! \ingroup RenderHigh
- virtual void draw_rounded_rect (Point *ul_corner, Point *lr_corner, Color *color, real radius);
- //! specialized draw_rect() with round corners
- //! \ingroup RenderHigh
- virtual void fill_rounded_rect (Point *ul_corner, Point *lr_corner, Color *color, real radius);
+ virtual void draw_rounded_rect (Point *ul_corner, Point *lr_corner,
+ Color *fill, Color *stroke, real radius);
//! specialized draw_line() for renderers with an own concept of Arrow
//! \ingroup RenderHigh
virtual void draw_line_with_arrows (Point *start, Point *end, real line_width, Color *line_color,
diff --git a/lib/diagdkrenderer.c b/lib/diagdkrenderer.c
index 2166d19..228c6c9 100644
--- a/lib/diagdkrenderer.c
+++ b/lib/diagdkrenderer.c
@@ -105,10 +105,7 @@ static void draw_polygon (DiaRenderer *renderer,
Color *fill, Color *stroke);
static void draw_rounded_rect (DiaRenderer *renderer,
Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
-static void fill_rounded_rect (DiaRenderer *renderer,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
+ Color *fill, Color *stroke, real radius);
static real get_text_width (DiaRenderer *renderer,
const gchar *text, int length);
@@ -222,7 +219,6 @@ dia_gdk_renderer_class_init(DiaGdkRendererClass *klass)
renderer_class->draw_line = draw_line;
renderer_class->draw_polygon = draw_polygon;
- renderer_class->draw_rect = draw_rect;
renderer_class->draw_arc = draw_arc;
renderer_class->fill_arc = fill_arc;
renderer_class->draw_ellipse = draw_ellipse;
@@ -235,11 +231,11 @@ dia_gdk_renderer_class_init(DiaGdkRendererClass *klass)
renderer_class->draw_image = draw_image;
/* medium level functions */
+ renderer_class->draw_rect = draw_rect;
renderer_class->draw_polyline = draw_polyline;
/* highest level functions */
renderer_class->draw_rounded_rect = draw_rounded_rect;
- renderer_class->fill_rounded_rect = fill_rounded_rect;
/* Interactive functions */
renderer_class->get_text_width = get_text_width;
@@ -878,7 +874,7 @@ draw_image (DiaRenderer *object,
* medium level functions
*/
static void
-draw_rect (DiaGdkRenderer *self,
+draw_rect (DiaRenderer *self,
Point *ul_corner, Point *lr_corner,
Color *fill, Color *stroke)
{
@@ -938,20 +934,31 @@ draw_polyline (DiaRenderer *self,
}
/*!
- * Implemented to avoid seams between arcs and lines caused by the base class working in real
- * which than gets rounded independently to int here
+ * \brief Fill and/or stroke a rectangle with rounded corner
+ * Implemented to avoid seams between arcs and lines caused by the base class
+ * working in real which than gets rounded independently to int here
+ * \memberof _DiaGdkRenderer
*/
static void
-draw_fill_rounded_rect (DiaRenderer *self,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius,
- gboolean fill)
+draw_rounded_rect (DiaRenderer *self,
+ Point *ul_corner, Point *lr_corner,
+ Color *fill, Color *stroke,
+ real radius)
{
DiaGdkRenderer *renderer = DIA_GDK_RENDERER (self);
GdkGC *gc = renderer->gc;
GdkColor gdkcolor;
- gint top, bottom, left, right, r, d;
+ gint top, bottom, left, right, d;
gint offset = 0; /* to compensate for a radius smaller than line_width */
+ Color *color = fill ? fill : stroke;
+ gint r = dia_transform_length(renderer->transform, radius);
+
+ g_return_if_fail (color != NULL);
+
+ if (r < 1) {
+ draw_rect (self, ul_corner, lr_corner, fill, stroke);
+ return;
+ }
dia_transform_coords(renderer->transform,
ul_corner->x, ul_corner->y, &left, &top);
@@ -989,51 +996,30 @@ draw_fill_rounded_rect (DiaRenderer *self,
renderer->line_width, renderer->line_style,
renderer->cap_style, renderer->join_style);
} else {
- gdk_draw_arc(renderer->pixmap, gc, fill, left, top, d, d, 90<<6, 90<<6);
- gdk_draw_arc(renderer->pixmap, gc, fill, right-d, top, d, d, 0<<6, 90<<6);
- gdk_draw_arc(renderer->pixmap, gc, fill, right-d, bottom-d, d, d, 270<<6, 90<<6);
- gdk_draw_arc(renderer->pixmap, gc, fill, left, bottom-d, d, d, 180<<6, 90<<6);
+ gdk_draw_arc(renderer->pixmap, gc, !!fill, left, top, d, d, 90<<6, 90<<6);
+ gdk_draw_arc(renderer->pixmap, gc, !!fill, right-d, top, d, d, 0<<6, 90<<6);
+ gdk_draw_arc(renderer->pixmap, gc, !!fill, right-d, bottom-d, d, d, 270<<6, 90<<6);
+ gdk_draw_arc(renderer->pixmap, gc, !!fill, left, bottom-d, d, d, 180<<6, 90<<6);
}
}
if (fill) {
+ renderer_color_convert(renderer, fill, &gdkcolor);
+ gdk_gc_set_foreground(gc, &gdkcolor);
gdk_draw_rectangle (renderer->pixmap, renderer->gc, TRUE,
left+r-offset, top, right-left-d+offset, bottom-top);
gdk_draw_rectangle (renderer->pixmap, renderer->gc, TRUE,
left, top+r-offset, right-left, bottom-top-d+offset);
- } else {
+ }
+ if (stroke) {
+ renderer_color_convert(renderer, stroke, &gdkcolor);
+ gdk_gc_set_foreground(gc, &gdkcolor);
gdk_draw_line(renderer->pixmap, gc, left+r-offset, top, right-r+offset, top);
gdk_draw_line(renderer->pixmap, gc, right, top+r-offset, right, bottom-r+offset);
gdk_draw_line(renderer->pixmap, gc, right-r+offset, bottom, left+r-1-offset, bottom);
gdk_draw_line(renderer->pixmap, gc, left, bottom-r+offset, left, top+r-1-offset);
}
}
-static void
-draw_rounded_rect (DiaRenderer *self,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius)
-{
- DiaGdkRenderer *renderer = DIA_GDK_RENDERER (self);
- gint r = dia_transform_length(renderer->transform, radius);
-
- if (r > 0)
- draw_fill_rounded_rect (self, ul_corner, lr_corner, color, radius, FALSE);
- else
- draw_rect (self, ul_corner, lr_corner, NULL, color);
-}
-static void
-fill_rounded_rect (DiaRenderer *self,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius)
-{
- DiaGdkRenderer *renderer = DIA_GDK_RENDERER (self);
- gint r = dia_transform_length(renderer->transform, radius);
-
- if (r > 0)
- draw_fill_rounded_rect (self, ul_corner, lr_corner, color, radius, TRUE);
- else
- draw_rect (self, ul_corner, lr_corner, color, NULL);
-}
static int
get_width_pixels (DiaRenderer *object)
diff --git a/lib/diaimportrenderer.c b/lib/diaimportrenderer.c
index 6b1a2ea..69eba5e 100644
--- a/lib/diaimportrenderer.c
+++ b/lib/diaimportrenderer.c
@@ -95,10 +95,8 @@ static void draw_polygon (DiaRenderer *renderer,
static void draw_rounded_rect (DiaRenderer *renderer,
Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
-static void fill_rounded_rect (DiaRenderer *renderer,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
+ Color *fill, Color *stroke, real radius);
+
static void draw_line_with_arrows (DiaRenderer *renderer,
Point *start, Point *end,
real line_width,
@@ -191,7 +189,6 @@ dia_import_renderer_class_init (DiaImportRendererClass *klass)
/* highest level functions */
renderer_class->draw_rounded_rect = draw_rounded_rect;
- renderer_class->fill_rounded_rect = fill_rounded_rect;
renderer_class->draw_line_with_arrows = draw_line_with_arrows;
renderer_class->draw_arc_with_arrows = draw_arc_with_arrows;
renderer_class->draw_polyline_with_arrows = draw_polyline_with_arrows;
@@ -591,31 +588,13 @@ draw_polygon (DiaRenderer *renderer,
static void
draw_rounded_rect (DiaRenderer *renderer,
Point *ul_corner, Point *lr_corner,
- Color *color, real radius)
-{
- DiaImportRenderer *self = DIA_IMPORT_RENDERER (renderer);
- DiaObject *object = create_standard_box (ul_corner->x, ul_corner->y,
- lr_corner->x - ul_corner->x,
- lr_corner->y - ul_corner->y);
- _apply_style (self, object, NULL, color, radius);
- _push_object (self, object);
-}
-
-/*!
- * \brief Fill a rectangle with rounded corners.
- * Creates a _Box object.
- * \memberof _DiaImportRenderer
- */
-static void
-fill_rounded_rect(DiaRenderer *renderer,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius)
+ Color *fill, Color *stroke, real radius)
{
DiaImportRenderer *self = DIA_IMPORT_RENDERER (renderer);
DiaObject *object = create_standard_box (ul_corner->x, ul_corner->y,
lr_corner->x - ul_corner->x,
lr_corner->y - ul_corner->y);
- _apply_style (self, object, color, NULL, radius);
+ _apply_style (self, object, fill, stroke, radius);
_push_object (self, object);
}
diff --git a/lib/diarenderer.c b/lib/diarenderer.c
index 9f5491c..12e5d3f 100644
--- a/lib/diarenderer.c
+++ b/lib/diarenderer.c
@@ -126,10 +126,7 @@ static real get_text_width (DiaRenderer *renderer,
static void draw_rounded_rect (DiaRenderer *renderer,
Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
-static void fill_rounded_rect (DiaRenderer *renderer,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
+ Color *fill, Color *stroke, real radius);
static void draw_line_with_arrows (DiaRenderer *renderer,
Point *start, Point *end,
real line_width,
@@ -337,7 +334,6 @@ dia_renderer_class_init (DiaRendererClass *klass)
/* highest level functions */
renderer_class->draw_rounded_rect = draw_rounded_rect;
- renderer_class->fill_rounded_rect = fill_rounded_rect;
renderer_class->draw_line_with_arrows = draw_line_with_arrows;
renderer_class->draw_arc_with_arrows = draw_arc_with_arrows;
renderer_class->draw_polyline_with_arrows = draw_polyline_with_arrows;
@@ -875,7 +871,7 @@ draw_polygon (DiaRenderer *renderer,
static void
_rounded_rect_with_bezier (DiaRenderer *renderer,
Point *ul_corner, Point *lr_corner,
- Color *color, real radius, gboolean fill)
+ Color *fill, Color *stroke, real radius)
{
/* Conversion algorithm copied from objects/standard/box
* If you find bugs here they might be there as well;)
@@ -907,34 +903,33 @@ _rounded_rect_with_bezier (DiaRenderer *renderer,
points[8].p2.x = x; points[8].p2.y = y; points[8].p3.x = x + r; points[8].p3.y = y;
/* end of copy */
- if (fill)
- DIA_RENDERER_GET_CLASS(renderer)->draw_beziergon (renderer, points, num_points, color, NULL);
- else
- DIA_RENDERER_GET_CLASS(renderer)->draw_beziergon (renderer, points, num_points, NULL, color);
+ DIA_RENDERER_GET_CLASS(renderer)->draw_beziergon (renderer, points, num_points, fill, stroke);
}
static void
draw_rounded_rect (DiaRenderer *renderer,
Point *ul_corner, Point *lr_corner,
- Color *color, real radius)
+ Color *fill, Color *stroke, real radius)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Point start, end, center;
+ Color *color = fill ? fill : stroke;
radius = MIN(radius, (lr_corner->x-ul_corner->x)/2);
radius = MIN(radius, (lr_corner->y-ul_corner->y)/2);
if (radius < 0.00001) {
- renderer_ops->draw_rect(renderer, ul_corner, lr_corner, NULL, color);
+ renderer_ops->draw_rect(renderer, ul_corner, lr_corner, fill, stroke);
return;
}
/* if the renderer has it's own draw_bezier use that */
if (DIA_RENDERER_GET_CLASS(renderer)->draw_bezier != &draw_bezier) {
- _rounded_rect_with_bezier (renderer, ul_corner, lr_corner, color, radius, FALSE);
+ _rounded_rect_with_bezier (renderer, ul_corner, lr_corner, fill, stroke, radius);
return;
}
/* final fallback */
+ //FIXME: needs extended draw_arc
start.x = center.x = ul_corner->x+radius;
end.x = lr_corner->x-radius;
start.y = end.y = ul_corner->y;
@@ -969,60 +964,6 @@ draw_rounded_rect (DiaRenderer *renderer,
270.0, 360.0, color);
}
-static void
-fill_rounded_rect(DiaRenderer *renderer,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius)
-{
- DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
- Point start, end, center;
-
- radius = MIN(radius, (lr_corner->x-ul_corner->x)/2);
- radius = MIN(radius, (lr_corner->y-ul_corner->y)/2);
-
- if (radius < 0.00001) {
- renderer_ops->draw_rect(renderer, ul_corner, lr_corner, color, NULL);
- return;
- }
- /* if the renderer has it's own draw_beziergon use that */
- if (DIA_RENDERER_GET_CLASS(renderer)->draw_beziergon != &draw_beziergon) {
- _rounded_rect_with_bezier (renderer, ul_corner, lr_corner, color, radius, TRUE);
- return;
- }
- /* final fallback */
- start.x = center.x = ul_corner->x+radius;
- end.x = lr_corner->x-radius;
- start.y = ul_corner->y;
- end.y = lr_corner->y;
- renderer_ops->draw_rect(renderer, &start, &end, color, NULL);
-
- center.y = ul_corner->y+radius;
- renderer_ops->fill_arc(renderer, ¢er,
- 2.0*radius, 2.0*radius,
- 90.0, 180.0, color);
- center.x = end.x;
- renderer_ops->fill_arc(renderer, ¢er,
- 2.0*radius, 2.0*radius,
- 0.0, 90.0, color);
-
-
- start.x = ul_corner->x;
- start.y = ul_corner->y+radius;
- end.x = lr_corner->x;
- end.y = center.y = lr_corner->y-radius;
- renderer_ops->draw_rect(renderer, &start, &end, color, NULL);
-
- center.y = lr_corner->y-radius;
- center.x = ul_corner->x+radius;
- renderer_ops->fill_arc(renderer, ¢er,
- 2.0*radius, 2.0*radius,
- 180.0, 270.0, color);
- center.x = lr_corner->x-radius;
- renderer_ops->fill_arc(renderer, ¢er,
- 2.0*radius, 2.0*radius,
- 270.0, 360.0, color);
-}
-
static void
draw_line_with_arrows(DiaRenderer *renderer,
Point *startpoint,
diff --git a/lib/diarenderer.h b/lib/diarenderer.h
index b7dda28..92cf325 100644
--- a/lib/diarenderer.h
+++ b/lib/diarenderer.h
@@ -211,12 +211,7 @@ struct _DiaRendererClass
/*! Draw a rounded rectangle, given its upper-left and lower-right corners */
void (*draw_rounded_rect) (DiaRenderer *renderer,
Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
- /*! Same a DrawRoundedRectangleFunc, except the rectangle is filled using the
- current fill style */
- void (*fill_rounded_rect) (DiaRenderer *renderer,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
+ Color *fill, Color *stroke, real radius);
/*! Draw a line joining multiple points, using color and the current
line style with rounded corners between segments */
void (*draw_rounded_polyline) (DiaRenderer *renderer,
diff --git a/objects/Istar/goal.c b/objects/Istar/goal.c
index 7d07579..96d836d 100644
--- a/objects/Istar/goal.c
+++ b/objects/Istar/goal.c
@@ -330,8 +330,9 @@ goal_draw(Goal *goal, DiaRenderer *renderer)
p1.y= elem->corner.y;
p2.x=p1.x+elem->width;
p2.y=p1.y+elem->height;
- renderer_ops->fill_rounded_rect(renderer,&p1,&p2, &GOAL_BG_COLOR, elem->height/2.0);
- renderer_ops->draw_rounded_rect(renderer,&p1,&p2, &GOAL_FG_COLOR, elem->height/2.0);
+ renderer_ops->draw_rounded_rect (renderer,&p1,&p2,
+ &GOAL_BG_COLOR, &GOAL_FG_COLOR,
+ elem->height/2.0);
} else { /* softgoal */
compute_cloud(goal,bpl);
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
diff --git a/objects/UML/activity.c b/objects/UML/activity.c
index ddf3f4a..216c19a 100644
--- a/objects/UML/activity.c
+++ b/objects/UML/activity.c
@@ -229,10 +229,8 @@ state_draw(State *state, DiaRenderer *renderer)
p1.y = y;
p2.x = x + w;
p2.y = y + h;
- renderer_ops->fill_rounded_rect(renderer, &p1, &p2,
- &state->fill_color, 1.0);
renderer_ops->draw_rounded_rect(renderer, &p1, &p2,
- &state->line_color, 1.0);
+ &state->fill_color, &state->line_color, 1.0);
text_draw(state->text, renderer);
}
diff --git a/objects/UML/state.c b/objects/UML/state.c
index 07017b1..97800d2 100644
--- a/objects/UML/state.c
+++ b/objects/UML/state.c
@@ -310,9 +310,10 @@ state_draw(State *state, DiaRenderer *renderer)
p1.y = y;
p2.x = x + w;
p2.y = y + h;
- renderer_ops->fill_rounded_rect(renderer, &p1, &p2, &state->fill_color, 0.5);
- renderer_ops->draw_rounded_rect(renderer, &p1, &p2, &state->line_color, 0.5);
-
+ renderer_ops->draw_rounded_rect(renderer, &p1, &p2,
+ &state->fill_color, &state->line_color,
+ 0.5);
+
text_draw(state->text, renderer);
has_actions = FALSE;
if (state->entry_action && strlen(state->entry_action) != 0) {
diff --git a/objects/UML/state_term.c b/objects/UML/state_term.c
index 9d2dde8..925e722 100644
--- a/objects/UML/state_term.c
+++ b/objects/UML/state_term.c
@@ -79,9 +79,6 @@ static void state_get_props(State *state, GPtrArray *props);
static void state_set_props(State *state, GPtrArray *props);
static void state_update_data(State *state);
-void
-draw_rounded_rectangle(DiaRenderer *renderer, Point p1, Point p2, real radio);
-
static ObjectTypeOps state_type_ops =
{
(CreateFunc) state_create,
diff --git a/objects/custom/custom_object.c b/objects/custom/custom_object.c
index 7171758..459706a 100644
--- a/objects/custom/custom_object.c
+++ b/objects/custom/custom_object.c
@@ -994,10 +994,10 @@ custom_draw_element(GraphicElement* el, Custom *custom, DiaRenderer *renderer,
p2.y = coord;
}
/* the renderer implementation will use simple rect with a small enough radius */
- if (custom->show_background && el->any.s.fill != DIA_SVG_COLOUR_NONE)
- renderer_ops->fill_rounded_rect(renderer, &p1, &p2, bg, radius);
- if (el->any.s.stroke != DIA_SVG_COLOUR_NONE)
- renderer_ops->draw_rounded_rect(renderer, &p1, &p2, fg, radius);
+ renderer_ops->draw_rounded_rect(renderer, &p1, &p2,
+ (custom->show_background && el->any.s.fill != DIA_SVG_COLOUR_NONE) ? bg :
NULL,
+ (el->any.s.stroke != DIA_SVG_COLOUR_NONE) ? fg : NULL,
+ radius);
break;
case GE_TEXT:
text_set_height (el->text.object, custom_transform_length (custom, el->text.s.font_height));
diff --git a/objects/flowchart/box.c b/objects/flowchart/box.c
index 2556ac0..1ae65dc 100644
--- a/objects/flowchart/box.c
+++ b/objects/flowchart/box.c
@@ -331,19 +331,16 @@ box_draw(Box *box, DiaRenderer *renderer)
if (box->show_background)
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
- /* Problem: How do we make the fill with rounded corners?
- * It's solved in the base class ...
- */
- renderer_ops->fill_rounded_rect (renderer, &elem->corner, &lr_corner,
- &box->inner_color, box->corner_radius);
-
renderer_ops->set_linewidth(renderer, box->border_width);
renderer_ops->set_linestyle(renderer, box->line_style);
renderer_ops->set_dashlength(renderer, box->dashlength);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
-
+ /* Problem: How do we make the fill with rounded corners?
+ * It's solved in the base class ...
+ */
renderer_ops->draw_rounded_rect (renderer, &elem->corner, &lr_corner,
- &box->border_color, box->corner_radius);
+ &box->inner_color, &box->border_color,
+ box->corner_radius);
text_draw(box->text, renderer);
}
diff --git a/objects/standard/box.c b/objects/standard/box.c
index f18aca6..a3ec7aa 100644
--- a/objects/standard/box.c
+++ b/objects/standard/box.c
@@ -329,10 +329,9 @@ box_draw(Box *box, DiaRenderer *renderer)
}
/* we only want separate calls for potential pattern fill */
if (box->corner_radius > 0) {
- renderer_ops->fill_rounded_rect(renderer,
- &elem->corner,
- &lr_corner,
- &fill,
+ renderer_ops->draw_rounded_rect (renderer,
+ &elem->corner, &lr_corner,
+ &fill, NULL,
box->corner_radius);
} else {
renderer_ops->draw_rect(renderer,
@@ -345,11 +344,10 @@ box_draw(Box *box, DiaRenderer *renderer)
}
if (box->corner_radius > 0) {
- renderer_ops->draw_rounded_rect(renderer,
- &elem->corner,
- &lr_corner,
- &box->border_color,
- box->corner_radius);
+ renderer_ops->draw_rounded_rect (renderer,
+ &elem->corner, &lr_corner,
+ NULL, &box->border_color,
+ box->corner_radius);
} else {
renderer_ops->draw_rect(renderer,
&elem->corner,
diff --git a/plug-ins/cairo/diacairo-renderer.c b/plug-ins/cairo/diacairo-renderer.c
index 1bf5376..5702ec8 100644
--- a/plug-ins/cairo/diacairo-renderer.c
+++ b/plug-ins/cairo/diacairo-renderer.c
@@ -1062,76 +1062,6 @@ draw_image(DiaRenderer *self,
DIAG_STATE(renderer->cr);
}
-static void
-_rounded_rect (DiaRenderer *self,
- Point *topleft, Point *bottomright,
- Color *color, real radius,
- gboolean fill)
-{
- DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
- double rv[2];
-
- radius = MIN(radius, (bottomright->x - topleft->x)/2);
- radius = MIN(radius, (bottomright->y - topleft->y)/2);
-
- /* ignore radius if it is smaller than the device unit, avoids anti-aliasing artifacts */
- rv[0] = radius;
- rv[1] = 0.0;
- cairo_user_to_device_distance (renderer->cr, &rv[0], &rv[1]);
- if (rv[0] < 1.0 && rv[1] < 1.0) {
- _rect (self, topleft, bottomright, color, fill);
- return;
- }
-
- DIAG_NOTE(g_message("%s_rounded_rect %f,%f -> %f,%f, %f",
- fill ? "fill" : "draw",
- topleft->x, topleft->y, bottomright->x, bottomright->y, radius));
-
- cairo_set_source_rgba (renderer->cr, color->red, color->green, color->blue, color->alpha);
-
- cairo_new_path (renderer->cr);
- cairo_move_to (renderer->cr, /* north-west */
- topleft->x + radius, topleft->y);
-
- cairo_line_to (renderer->cr, /* north-east */
- bottomright->x - radius, topleft->y);
- cairo_arc (renderer->cr,
- bottomright->x - radius, topleft->y + radius, radius, -G_PI_2, 0);
- cairo_line_to (renderer->cr, /* south-east */
- bottomright->x, bottomright->y - radius);
- cairo_arc (renderer->cr,
- bottomright->x - radius, bottomright->y - radius, radius, 0, G_PI_2);
- cairo_line_to (renderer->cr, /* south-west */
- topleft->x + radius, bottomright->y);
- cairo_arc (renderer->cr,
- topleft->x + radius, bottomright->y - radius, radius, G_PI_2, G_PI);
- cairo_line_to (renderer->cr, /* north-west */
- topleft->x, topleft->y + radius);
- cairo_arc (renderer->cr,
- topleft->x + radius, topleft->y + radius, radius, G_PI, -G_PI_2);
- if (fill)
- _dia_cairo_fill (renderer);
- else
- cairo_stroke (renderer->cr);
- DIAG_STATE(renderer->cr)
-}
-
-static void
-draw_rounded_rect (DiaRenderer *renderer,
- Point *topleft, Point *bottomright,
- Color *color, real radius)
-{
- _rounded_rect (renderer, topleft, bottomright, color, radius, FALSE);
-}
-
-static void
-fill_rounded_rect (DiaRenderer *renderer,
- Point *topleft, Point *bottomright,
- Color *color, real radius)
-{
- _rounded_rect (renderer, topleft, bottomright, color, radius, TRUE);
-}
-
static gpointer parent_class = NULL;
static void
@@ -1257,8 +1187,6 @@ cairo_renderer_class_init (DiaCairoRendererClass *klass)
renderer_class->draw_beziergon = draw_beziergon;
/* highest level functions */
- renderer_class->draw_rounded_rect = draw_rounded_rect;
- renderer_class->fill_rounded_rect = fill_rounded_rect;
renderer_class->draw_rounded_polyline = draw_rounded_polyline;
/* other */
renderer_class->is_capable_to = is_capable_to;
diff --git a/plug-ins/drs/dia-render-script-import.c b/plug-ins/drs/dia-render-script-import.c
index d9cdcf0..c7cc079 100644
--- a/plug-ins/drs/dia-render-script-import.c
+++ b/plug-ins/drs/dia-render-script-import.c
@@ -330,10 +330,8 @@ _render_object (xmlNodePtr render, DiaContext *ctx)
Point ul = _parse_point (node, "lefttop");
Point lr = _parse_point (node, "rightbottom");
real r = _parse_real (node,"r");
- if (fill)
- ops->fill_rounded_rect (ir, &ul, &lr, fill, r);
- if (stroke)
- ops->draw_rounded_rect (ir, &ul, &lr, stroke, r);
+ if (fill || stroke)
+ ops->draw_rounded_rect (ir, &ul, &lr, fill, stroke, r);
} else if ( xmlStrcmp (node->name, (const xmlChar *)"string") == 0) {
Point pos = _parse_point (node, "pos");
Alignment align = _parse_alignment (node, "alignment");
diff --git a/plug-ins/drs/dia-render-script-renderer.c b/plug-ins/drs/dia-render-script-renderer.c
index 2dbb15a..18e2055 100644
--- a/plug-ins/drs/dia-render-script-renderer.c
+++ b/plug-ins/drs/dia-render-script-renderer.c
@@ -456,7 +456,7 @@ draw_polygon (DiaRenderer *self,
static void
_rounded_rect(DiaRenderer *self,
Point *lefttop, Point *rightbottom,
- Color *color, real *rounding, gboolean fill)
+ Color *fill, Color *stroke, real *rounding)
{
DrsRenderer *renderer = DRS_RENDERER (self);
xmlNodePtr node;
@@ -473,34 +473,24 @@ _rounded_rect(DiaRenderer *self,
if (rounding)
_node_set_real (node, "r", *rounding);
if (fill)
- _node_set_color (node, "fill", color);
- else
- _node_set_color (node, "stroke", color);
+ _node_set_color (node, "fill", fill);
+ if (stroke)
+ _node_set_color (node, "stroke", stroke);
}
static void
draw_rect(DiaRenderer *self,
Point *lefttop, Point *rightbottom,
Color *fill, Color *stroke)
{
- if (fill)
- _rounded_rect(self, lefttop, rightbottom, fill, NULL, FALSE);
- if (stroke)
- _rounded_rect(self, lefttop, rightbottom, stroke, NULL, TRUE);
+ _rounded_rect(self, lefttop, rightbottom, fill, stroke, NULL);
}
static void
draw_rounded_rect(DiaRenderer *self,
Point *lefttop, Point *rightbottom,
- Color *color, real rounding)
-{
- _rounded_rect(self, lefttop, rightbottom, color, &rounding, FALSE);
-}
-static void
-fill_rounded_rect(DiaRenderer *self,
- Point *lefttop, Point *rightbottom,
- Color *color, real rounding)
+ Color *fill, Color *stroke, real rounding)
{
- _rounded_rect(self, lefttop, rightbottom, color, &rounding, FALSE);
+ _rounded_rect(self, lefttop, rightbottom, fill, stroke, &rounding);
}
static void
@@ -733,7 +723,6 @@ drs_renderer_class_init (DrsRendererClass *klass)
renderer_class->draw_rounded_polyline = draw_rounded_polyline;
/* highest level functions */
renderer_class->draw_rounded_rect = draw_rounded_rect;
- renderer_class->fill_rounded_rect = fill_rounded_rect;
#if 0
renderer_class->draw_text = draw_text;
renderer_class->draw_text_line = draw_text_line;
diff --git a/plug-ins/pgf/render_pgf.c b/plug-ins/pgf/render_pgf.c
index 3b4d55d..6555d47 100644
--- a/plug-ins/pgf/render_pgf.c
+++ b/plug-ins/pgf/render_pgf.c
@@ -101,10 +101,7 @@ static void draw_polygon(DiaRenderer *self,
Color *fill, Color *stroke);
static void draw_rounded_rect(DiaRenderer *self,
Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
-static void fill_rounded_rect(DiaRenderer *self,
- Point *ul_corner, Point *lr_corner,
- Color *color, real radius);
+ Color *fill, Color *stroke, real radius);
static void draw_arc(DiaRenderer *self,
Point *center,
real width, real height,
@@ -251,7 +248,6 @@ pgf_renderer_class_init (PgfRendererClass *klass)
renderer_class->draw_polygon = draw_polygon;
renderer_class->draw_rounded_rect = draw_rounded_rect;
- renderer_class->fill_rounded_rect = fill_rounded_rect;
renderer_class->draw_arc = draw_arc;
renderer_class->fill_arc = fill_arc;
@@ -591,7 +587,7 @@ pgf_rect(PgfRenderer *renderer,
}
static void
-draw_rounded_rect(DiaRenderer *self,
+stroke_rounded_rect(DiaRenderer *self,
Point *ul_corner, Point *lr_corner,
Color *color, real radius)
{
@@ -619,6 +615,16 @@ fill_rounded_rect(DiaRenderer *self,
fprintf(renderer->file, "}");
}
+static void
+draw_rounded_rect(DiaRenderer *self,
+ Point *ul_corner, Point *lr_corner,
+ Color *fill, Color *stroke, real radius)
+{
+ if (fill)
+ fill_rounded_rect (self, ul_corner, lr_corner, fill, radius);
+ if (stroke)
+ stroke_rounded_rect (self, ul_corner, lr_corner, stroke, radius);
+}
static void
pgf_arc(PgfRenderer *renderer,
diff --git a/plug-ins/python/diadissect.py b/plug-ins/python/diadissect.py
index 427c451..edbd2dd 100644
--- a/plug-ins/python/diadissect.py
+++ b/plug-ins/python/diadissect.py
@@ -107,11 +107,9 @@ class DissectRenderer :
self.Warning ("%s negative width" % (fun,))
def draw_rect (self, rect, fill, stroke) :
self._rect (rect, "draw_rect")
- def draw_rounded_rect (self, rect, color, rounding) :
+ def draw_rounded_rect (self, rect, fill, stroke, rounding) :
# XXX: check rounding to be positive (smaller than half width, height?)
self._rect (rect, "draw_rect")
- def fill_rounded_rect (self, rect, color, rounding) :
- self._rect (rect, "draw_rect")
def _arc (self, center, width, height, angle1, angle2, fun) :
if width <= 0 :
self.Warning ("%s width too small" % (fun,))
diff --git a/plug-ins/python/diasvg.py b/plug-ins/python/diasvg.py
index b173cac..68c6191 100644
--- a/plug-ins/python/diasvg.py
+++ b/plug-ins/python/diasvg.py
@@ -119,14 +119,10 @@ class SvgRenderer :
self.f.write('<rect x="%.3f" y="%.3f" width="%.3f" height="%.3f" fill="%s" stroke="%s"
stroke-width="%.3f" %s/>\n' \
% ( rect.left, rect.top, rect.right - rect.left, rect.bottom -
rect.top,
self._rgb(fill), self._rgb(stroke), self.line_width,
self._stroke_style()))
- def draw_rounded_rect (self, rect, color, rounding) :
- self.f.write('<rect x="%.3f" y="%.3f" width="%.3f" height="%.3f" fill="none" stroke="%s"
stroke-width="%.3f" %s rx="%.3f" />\n' \
+ def draw_rounded_rect (self, rect, fill, stroke, rounding) :
+ self.f.write('<rect x="%.3f" y="%.3f" width="%.3f" height="%.3f" fill="%s" stroke="%s"
stroke-width="%.3f" %s rx="%.3f" />\n' \
% ( rect.left, rect.top, rect.right - rect.left, rect.bottom -
rect.top,
- self._rgb(color), self.line_width, self._stroke_style(),
rounding))
- def fill_rounded_rect (self, rect, color, rounding) :
- self.f.write('<rect x="%.3f" y="%.3f" width="%.3f" height="%.3f" fill="%s" stroke="none"
rx="%.3f" />\n' \
- % ( rect.left, rect.top, rect.right - rect.left, rect.bottom -
rect.top,
- self._rgb(color), rounding))
+ self._rgb(fill), self._rgb(stroke), self.line_width,
self._stroke_style(), rounding))
def _arc (self, center, width, height, angle1, angle2, color, fill=None) :
# not in the renderer interface
import math
diff --git a/plug-ins/python/pydia-render.c b/plug-ins/python/pydia-render.c
index b3ff2af..477dc17 100644
--- a/plug-ins/python/pydia-render.c
+++ b/plug-ins/python/pydia-render.c
@@ -681,65 +681,43 @@ draw_rect(DiaRenderer *renderer,
static void
draw_rounded_rect(DiaRenderer *renderer,
Point *ul_corner, Point *lr_corner,
- Color *colour, real rounding)
+ Color *fill, Color *stroke, real rounding)
{
PyObject *func, *res, *arg, *self = PYDIA_RENDERER (renderer);
func = PyObject_GetAttrString (self, "draw_rounded_rect");
if (func && PyCallable_Check(func)) {
PyObject *orect = PyDiaRectangle_New_FromPoints (ul_corner, lr_corner);
- PyObject *ocolor = PyDiaColor_New (colour);
+ PyObject *fill_po, *stroke_po;
Py_INCREF(self);
Py_INCREF(func);
- arg = Py_BuildValue ("(OOd)", orect, ocolor, rounding);
- if (arg) {
- res = PyEval_CallObject (func, arg);
- ON_RES(res, FALSE);
- }
- Py_XDECREF (arg);
- Py_XDECREF (ocolor);
- Py_XDECREF (orect);
- Py_DECREF(func);
- Py_DECREF(self);
- }
- else { /* member optional */
- PyErr_Clear();
- /* XXX: implementing the same fallback as DiaRenderer would do */
- DIA_RENDERER_CLASS (parent_class)->draw_rounded_rect (renderer, ul_corner, lr_corner, colour, rounding);
- }
-}
-
-
-static void
-fill_rounded_rect(DiaRenderer *renderer,
- Point *ul_corner, Point *lr_corner,
- Color *colour, real rounding)
-{
- PyObject *func, *res, *arg, *self = PYDIA_RENDERER (renderer);
-
- func = PyObject_GetAttrString (self, "fill_rounded_rect");
- if (func && PyCallable_Check(func)) {
- PyObject *orect = PyDiaRectangle_New_FromPoints (ul_corner, lr_corner);
- PyObject *ocolor = PyDiaColor_New (colour);
+ if (fill)
+ fill_po = PyDiaColor_New (fill);
+ else
+ Py_INCREF(Py_None), fill_po = Py_None;
+ if (stroke)
+ stroke_po = PyDiaColor_New (stroke);
+ else
+ Py_INCREF(Py_None), stroke_po = Py_None;
- Py_INCREF(self);
- Py_INCREF(func);
- arg = Py_BuildValue ("(OOd)", orect, ocolor, rounding);
+ arg = Py_BuildValue ("(OOOd)", orect, fill_po, stroke_po, rounding);
if (arg) {
res = PyEval_CallObject (func, arg);
ON_RES(res, FALSE);
}
Py_XDECREF (arg);
+ Py_XDECREF (fill_po);
+ Py_XDECREF (stroke_po);
Py_XDECREF (orect);
- Py_XDECREF (ocolor);
Py_DECREF(func);
Py_DECREF(self);
}
else { /* member optional */
PyErr_Clear();
- /* XXX: implementing the same fallback as DiaRenderer would do */
- DIA_RENDERER_CLASS (parent_class)->fill_rounded_rect (renderer, ul_corner, lr_corner, colour, rounding);
+ /* implementing the same fallback as DiaRenderer would do */
+ DIA_RENDERER_CLASS (parent_class)->draw_rounded_rect (renderer, ul_corner, lr_corner,
+ fill, stroke, rounding);
}
}
@@ -1256,7 +1234,6 @@ dia_py_renderer_class_init (DiaPyRendererClass *klass)
/* highest level functions */
renderer_class->draw_rounded_rect = draw_rounded_rect;
- renderer_class->fill_rounded_rect = fill_rounded_rect;
/* other */
renderer_class->is_capable_to = is_capable_to;
}
diff --git a/plug-ins/svg/render_svg.c b/plug-ins/svg/render_svg.c
index 4ed27b4..3e29f2b 100644
--- a/plug-ins/svg/render_svg.c
+++ b/plug-ins/svg/render_svg.c
@@ -103,10 +103,7 @@ static void draw_object (DiaRenderer *renderer,
DiaMatrix *matrix);
static void draw_rounded_rect (DiaRenderer *renderer,
Point *ul_corner, Point *lr_corner,
- Color *colour, real rounding);
-static void fill_rounded_rect (DiaRenderer *renderer,
- Point *ul_corner, Point *lr_corner,
- Color *colour, real rounding);
+ Color *fill, Color *stroke, real rounding);
static void draw_string (DiaRenderer *self,
const char *text,
Point *pos, Alignment alignment,
@@ -221,7 +218,6 @@ svg_renderer_class_init (SvgRendererClass *klass)
renderer_class->draw_layer = draw_layer;
renderer_class->draw_object = draw_object;
renderer_class->draw_rounded_rect = draw_rounded_rect;
- renderer_class->fill_rounded_rect = fill_rounded_rect;
renderer_class->draw_string = draw_string;
renderer_class->draw_text = draw_text;
renderer_class->draw_text_line = draw_text_line;
@@ -369,18 +365,22 @@ draw_object(DiaRenderer *self,
* \memberof SvgRenderer
*/
static void
-draw_rounded_rect(DiaRenderer *self,
- Point *ul_corner, Point *lr_corner,
- Color *colour, real rounding)
+draw_rounded_rect (DiaRenderer *self,
+ Point *ul_corner, Point *lr_corner,
+ Color *fill, Color *stroke, real rounding)
{
DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
xmlNodePtr node;
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
-
+ gchar *style;
+
node = xmlNewChild(renderer->root, NULL, (const xmlChar *)"rect", NULL);
- xmlSetProp(node, (const xmlChar *)"style",
- (const xmlChar *) DIA_SVG_RENDERER_GET_CLASS(self)->get_draw_style(renderer, colour));
+ style = g_strdup_printf ("%s;%s",
+ stroke ? DIA_SVG_RENDERER_GET_CLASS(self)->get_draw_style (renderer, stroke) :
"stroke:none",
+ fill ? DIA_SVG_RENDERER_GET_CLASS(self)->get_fill_style (renderer, fill) :
"fill:none");
+ xmlSetProp(node, (const xmlChar *)"style", (const xmlChar *)style);
+ g_free (style);
g_ascii_formatd(buf, sizeof(buf), "%g", ul_corner->x * renderer->scale);
xmlSetProp(node, (const xmlChar *)"x", (xmlChar *) buf);
@@ -395,37 +395,6 @@ draw_rounded_rect(DiaRenderer *self,
xmlSetProp(node, (const xmlChar *)"ry", (xmlChar *) buf);
}
-/*!
- * \brief creation of filled rectangles with corner radius
- * \memberof SvgRenderer
- */
-static void
-fill_rounded_rect(DiaRenderer *self,
- Point *ul_corner, Point *lr_corner,
- Color *colour, real rounding)
-{
- DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
- xmlNodePtr node;
- gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
-
- node = xmlNewChild(renderer->root, NULL, (const xmlChar *)"rect", NULL);
-
- xmlSetProp(node, (const xmlChar *)"style",
- (const xmlChar *) DIA_SVG_RENDERER_GET_CLASS(self)->get_fill_style(renderer, colour));
-
- g_ascii_formatd(buf, sizeof(buf), "%g", (ul_corner->x * renderer->scale));
- xmlSetProp(node, (const xmlChar *)"x", (xmlChar *) buf);
- g_ascii_formatd(buf, sizeof(buf), "%g", (ul_corner->y * renderer->scale));
- xmlSetProp(node, (const xmlChar *)"y", (xmlChar *) buf);
- g_ascii_formatd(buf, sizeof(buf), "%g", (lr_corner->x - ul_corner->x) * renderer->scale);
- xmlSetProp(node, (const xmlChar *)"width", (xmlChar *) buf);
- g_ascii_formatd(buf, sizeof(buf), "%g", (lr_corner->y - ul_corner->y) * renderer->scale);
- xmlSetProp(node, (const xmlChar *)"height", (xmlChar *) buf);
- g_ascii_formatd(buf, sizeof(buf),"%g", (rounding * renderer->scale));
- xmlSetProp(node, (const xmlChar *)"rx", (xmlChar *) buf);
- xmlSetProp(node, (const xmlChar *)"ry", (xmlChar *) buf);
-}
-
#define dia_svg_dtostr(buf,d) \
g_ascii_formatd(buf,sizeof(buf),"%g",(d)*renderer->scale)
diff --git a/plug-ins/wmf/wmf.cpp b/plug-ins/wmf/wmf.cpp
index 1f319d4..baa8df9 100644
--- a/plug-ins/wmf/wmf.cpp
+++ b/plug-ins/wmf/wmf.cpp
@@ -1172,45 +1172,35 @@ draw_image(DiaRenderer *self,
static void
draw_rounded_rect (DiaRenderer *self,
Point *ul_corner, Point *lr_corner,
- Color *colour, real radius)
+ Color *fill, Color *stroke, real radius)
{
WmfRenderer *renderer = WMF_RENDERER (self);
- W32::HPEN hPen;
-
DIAG_NOTE(renderer, "draw_rounded_rect %f,%f -> %f,%f %f\n",
ul_corner->x, ul_corner->y, lr_corner->x, lr_corner->y, radius);
- hPen = UsePen(renderer, colour);
-
- W32::RoundRect(renderer->hFileDC,
- SCX(ul_corner->x), SCY(ul_corner->y),
- SCX(lr_corner->x), SCY(lr_corner->y),
- SC(radius*2), SC(radius*2));
-
- DonePen(renderer, hPen);
-}
-
-static void
-fill_rounded_rect (DiaRenderer *self,
- Point *ul_corner, Point *lr_corner,
- Color *colour, real radius)
-{
- WmfRenderer *renderer = WMF_RENDERER (self);
- W32::HGDIOBJ hBrush, hBrOld;
- W32::COLORREF rgb = W32COLOR(colour);
-
- DIAG_NOTE(renderer, "fill_rounded_rect %f,%f -> %f,%f\n",
- ul_corner->x, ul_corner->y, lr_corner->x, lr_corner->y);
-
- hBrush = W32::CreateSolidBrush(rgb);
- hBrOld = W32::SelectObject(renderer->hFileDC, hBrush);
+ if (fill) {
+ W32::COLORREF rgb = W32COLOR(fill);
+ W32::HGDIOBJ hBrush = W32::CreateSolidBrush(rgb);
+ W32::HGDIOBJ hBrOld = W32::SelectObject(renderer->hFileDC, hBrush);
- draw_rounded_rect(self, ul_corner, lr_corner, NULL, radius);
+ W32::RoundRect (renderer->hFileDC,
+ SCX(ul_corner->x), SCY(ul_corner->y),
+ SCX(lr_corner->x), SCY(lr_corner->y),
+ SC(radius*2), SC(radius*2));
- W32::SelectObject(renderer->hFileDC,
- W32::GetStockObject (HOLLOW_BRUSH) );
- W32::DeleteObject(hBrush);
+ W32::SelectObject (renderer->hFileDC,
+ W32::GetStockObject (HOLLOW_BRUSH) );
+ W32::DeleteObject(hBrush);
+ }
+ if (stroke) {
+ W32::HPEN hPen = UsePen (renderer, stroke);
+ W32::RoundRect (renderer->hFileDC,
+ SCX(ul_corner->x), SCY(ul_corner->y),
+ SCX(lr_corner->x), SCY(lr_corner->y),
+ SC(radius*2), SC(radius*2));
+ DonePen(renderer, hPen);
+ }
}
/* GObject boiler plate */
@@ -1301,7 +1291,6 @@ wmf_renderer_class_init (WmfRendererClass *klass)
#endif
#ifndef HAVE_LIBEMF
renderer_class->draw_rounded_rect = draw_rounded_rect;
- renderer_class->fill_rounded_rect = fill_rounded_rect;
#endif
/* other */
renderer_class->is_capable_to = is_capable_to;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]