[cairo-commit] cairomm/cairomm context.cc, 1.9, 1.10 context.h, 1.10, 1.11 enums.h, 1.4, 1.5 fontoptions.cc, 1.4, 1.5 fontoptions.h, 1.4, 1.5 pattern.cc, 1.5, 1.6 pattern.h, 1.6, 1.7 surface.h, 1.8, 1.9

Jonathon Jongsma commit at pdx.freedesktop.org
Tue Feb 28 18:23:45 PST 2006


Committed by: jjongsma

Update of /cvs/cairo/cairomm/cairomm
In directory kemper:/tmp/cvs-serv31336/cairomm

Modified Files:
	context.cc context.h enums.h fontoptions.cc fontoptions.h 
	pattern.cc pattern.h surface.h 
Log Message:
2006-02-28  Jonathon Jongsma  <jonathon.jongsma at gmail.com>

	* cairomm/context.cc:
	* cairomm/context.h:
	* cairomm/enums.h:
	* cairomm/fontoptions.cc:
	* cairomm/fontoptions.h:
	* cairomm/pattern.cc:
	* cairomm/pattern.h:
	* cairomm/surface.h: wrapped all of the enum types with cairomm
	types within the Cairo namespace, so now (for example) the values for
	Cairo::Format are something like Cairo::FORMAT_ARGB32 instead of the base
	cairo types like CAIRO_FORMAT_ARGB_32.
	* examples/png_file/main.cc: fixed example to work with the new namespaced
	enum types


Index: context.cc
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/context.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- context.cc	21 Feb 2006 05:21:02 -0000	1.9
+++ context.cc	1 Mar 2006 02:23:43 -0000	1.10
@@ -74,7 +74,7 @@
 
 void Context::set_operator(Operator op)
 {
-  cairo_set_operator(m_cobject, (cairo_operator_t)op);
+  cairo_set_operator(m_cobject, static_cast<cairo_operator_t>(op));
   check_object_status_and_throw_exception(*this);
 }
 
@@ -111,13 +111,13 @@
 
 void Context::set_antialias(Antialias antialias)
 {
-  cairo_set_antialias(m_cobject, (cairo_antialias_t)antialias);
+  cairo_set_antialias(m_cobject, static_cast<cairo_antialias_t>(antialias));
   check_object_status_and_throw_exception(*this);
 }
 
 void Context::set_fill_rule(FillRule fill_rule)
 {
-  cairo_set_fill_rule(m_cobject, (cairo_fill_rule_t)fill_rule);
+  cairo_set_fill_rule(m_cobject, static_cast<cairo_fill_rule_t>(fill_rule));
   check_object_status_and_throw_exception(*this);
 }
 
@@ -129,13 +129,13 @@
 
 void Context::set_line_cap(LineCap line_cap)
 {
-  cairo_set_line_cap(m_cobject, (cairo_line_cap_t)line_cap);
+  cairo_set_line_cap(m_cobject, static_cast<cairo_line_cap_t>(line_cap));
   check_object_status_and_throw_exception(*this);
 }
 
 void Context::set_line_join(LineJoin line_join)
 {
-  cairo_set_line_join(m_cobject, (cairo_line_join_t)line_join);
+  cairo_set_line_join(m_cobject, static_cast<cairo_line_join_t>(line_join));
   check_object_status_and_throw_exception(*this);
 }
 
@@ -395,7 +395,9 @@
 
 void Context::select_font_face(const std::string& family, FontSlant slant, FontWeight weight)
 {
-  cairo_select_font_face (m_cobject, family.c_str(), (cairo_font_slant_t)slant, (cairo_font_weight_t)weight);
+  cairo_select_font_face (m_cobject, family.c_str(),
+          static_cast<cairo_font_slant_t>(slant),
+          static_cast<cairo_font_weight_t>(weight));
   check_object_status_and_throw_exception(*this);
 }
 
@@ -487,7 +489,7 @@
 
 Operator Context::get_operator() const
 {
-  const Operator result = cairo_get_operator(m_cobject);
+  const Operator result = static_cast<Operator>(cairo_get_operator(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }
@@ -515,7 +517,7 @@
 
 Antialias Context::get_antialias() const
 {
-  const Antialias result = cairo_get_antialias(m_cobject);
+  const Antialias result = static_cast<Antialias>(cairo_get_antialias(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }
@@ -528,7 +530,7 @@
 
 FillRule Context::get_fill_rule() const
 {
-  const FillRule result = cairo_get_fill_rule(m_cobject);
+  const FillRule result = static_cast<FillRule>(cairo_get_fill_rule(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }
@@ -542,14 +544,14 @@
 
 LineCap Context::get_line_cap() const
 {
-  const LineCap result = cairo_get_line_cap(m_cobject);
+  const LineCap result = static_cast<LineCap>(cairo_get_line_cap(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }
 
 LineJoin Context::get_line_join() const
 {
-  const LineJoin result = cairo_get_line_join(m_cobject);
+  const LineJoin result = static_cast<LineJoin>(cairo_get_line_join(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }

Index: context.h
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/context.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- context.h	21 Feb 2006 05:21:02 -0000	1.10
+++ context.h	1 Mar 2006 02:23:43 -0000	1.11
@@ -31,13 +31,6 @@
 namespace Cairo
 {
 
-typedef cairo_operator_t Operator;
-typedef cairo_fill_rule_t FillRule;
-typedef cairo_line_cap_t LineCap;
-typedef cairo_line_join_t LineJoin;
-typedef cairo_font_slant_t FontSlant;
-typedef cairo_font_weight_t FontWeight;
-
 typedef cairo_glyph_t Glyph; //A simple struct.
 typedef cairo_font_extents_t FontExtents; //A simple struct.
 typedef cairo_text_extents_t TextExtents; //A simple struct.

Index: enums.h
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/enums.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- enums.h	21 Feb 2006 05:21:02 -0000	1.4
+++ enums.h	1 Mar 2006 02:23:43 -0000	1.5
@@ -29,6 +29,137 @@
 typedef cairo_status_t ErrorStatus;
 #endif //DOXYGEN_IGNORE_THIS
 
+
+typedef enum
+{
+    OPERATOR_CLEAR = CAIRO_OPERATOR_CLEAR,
+
+    OPERATOR_SOURCE = CAIRO_OPERATOR_SOURCE,
+    OPERATOR_OVER = CAIRO_OPERATOR_OVER,
+    OPERATOR_IN = CAIRO_OPERATOR_IN,
+    OPERATOR_OUT = CAIRO_OPERATOR_OUT,
+    OPERATOR_ATOP = CAIRO_OPERATOR_ATOP,
+
+    OPERATOR_DEST = CAIRO_OPERATOR_DEST,
+    OPERATOR_DEST_OVER = CAIRO_OPERATOR_DEST_OVER,
+    OPERATOR_DEST_IN = CAIRO_OPERATOR_DEST_IN,
+    OPERATOR_DEST_OUT = CAIRO_OPERATOR_DEST_OUT,
+    OPERATOR_DEST_ATOP = CAIRO_OPERATOR_DEST_ATOP,
+
+    OPERATOR_XOR = CAIRO_OPERATOR_XOR,
+    OPERATOR_ADD = CAIRO_OPERATOR_ADD,
+    OPERATOR_SATURATE = CAIRO_OPERATOR_SATURATE
+} Operator;
+
+
+typedef enum
+{
+    ANTIALIAS_DEFAULT = CAIRO_ANTIALIAS_DEFAULT,
+    ANTIALIAS_NONE = CAIRO_ANTIALIAS_NONE,
+    ANTIALIAS_GRAY = CAIRO_ANTIALIAS_GRAY,
+    ANTIALIAS_SUBPIXEL = CAIRO_ANTIALIAS_SUBPIXEL
+} Antialias;
+
+typedef enum
+{
+    FILL_RULE_WINDING = CAIRO_FILL_RULE_WINDING,
+    FILL_RULE_EVEN_ODD = CAIRO_FILL_RULE_EVEN_ODD
+} FillRule;
+
+
+typedef enum
+{
+    LINE_CAP_BUTT = CAIRO_LINE_CAP_BUTT,
+    LINE_CAP_ROUND = CAIRO_LINE_CAP_ROUND,
+    LINE_CAP_SQUARE = CAIRO_LINE_CAP_SQUARE
+} LineCap;
+
+
+typedef enum
+{
+    LINE_JOIN_MITER = CAIRO_LINE_JOIN_MITER,
+    LINE_JOIN_ROUND = CAIRO_LINE_JOIN_ROUND,
+    LINE_JOIN_BEVEL = CAIRO_LINE_JOIN_BEVEL
+} LineJoin;
+
+
+typedef enum
+{
+  FONT_SLANT_NORMAL = CAIRO_FONT_SLANT_NORMAL,
+  FONT_SLANT_ITALIC = CAIRO_FONT_SLANT_ITALIC,
+  FONT_SLANT_OBLIQUE = CAIRO_FONT_SLANT_OBLIQUE
+} FontSlant;
+
+typedef enum
+{
+  FONT_WEIGHT_NORMAL = CAIRO_FONT_WEIGHT_NORMAL,
+  FONT_WEIGHT_BOLD = CAIRO_FONT_WEIGHT_BOLD
+} FontWeight;
+
+
+typedef enum
+{
+    CONTENT_COLOR = CAIRO_CONTENT_COLOR,
+    CONTENT_ALPHA = CAIRO_CONTENT_ALPHA,
+    CONTENT_COLOR_ALPHA = CAIRO_CONTENT_COLOR_ALPHA
+} Content;
+
+
+typedef enum
+{
+    FORMAT_ARGB32 = CAIRO_FORMAT_ARGB32,
+    FORMAT_RGB24 = CAIRO_FORMAT_RGB24,
+    FORMAT_A8 = CAIRO_FORMAT_A8,
+    FORMAT_A1 = CAIRO_FORMAT_A1
+} Format;
+
+
+typedef enum
+{
+    EXTEND_NONE = CAIRO_EXTEND_NONE,
+    EXTEND_REPEAT = CAIRO_EXTEND_REPEAT,
+    EXTEND_REFLECT = CAIRO_EXTEND_REFLECT,
+    EXTEND_PAD = CAIRO_EXTEND_PAD
+} Extend;
+
+
+typedef enum
+{
+    FILTER_FAST = CAIRO_FILTER_FAST,
+    FILTER_GOOD = CAIRO_FILTER_GOOD,
+    FILTER_BEST = CAIRO_FILTER_BEST,
+    FILTER_NEAREST = CAIRO_FILTER_NEAREST,
+    FILTER_BILINEAR = CAIRO_FILTER_BILINEAR,
+    FILTER_GAUSSIAN = CAIRO_FILTER_GAUSSIAN
+} Filter;
+
+typedef enum
+{
+    SUBPIXEL_ORDER_DEFAULT = CAIRO_SUBPIXEL_ORDER_DEFAULT,
+    SUBPIXEL_ORDER_RGB = CAIRO_SUBPIXEL_ORDER_RGB,
+    SUBPIXEL_ORDER_BGR = CAIRO_SUBPIXEL_ORDER_BGR,
+    SUBPIXEL_ORDER_VRGB = CAIRO_SUBPIXEL_ORDER_VRGB,
+    SUBPIXEL_ORDER_VBGR = CAIRO_SUBPIXEL_ORDER_VBGR
+} SubpixelOrder;
+
+
+typedef enum
+{
+    HINT_STYLE_DEFAULT = CAIRO_HINT_STYLE_DEFAULT,
+    HINT_STYLE_NONE = CAIRO_HINT_STYLE_NONE,
+    HINT_STYLE_SLIGHT = CAIRO_HINT_STYLE_SLIGHT,
+    HINT_STYLE_MEDIUM = CAIRO_HINT_STYLE_MEDIUM,
+    HINT_STYLE_FULL = CAIRO_HINT_STYLE_FULL
+} HintStyle;
+
+
+typedef enum
+{
+    HINT_METRICS_DEFAULT = CAIRO_HINT_METRICS_DEFAULT,
+    HINT_METRICS_OFF = CAIRO_HINT_METRICS_OFF,
+    HINT_METRICS_ON = CAIRO_HINT_METRICS_ON
+} HintMetrics;
+
 } // namespace Cairo
 
 #endif //__CAIROMM_ENUMS_H

Index: fontoptions.cc
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/fontoptions.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- fontoptions.cc	21 Feb 2006 05:21:02 -0000	1.4
+++ fontoptions.cc	1 Mar 2006 02:23:43 -0000	1.5
@@ -102,52 +102,54 @@
 
 void FontOptions::set_antialias(Antialias antialias)
 {
-  cairo_font_options_set_antialias(m_cobject, (cairo_antialias_t)antialias);
+  cairo_font_options_set_antialias(m_cobject, static_cast<cairo_antialias_t>(antialias));
   check_object_status_and_throw_exception(*this);
 }
 
 Antialias FontOptions::get_antialias() const
 {
-  const Antialias result = cairo_font_options_get_antialias(m_cobject);
+  const Antialias result = static_cast<Antialias>(cairo_font_options_get_antialias(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }
 
 void FontOptions::set_subpixel_order(SubpixelOrder subpixel_order)
 {
-  cairo_font_options_set_subpixel_order(m_cobject, (cairo_subpixel_order_t)subpixel_order);
+  cairo_font_options_set_subpixel_order(m_cobject, static_cast<cairo_subpixel_order_t>(subpixel_order));
   check_object_status_and_throw_exception(*this);
 }
 
 SubpixelOrder FontOptions::get_subpixel_order() const
 {
-  const SubpixelOrder result = cairo_font_options_get_subpixel_order(m_cobject);
+  const SubpixelOrder result = static_cast<SubpixelOrder>(cairo_font_options_get_subpixel_order(m_cobject));
   check_object_status_and_throw_exception(*this); 
   return result;
 }
 
 void FontOptions::set_hint_style(HintStyle hint_style)
 {
-  cairo_font_options_set_hint_style(m_cobject, (cairo_hint_style_t)hint_style);
+  cairo_font_options_set_hint_style(m_cobject, static_cast<cairo_hint_style_t>(hint_style));
   check_object_status_and_throw_exception(*this);
 }
 
 HintStyle FontOptions::get_hint_style() const
 {
-  const HintStyle result = cairo_font_options_get_hint_style(m_cobject);
+  const HintStyle result = static_cast<HintStyle>(cairo_font_options_get_hint_style(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }
 
 void FontOptions::set_hint_metrics(HintMetrics hint_metrics)
 {
-  cairo_font_options_set_hint_metrics(m_cobject, (cairo_hint_metrics_t)hint_metrics);
+  cairo_font_options_set_hint_metrics(m_cobject,
+          static_cast<cairo_hint_metrics_t>(hint_metrics));
   check_object_status_and_throw_exception(*this);
 }
 
 HintMetrics FontOptions::get_hint_metrics() const
 {
-  const HintMetrics result = cairo_font_options_get_hint_metrics(m_cobject);
+  const HintMetrics result =
+      static_cast<HintMetrics>(cairo_font_options_get_hint_metrics(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }

Index: fontoptions.h
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/fontoptions.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- fontoptions.h	21 Feb 2006 05:21:02 -0000	1.4
+++ fontoptions.h	1 Mar 2006 02:23:43 -0000	1.5
@@ -27,11 +27,6 @@
 namespace Cairo
 {
 
-typedef cairo_antialias_t Antialias;
-typedef cairo_subpixel_order_t SubpixelOrder;
-typedef cairo_hint_style_t HintStyle;
-typedef cairo_hint_metrics_t HintMetrics;
-
 /** How a font should be rendered.
  */
 class FontOptions

Index: pattern.cc
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/pattern.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pattern.cc	21 Feb 2006 05:21:02 -0000	1.5
+++ pattern.cc	1 Mar 2006 02:23:43 -0000	1.6
@@ -118,7 +118,7 @@
 
 Extend SurfacePattern::get_extend() const
 {
-  const Extend result = cairo_pattern_get_extend(m_cobject);
+  const Extend result = static_cast<Extend>(cairo_pattern_get_extend(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }
@@ -131,7 +131,7 @@
 
 Filter SurfacePattern::get_filter() const
 {
-  Filter result = cairo_pattern_get_filter(m_cobject);
+  Filter result = static_cast<Filter>(cairo_pattern_get_filter(m_cobject));
   check_object_status_and_throw_exception(*this);
   return result;
 }

Index: pattern.h
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/pattern.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pattern.h	21 Feb 2006 05:21:02 -0000	1.6
+++ pattern.h	1 Mar 2006 02:23:43 -0000	1.7
@@ -27,9 +27,6 @@
 namespace Cairo
 {
 
-typedef cairo_extend_t Extend;
-typedef cairo_filter_t Filter;
-
 /**
  * This is a reference-counted object. The copy constructor creates a second reference to the object, instead 
  * of creating an independent copy of the object.

Index: surface.h
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/surface.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- surface.h	21 Feb 2006 05:21:02 -0000	1.8
+++ surface.h	1 Mar 2006 02:23:43 -0000	1.9
@@ -46,9 +46,6 @@
 namespace Cairo
 {
 
-typedef cairo_content_t Content;
-typedef cairo_format_t Format;
-
 /** A cairo surface represents an image, either as the destination of a drawing
  * operation or as source when drawing onto another surface. There are
  * different subtypes of cairo surface for different drawing backends.  This



More information about the cairo-commit mailing list