summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@gnome.org>2006-06-28 00:26:10 +0000
committerJonathon Jongsma <jjongsma@gnome.org>2006-06-28 00:26:10 +0000
commite840c2eb1834c3407d5505f6244639d1c4b2f41f (patch)
tree5880663c8d356e543015e4b7e6aee15e81b97f92
parent96eca5da1cc418021fac9c6c497dc9dc3167d53c (diff)
2006-06-27 Jonathon Jongsma <jonathon.jongsma@gmail.com>
* cairomm/enums.h: Added enum types to support the new get_type() and SVG Version API * cairomm/fontface.cc, cairomm/fontface.h: add new get_type() API * cairomm/pattern.cc, cairomm/pattern.h: add new get_type() API * cairomm/surface.cc, cairomm/surface.h: add new get_type() API and SvgSurface::restrict_to_version() API
-rw-r--r--ChangeLog9
-rw-r--r--cairomm/enums.h31
-rw-r--r--cairomm/fontface.cc6
-rw-r--r--cairomm/fontface.h1
-rw-r--r--cairomm/pattern.cc7
-rw-r--r--cairomm/pattern.h1
-rw-r--r--cairomm/surface.cc13
-rw-r--r--cairomm/surface.h11
8 files changed, 79 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 60ed93a..ffceb1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-06-27 Jonathon Jongsma <jonathon.jongsma@gmail.com>
+
+ * cairomm/enums.h: Added enum types to support the new get_type() and SVG
+ Version API
+ * cairomm/fontface.cc, cairomm/fontface.h: add new get_type() API
+ * cairomm/pattern.cc, cairomm/pattern.h: add new get_type() API
+ * cairomm/surface.cc, cairomm/surface.h: add new get_type() API and
+ SvgSurface::restrict_to_version() API
+
2006-06-26 Jonathon Jongsma <jonathon.jongsma@gmail.com>
* cairomm/surface.cc, cairomm/surface.h: add new PsSurface and PdfSurface
diff --git a/cairomm/enums.h b/cairomm/enums.h
index 91b793c..e2023ed 100644
--- a/cairomm/enums.h
+++ b/cairomm/enums.h
@@ -163,6 +163,37 @@ typedef enum
HINT_METRICS_ON = CAIRO_HINT_METRICS_ON
} HintMetrics;
+typedef enum
+{
+ SURFACE_TYPE_IMAGE = CAIRO_SURFACE_TYPE_IMAGE,
+ SURFACE_TYPE_PDF = CAIRO_SURFACE_TYPE_PDF,
+ SURFACE_TYPE_PS = CAIRO_SURFACE_TYPE_PS,
+ SURFACE_TYPE_XLIB = CAIRO_SURFACE_TYPE_XLIB,
+ SURFACE_TYPE_XCB = CAIRO_SURFACE_TYPE_XCB,
+ SURFACE_TYPE_GLITZ = CAIRO_SURFACE_TYPE_GLITZ,
+ SURFACE_TYPE_QUARTZ = CAIRO_SURFACE_TYPE_QUARTZ,
+ SURFACE_TYPE_WIN32 = CAIRO_SURFACE_TYPE_WIN32,
+ SURFACE_TYPE_BEOS = CAIRO_SURFACE_TYPE_BEOS,
+ SURFACE_TYPE_DIRECTFB = CAIRO_SURFACE_TYPE_DIRECTFB,
+ SURFACE_TYPE_SVG = CAIRO_SURFACE_TYPE_SVG
+} SurfaceType;
+
+typedef enum
+{
+ PATTERN_TYPE_SOLID = CAIRO_PATTERN_TYPE_SOLID,
+ PATTERN_TYPE_SURFACE = CAIRO_PATTERN_TYPE_SURFACE,
+ PATTERN_TYPE_LINEAR = CAIRO_PATTERN_TYPE_LINEAR,
+ PATTERN_TYPE_RADIAL = CAIRO_PATTERN_TYPE_RADIAL
+} PatternType;
+
+typedef enum
+{
+ FONT_TYPE_TOY = CAIRO_FONT_TYPE_TOY,
+ FONT_TYPE_FT = CAIRO_FONT_TYPE_FT,
+ FONT_TYPE_WIN32 = CAIRO_FONT_TYPE_WIN32,
+ FONT_TYPE_ATSUI = CAIRO_FONT_TYPE_ATSUI
+} FontType;
+
} // namespace Cairo
#endif //__CAIROMM_ENUMS_H
diff --git a/cairomm/fontface.cc b/cairomm/fontface.cc
index d84e606..0e1642a 100644
--- a/cairomm/fontface.cc
+++ b/cairomm/fontface.cc
@@ -62,6 +62,12 @@ void FontFace::set_user_data(const cairo_user_data_key_t* key, void *user_data,
}
*/
+FontType FontFace::get_type() const
+{
+ cairo_font_type_t font_type = cairo_font_face_get_type(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return static_cast<FontType>(font_type);
+}
} //namespace Cairo
diff --git a/cairomm/fontface.h b/cairomm/fontface.h
index c59f86f..c71fe0b 100644
--- a/cairomm/fontface.h
+++ b/cairomm/fontface.h
@@ -53,6 +53,7 @@ public:
void set_user_data(const cairo_user_data_key_t *key, void *user_data, cairo_destroy_func_t destroy); //TODO: Use a sigc::slot?
*/
+ FontType get_type() const;
typedef cairo_font_face_t cobject;
inline cobject* cobj() { return m_cobject; }
diff --git a/cairomm/pattern.cc b/cairomm/pattern.cc
index 1a63daf..27638cd 100644
--- a/cairomm/pattern.cc
+++ b/cairomm/pattern.cc
@@ -64,6 +64,13 @@ void Pattern::get_matrix(cairo_matrix_t &matrix) const
check_object_status_and_throw_exception(*this);
}
+PatternType Pattern::get_type() const
+{
+ cairo_pattern_type_t pattern_type = cairo_pattern_get_type(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return static_cast<PatternType>(pattern_type);
+}
+
SolidPattern::SolidPattern(cairo_pattern_t* cobject, bool has_reference)
diff --git a/cairomm/pattern.h b/cairomm/pattern.h
index df679b6..96274a9 100644
--- a/cairomm/pattern.h
+++ b/cairomm/pattern.h
@@ -50,6 +50,7 @@ public:
void set_matrix(const cairo_matrix_t &matrix);
void get_matrix(cairo_matrix_t &matrix) const;
+ PatternType get_type() const;
typedef cairo_pattern_t cobject;
inline cobject* cobj() { return m_cobject; }
diff --git a/cairomm/surface.cc b/cairomm/surface.cc
index d68464e..111898a 100644
--- a/cairomm/surface.cc
+++ b/cairomm/surface.cc
@@ -87,6 +87,13 @@ void Surface::set_fallback_resolution(double x_pixels_per_inch, double y_pixels_
check_object_status_and_throw_exception(*this);
}
+SurfaceType Surface::get_type() const
+{
+ cairo_surface_type_t surface_type = cairo_surface_get_type(m_cobject);
+ check_object_status_and_throw_exception(*this);
+ return static_cast<SurfaceType>(surface_type);
+}
+
#ifdef CAIRO_HAS_PNG_FUNCTIONS
void Surface::write_to_png(const std::string& filename)
{
@@ -317,6 +324,12 @@ RefPtr<SvgSurface> SvgSurface::create(cairo_write_func_t write_func, void *closu
return RefPtr<SvgSurface>(new SvgSurface(cobject, true /* has reference */));
}
+void SvgSurface::restrict_to_version(SvgVersion version)
+{
+ cairo_svg_surface_restrict_to_version(m_cobject, static_cast<cairo_svg_version_t>(version));
+ check_object_status_and_throw_exception(*this);
+}
+
#endif // CAIRO_HAS_SVG_SURFACE
diff --git a/cairomm/surface.h b/cairomm/surface.h
index 83b5d77..61c1f57 100644
--- a/cairomm/surface.h
+++ b/cairomm/surface.h
@@ -148,6 +148,8 @@ public:
*/
void set_fallback_resolution(double x_pixels_per_inch, double y_pixels_per_inch);
+ SurfaceType get_type() const;
+
#ifdef CAIRO_HAS_PNG_FUNCTIONS
/** Writes the contents of surface to a new file filename as a PNG image.
@@ -512,6 +514,13 @@ public:
#ifdef CAIRO_HAS_SVG_SURFACE
+typedef enum
+{
+ SVG_VERSION_1_1 = CAIRO_SVG_VERSION_1_1,
+ SVG_VERSION_1_2 = CAIRO_SVG_VERSION_1_2,
+ SVG_VERSION_LAST = CAIRO_SVG_VERSION_LAST
+} SvgVersion;
+
/** A SvgSurface provides a way to render Scalable Vector Graphics (SVG) images
* from cairo. This surface is not rendered to the screen but instead renders
* the drawing to an SVG file on disk.
@@ -557,6 +566,8 @@ public:
*/
static RefPtr<SvgSurface> create(cairo_write_func_t write_func, void *closure, double width_in_points, double height_in_points);
+ void restrict_to_version(SvgVersion version);
+
};
#endif // CAIRO_HAS_SVG_SURFACE