[drgeo/goffice: 72/82] now display all lines and points styles. ditto.
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [drgeo/goffice: 72/82] now display all lines and points styles. ditto.
- Date: Sat, 13 Feb 2010 14:24:41 +0000 (UTC)
commit 751526c56f20a3e3a72e9814b93209f2faa0e7ce
Author: Jean Brefort <jean brefort normalesup org>
Date: Wed Feb 8 16:19:23 2006 +0000
now display all lines and points styles. ditto.
2006-02-08 Jean Brefort <jean brefort normalesup org>
* goffice/drgeo_cairodrawable.cc: now display all lines and points styles.
* goffice/drgeo_gpdrawable.cc: ditto.
ChangeLog | 5 ++++
goffice/drgeo_cairodrawable.cc | 42 ++++++++++++++++++++++++++++++++++++++-
goffice/drgeo_gpdrawable.cc | 40 ++++++++++++++++++++++++++++++++++++-
3 files changed, 83 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 21150e5..7bb206f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,11 @@
* configure.ac: Add "zh_HK" to ALL_LINGUAS.
+2006-02-08 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/drgeo_cairodrawable.cc: now display all lines and points styles.
+ * goffice/drgeo_gpdrawable.cc: ditto.
+
2006-02-06 Jean Brefort <jean brefort normalesup org>
* goffice/Makefile.am: add gnome print drawable files.
diff --git a/goffice/drgeo_cairodrawable.cc b/goffice/drgeo_cairodrawable.cc
index 049408d..a895365 100644
--- a/goffice/drgeo_cairodrawable.cc
+++ b/goffice/drgeo_cairodrawable.cc
@@ -25,6 +25,7 @@
#include <config.h>
#include "drgeo_cairodrawable.h"
#include <geo/couleur.h>
+#include <math.h>
static cairo_pattern_t *cairoColor[drgeoColorNumber] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
@@ -87,6 +88,9 @@ void drgeoCairoDrawable::drawPoint (drgeoStyle & style, drgeoPoint & point)
switch (style.pointShape)
{
case drgeoPointRound:
+ cairo_new_path (m_Cairo);
+ cairo_arc (m_Cairo, x, y, radius, 0, 2 * M_PI);
+ cairo_fill (m_Cairo);
break;
case drgeoPointX:
cairo_set_line_width (m_Cairo, .05);
@@ -104,10 +108,35 @@ void drgeoCairoDrawable::drawPoint (drgeoStyle & style, drgeoPoint & point)
cairo_stroke (m_Cairo);
break;
case drgeoPointRec:
+ cairo_new_path (m_Cairo);
+ cairo_move_to (m_Cairo, x - radius, y - radius);
+ cairo_line_to (m_Cairo, x + radius, y - radius);
+ cairo_line_to (m_Cairo, x + radius, y + radius);
+ cairo_line_to (m_Cairo, x - radius, y + radius);
+ cairo_close_path (m_Cairo);
+ cairo_fill (m_Cairo);
break;
case drgeoPointRoundEmpty:
+ cairo_set_line_width (m_Cairo, .025);
+ cairo_set_dash (m_Cairo, NULL, 0, 0.);
+ cairo_set_line_cap (m_Cairo, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_join (m_Cairo, CAIRO_LINE_JOIN_MITER);
+ cairo_new_path (m_Cairo);
+ cairo_arc (m_Cairo, x, y, radius, 0, 2 * M_PI);
+ cairo_stroke (m_Cairo);
break;
case drgeoPointRecEmpty:
+ cairo_set_line_width (m_Cairo, .025);
+ cairo_set_dash (m_Cairo, NULL, 0, 0.);
+ cairo_set_line_cap (m_Cairo, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_join (m_Cairo, CAIRO_LINE_JOIN_MITER);
+ cairo_new_path (m_Cairo);
+ cairo_move_to (m_Cairo, x - radius, y - radius);
+ cairo_line_to (m_Cairo, x + radius, y - radius);
+ cairo_line_to (m_Cairo, x + radius, y + radius);
+ cairo_line_to (m_Cairo, x - radius, y + radius);
+ cairo_close_path (m_Cairo);
+ cairo_stroke (m_Cairo);
break;
}
}
@@ -135,17 +164,26 @@ void drgeoCairoDrawable::drawSegment (drgeoStyle & style, drgeoPoint & start, dr
switch (style.thick)
{
case drgeoThicknessDashed:
+ {
+ double dashes[] = {.1, .1};
+ cairo_set_line_width (m_Cairo, .025);
+ cairo_set_dash (m_Cairo, dashes, 2, 0.);
+ }
+ break;
break;
case drgeoThicknessNormal:
cairo_set_line_width (m_Cairo, .025);
cairo_set_dash (m_Cairo, NULL, 0, 0.);
- cairo_set_line_cap (m_Cairo, CAIRO_LINE_CAP_ROUND);
- cairo_set_line_join (m_Cairo, CAIRO_LINE_JOIN_MITER);
break;
case drgeoThicknessLarge:
+ cairo_set_line_width (m_Cairo, .05);
+ cairo_set_dash (m_Cairo, NULL, 0, 0.);
break;
}
+ cairo_set_line_cap (m_Cairo, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_join (m_Cairo, CAIRO_LINE_JOIN_MITER);
+
// Draw the line.
cairo_new_path (m_Cairo);
cairo_move_to (m_Cairo, start.getX (), start.getY ());
diff --git a/goffice/drgeo_gpdrawable.cc b/goffice/drgeo_gpdrawable.cc
index c643182..ef499f5 100644
--- a/goffice/drgeo_gpdrawable.cc
+++ b/goffice/drgeo_gpdrawable.cc
@@ -64,6 +64,10 @@ void drgeoGPDrawable::drawPoint (drgeoStyle & style, drgeoPoint & point)
switch (style.pointShape)
{
case drgeoPointRound:
+ gnome_print_moveto (m_pc, x + radius, y);
+ gnome_print_arcto (m_pc, x, y, radius, 0., 180., 0);
+ gnome_print_arcto (m_pc, x, y, radius, 180., 360., 0);
+ gnome_print_fill (m_pc);
break;
case drgeoPointX:
gnome_print_setlinewidth (m_pc, .05);
@@ -81,10 +85,34 @@ void drgeoGPDrawable::drawPoint (drgeoStyle & style, drgeoPoint & point)
gnome_print_stroke (m_pc);
break;
case drgeoPointRec:
+ gnome_print_moveto (m_pc, x - radius, y - radius);
+ gnome_print_lineto (m_pc, x + radius, y - radius);
+ gnome_print_lineto (m_pc, x + radius, y + radius);
+ gnome_print_lineto (m_pc, x - radius, y + radius);
+ gnome_print_lineto (m_pc, x - radius, y - radius);
+ gnome_print_fill (m_pc);
break;
case drgeoPointRoundEmpty:
+ gnome_print_setlinewidth (m_pc, .025);
+ gnome_print_setdash (m_pc, 0, NULL, 0.);
+ gnome_print_setlinecap (m_pc, 1);
+ gnome_print_setlinejoin (m_pc, 1);
+ gnome_print_moveto (m_pc, x + radius, y);
+ gnome_print_arcto (m_pc, x, y, radius, 0., 180., 0);
+ gnome_print_arcto (m_pc, x, y, radius, 180., 360., 0);
+ gnome_print_stroke (m_pc);
break;
case drgeoPointRecEmpty:
+ gnome_print_setlinewidth (m_pc, .025);
+ gnome_print_setdash (m_pc, 0, NULL, 0.);
+ gnome_print_setlinecap (m_pc, 1);
+ gnome_print_setlinejoin (m_pc, 1);
+ gnome_print_moveto (m_pc, x - radius, y - radius);
+ gnome_print_lineto (m_pc, x + radius, y - radius);
+ gnome_print_lineto (m_pc, x + radius, y + radius);
+ gnome_print_lineto (m_pc, x - radius, y + radius);
+ gnome_print_lineto (m_pc, x - radius, y - radius);
+ gnome_print_stroke (m_pc);
break;
}
}
@@ -112,17 +140,25 @@ void drgeoGPDrawable::drawSegment (drgeoStyle & style, drgeoPoint & start, drgeo
switch (style.thick)
{
case drgeoThicknessDashed:
+ {
+ double dashes[] = {4.0, 2.0};
+ gnome_print_setlinewidth (m_pc, .025);
+ gnome_print_setdash (m_pc, 2, dashes, 0.);
+ }
break;
case drgeoThicknessNormal:
gnome_print_setlinewidth (m_pc, .025);
gnome_print_setdash (m_pc, 0, NULL, 0.);
- gnome_print_setlinecap (m_pc, 1);
- gnome_print_setlinejoin (m_pc, 1);
break;
case drgeoThicknessLarge:
+ gnome_print_setlinewidth (m_pc, .05);
+ gnome_print_setdash (m_pc, 0, NULL, 0.);
break;
}
+ gnome_print_setlinecap (m_pc, 1);
+ gnome_print_setlinejoin (m_pc, 1);
+
// Draw the line.
gnome_print_newpath (m_pc);
gnome_print_moveto (m_pc, start.getX (), start.getY ());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]