new C++ class hierarchy for graphical object - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/scalable.h
diff options
context:
space:
mode:
authorfrancesco-ST <francesco.abbate@st.com>2010年07月27日 15:34:41 +0200
committerfrancesco-ST <francesco.abbate@st.com>2010年07月27日 15:34:41 +0200
commit5b7cd1356fb503390febbc21b2d535e98de7f776 (patch)
tree27a1131ef6d25892fc5aa771130a2a1144765975 /agg-plot/scalable.h
parent73378bdf0eddb1003fb3ad17e047da717b29a009 (diff)
downloadgsl-shell-5b7cd1356fb503390febbc21b2d535e98de7f776.tar.gz
new C++ class hierarchy for graphical object
Now the design of the class hierarchy is ok. The code is still not working.
Diffstat (limited to 'agg-plot/scalable.h')
-rw-r--r--agg-plot/scalable.h 70
1 files changed, 70 insertions, 0 deletions
diff --git a/agg-plot/scalable.h b/agg-plot/scalable.h
new file mode 100644
index 00000000..154a8338
--- /dev/null
+++ b/agg-plot/scalable.h
@@ -0,0 +1,70 @@
+#ifndef AGGPLOT_SCALABLE_H
+#define AGGPLOT_SCALABLE_H
+
+class vertex_source {
+public:
+ virtual void rewind(unsigned path_id) = 0;
+ virtual unsigned vertex(double* x, double* y) = 0;
+
+ virtual ~vertex_source() { };
+};
+
+class scalable_object {
+public:
+ virtual void approximation_scale(double as) = 0;
+ virtual bool dispose() = 0;
+
+ virtual ~scalable_object() { };
+};
+
+class scalable : public vertex_source, public scalable_object {
+public:
+ virtual void rewind(unsigned path_id) = 0;
+ virtual unsigned vertex(double* x, double* y) = 0;
+
+ virtual void approximation_scale(double as) = 0;
+ virtual bool dispose() = 0;
+
+ virtual ~scalable() { };
+};
+
+/* this class does work does permit to perform an AGG transformation
+ like conv_stroke, conv_dash or any other transform. This adapter
+ is mean to preserve the scalable or the window_drawable interface. */
+template<class conv_type, class base_type>
+class vs_adapter : public base_type {
+protected:
+ conv_type m_output;
+ base_type* m_source;
+
+public:
+ vs_adapter(base_type* src): m_output(*src), m_source(src)
+ {
+ };
+
+ template <class init_type>
+ vs_adapter(base_type* src, init_type& val):
+ m_output(*src, val), m_source(src)
+ {};
+
+ virtual void rewind(unsigned path_id)
+ {
+ m_output.rewind(path_id);
+ };
+
+ virtual unsigned vertex(double* x, double* y)
+ {
+ return m_output.vertex(x, y);
+ };
+
+ virtual bool dispose()
+ {
+ if (this->m_source->dispose())
+ delete this->m_source;
+ return true;
+ };
+
+ conv_type& self() { return m_output; };
+};
+
+#endif
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月18日 07:26:42 +0000

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