Add support to write plot objects in SVG format - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/text.h
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2011年12月06日 22:26:34 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2011年12月06日 22:26:34 +0100
commit66988c8e83094758e55282c51f45a01933bcc0c9 (patch)
tree4a90ebd78fe31080e719c23c7f371bff9597d1f0 /agg-plot/text.h
parentc9a356e30fcd55e51bdfc303ce47921b09fab2b4 (diff)
downloadgsl-shell-66988c8e83094758e55282c51f45a01933bcc0c9.tar.gz
Add support to write plot objects in SVG format
Diffstat (limited to 'agg-plot/text.h')
-rw-r--r--agg-plot/text.h 54
1 files changed, 22 insertions, 32 deletions
diff --git a/agg-plot/text.h b/agg-plot/text.h
index 7988fda7..20f56121 100644
--- a/agg-plot/text.h
+++ b/agg-plot/text.h
@@ -16,12 +16,13 @@ namespace draw {
typedef agg::conv_stroke<vs_trans_text> vs_stroked_text;
agg::trans_affine m_matrix;
+ agg::trans_affine m_user_matrix;
vs_text m_text;
vs_trans_text m_trans;
vs_stroked_text m_stroke;
- agg::pod_vector<char> m_text_buf;
+ str m_text_buf;
double m_x, m_y;
double m_angle;
@@ -34,63 +35,52 @@ namespace draw {
public:
text(double size = 10.0, double width = 1.0):
- m_matrix(), m_text(), m_trans(m_text, m_matrix), m_stroke(m_trans),
+ m_matrix(), m_user_matrix(),
+ m_text(), m_trans(m_text, m_matrix), m_stroke(m_trans),
m_text_buf(), m_x(0.0), m_y(0.0), m_angle(0.0),
m_text_width(0.0), m_text_height(size),
m_hjustif(0.0), m_vjustif(0.0)
{
- m_text_buf.capacity(32);
- m_text_buf[0] = '0円';
-
- m_stroke.width(width + 0.5);
- m_stroke.line_cap(agg::round_cap);
- m_stroke.line_join(agg::round_join);
+ m_stroke.width(width);
m_text.size(size);
- };
+ }
- void angle(double th)
- {
+ void angle(double th) {
double c = cos(th), s = sin(th);
m_angle = th;
- m_matrix.sx = c;
- m_matrix.shx = -s;
- m_matrix.shy = s;
- m_matrix.sy = c;
- };
+ m_user_matrix.sx = c;
+ m_user_matrix.shx = -s;
+ m_user_matrix.shy = s;
+ m_user_matrix.sy = c;
+ }
double angle() const { return m_angle; };
- void set_text(const char *txt)
- {
- size_t len = strlen (txt);
- m_text_buf.capacity(len+1);
- memcpy (m_text_buf.data(), txt, len+1);
-
+ void set_text(const char *txt) {
+ str_copy_c(&m_text_buf, txt);
m_text.text(txt);
m_text_width = m_text.text_width();
- };
+ }
- const char * get_text() const
- {
- return m_text_buf.data();
- };
+ const char * get_text() const { return m_text_buf.cstr(); }
- void set_point(double x, double y)
- {
+ void set_point(double x, double y) {
m_x = x;
m_y = y;
- };
+ }
- void hjustif(double hj) { m_hjustif = hj; };
- void vjustif(double vj) { m_vjustif = vj; };
+ void hjustif(double hj) { m_hjustif = hj; }
+ void vjustif(double vj) { m_vjustif = vj; }
virtual void rewind(unsigned path_id);
virtual unsigned vertex(double* x, double* y);
virtual void apply_transform(const agg::trans_affine& m, double as);
virtual void bounding_box(double *x1, double *y1, double *x2, double *y2);
+ virtual str write_svg(int id, agg::rgba8 c);
+
vs_text& self() { return m_text; };
};
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月16日 17:09:14 +0000

AltStyle によって変換されたページ (->オリジナル) /