summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2017-04-19 12:10:36 +0200
committerMurray Cumming <murrayc@murrayc.com>2017-04-19 12:36:34 +0200
commit1986e068f9b1b4fc7eb30143a13e620da2af7a0e (patch)
tree29fcbd30fbecc53ad2fcdfef97e23521721708db
parentea3a5d9d39eb0bb0c26a911e42348b079404b279 (diff)
Change Cairo::SurfaceType enum to Cairo::Surface::Type.
And change this from an old-style enum to a C++11 enum class.
-rw-r--r--cairomm/enums.h151
-rw-r--r--cairomm/surface.cc4
-rw-r--r--cairomm/surface.h153
3 files changed, 154 insertions, 154 deletions
diff --git a/cairomm/enums.h b/cairomm/enums.h
index de9f546..458f7ca 100644
--- a/cairomm/enums.h
+++ b/cairomm/enums.h
@@ -155,157 +155,6 @@ typedef enum
SUBPIXEL_ORDER_VBGR = CAIRO_SUBPIXEL_ORDER_VBGR
} SubpixelOrder;
-/**
- * Cairo::SurfaceType is used to describe the type of a given surface. The
- * surface types are also known as "backends" or "surface backends" within
- * cairo.
- *
- * The surface type can be queried with Surface::get_type()
- *
- * The various Cairo::Surface functions can be used with surfaces of
- * any type, but some backends also provide type-specific functions
- * that must only be called with a surface of the appropriate
- * type.
- *
- * New entries may be added in future versions.
- *
- * @since 1.2
- **/
-typedef enum
-{
- /**
- * The surface is of type image
- */
- SURFACE_TYPE_IMAGE = CAIRO_SURFACE_TYPE_IMAGE,
-
- /**
- * The surface is of type pdf
- */
- SURFACE_TYPE_PDF = CAIRO_SURFACE_TYPE_PDF,
-
- /**
- * The surface is of type ps
- */
- SURFACE_TYPE_PS = CAIRO_SURFACE_TYPE_PS,
-
- /**
- * The surface is of type xlim
- */
- SURFACE_TYPE_XLIB = CAIRO_SURFACE_TYPE_XLIB,
-
- /**
- * The surface is of type xcb
- */
- SURFACE_TYPE_XCB = CAIRO_SURFACE_TYPE_XCB,
-
- /**
- * The surface is of type glitz
- */
- SURFACE_TYPE_GLITZ = CAIRO_SURFACE_TYPE_GLITZ,
-
- /**
- * The surface is of type quartz
- */
- SURFACE_TYPE_QUARTZ = CAIRO_SURFACE_TYPE_QUARTZ,
-
- /**
- * The surface is of type win32
- */
- SURFACE_TYPE_WIN32 = CAIRO_SURFACE_TYPE_WIN32,
-
- /**
- * The surface is of type beos
- */
- SURFACE_TYPE_BEOS = CAIRO_SURFACE_TYPE_BEOS,
-
- /**
- * The surface is of type directfb
- */
- SURFACE_TYPE_DIRECTFB = CAIRO_SURFACE_TYPE_DIRECTFB,
-
- /**
- * The surface is of type svg
- */
- SURFACE_TYPE_SVG = CAIRO_SURFACE_TYPE_SVG,
-
- /**
- * The surface is of type os2
- */
- SURFACE_TYPE_OS2 = CAIRO_SURFACE_TYPE_OS2,
-
- /**
- * The surface is a win32 printing surface
- */
- SURFACE_TYPE_WIN32_PRINTING = CAIRO_SURFACE_TYPE_WIN32_PRINTING,
-
- /**
- * The surface is of type quartz_image
- */
- SURFACE_TYPE_QUARTZ_IMAGE = CAIRO_SURFACE_TYPE_QUARTZ_IMAGE,
-
- /**
- * The surface is of type script
- * @since 1.10
- */
- SURFACE_TYPE_SCRIPT = CAIRO_SURFACE_TYPE_SCRIPT,
-
- /**
- * The surface is of type Qt
- * @since 1.10
- */
- SURFACE_TYPE_QT = CAIRO_SURFACE_TYPE_QT,
-
- /**
- * The surface is of type recording
- * @since 1.10
- */
- SURFACE_TYPE_RECORDING = CAIRO_SURFACE_TYPE_RECORDING,
-
- /**
- * The surface is a OpenVg surface
- * @since 1.10
- */
- SURFACE_TYPE_VG = CAIRO_SURFACE_TYPE_VG,
-
- /**
- * The surface is of type OpenGl
- * @since 1.10
- */
- SURFACE_TYPE_GL = CAIRO_SURFACE_TYPE_GL,
-
- /**
- * The surface is of type Direct Render Manager
- * @since 1.10
- */
- SURFACE_TYPE_DRM = CAIRO_SURFACE_TYPE_DRM,
-
- /**
- * The surface is of type script 'tee' (a multiplexing surface)
- * @since 1.10
- */
- SURFACE_TYPE_TEE = CAIRO_SURFACE_TYPE_TEE,
-
- /**
- * The surface is of type XML (for debugging)
- * @since 1.10
- */
- SURFACE_TYPE_XML = CAIRO_SURFACE_TYPE_XML,
-
- /**
- * The surface is of type Skia
- * @since 1.10
- */
- SURFACE_TYPE_SKIA = CAIRO_SURFACE_TYPE_SKIA,
-
- /**
- * The surface is of type The surface is a subsurface created with
- * Surface::create()
- * @since 1.10
- */
- SURFACE_TYPE_SUBSURFACE = CAIRO_SURFACE_TYPE_SUBSURFACE
-
-} SurfaceType;
-
/**
* Cairo::PatternType is used to describe the type of a given pattern.
diff --git a/cairomm/surface.cc b/cairomm/surface.cc
index d2fe2cb..0a6e7f9 100644
--- a/cairomm/surface.cc
+++ b/cairomm/surface.cc
@@ -177,12 +177,12 @@ void Surface::get_fallback_resolution(double& x_pixels_per_inch,
check_object_status_and_throw_exception(*this);
}
-SurfaceType Surface::get_type() const
+Surface::Type Surface::get_type() const
{
auto surface_type =
cairo_surface_get_type(const_cast<cobject*>(cobj()));
check_object_status_and_throw_exception(*this);
- return static_cast<SurfaceType>(surface_type);
+ return static_cast<Type>(surface_type);
}
Content Surface::get_content() const
diff --git a/cairomm/surface.h b/cairomm/surface.h
index a6171b1..b80c2f7 100644
--- a/cairomm/surface.h
+++ b/cairomm/surface.h
@@ -79,6 +79,157 @@ class Surface
{
public:
/**
+ * Type is used to describe the type of a given surface. The
+ * surface types are also known as "backends" or "surface backends" within
+ * cairo.
+ *
+ * The surface type can be queried with Surface::get_type()
+ *
+ * The various Cairo::Surface functions can be used with surfaces of
+ * any type, but some backends also provide type-specific functions
+ * that must only be called with a surface of the appropriate
+ * type.
+ *
+ * New entries may be added in future versions.
+ *
+ * @since 1.2
+ **/
+ enum class Type
+ {
+ /**
+ * The surface is of type image
+ */
+ IMAGE = CAIRO_SURFACE_TYPE_IMAGE,
+
+ /**
+ * The surface is of type pdf
+ */
+ PDF = CAIRO_SURFACE_TYPE_PDF,
+
+ /**
+ * The surface is of type ps
+ */
+ PS = CAIRO_SURFACE_TYPE_PS,
+
+ /**
+ * The surface is of type xlim
+ */
+ XLIB = CAIRO_SURFACE_TYPE_XLIB,
+
+ /**
+ * The surface is of type xcb
+ */
+ XCB = CAIRO_SURFACE_TYPE_XCB,
+
+ /**
+ * The surface is of type glitz
+ */
+ GLITZ = CAIRO_SURFACE_TYPE_GLITZ,
+
+ /**
+ * The surface is of type quartz
+ */
+ QUARTZ = CAIRO_SURFACE_TYPE_QUARTZ,
+
+ /**
+ * The surface is of type win32
+ */
+ WIN32 = CAIRO_SURFACE_TYPE_WIN32,
+
+ /**
+ * The surface is of type beos
+ */
+ BEOS = CAIRO_SURFACE_TYPE_BEOS,
+
+ /**
+ * The surface is of type directfb
+ */
+ DIRECTFB = CAIRO_SURFACE_TYPE_DIRECTFB,
+
+ /**
+ * The surface is of type svg
+ */
+ SVG = CAIRO_SURFACE_TYPE_SVG,
+
+ /**
+ * The surface is of type os2
+ */
+ OS2 = CAIRO_SURFACE_TYPE_OS2,
+
+ /**
+ * The surface is a win32 printing surface
+ */
+ WIN32_PRINTING = CAIRO_SURFACE_TYPE_WIN32_PRINTING,
+
+ /**
+ * The surface is of type quartz_image
+ */
+ QUARTZ_IMAGE = CAIRO_SURFACE_TYPE_QUARTZ_IMAGE,
+
+ /**
+ * The surface is of type script
+ * @since 1.10
+ */
+ SCRIPT = CAIRO_SURFACE_TYPE_SCRIPT,
+
+ /**
+ * The surface is of type Qt
+ * @since 1.10
+ */
+ QT = CAIRO_SURFACE_TYPE_QT,
+
+ /**
+ * The surface is of type recording
+ * @since 1.10
+ */
+ RECORDING = CAIRO_SURFACE_TYPE_RECORDING,
+
+ /**
+ * The surface is a OpenVg surface
+ * @since 1.10
+ */
+ VG = CAIRO_SURFACE_TYPE_VG,
+
+ /**
+ * The surface is of type OpenGl
+ * @since 1.10
+ */
+ GL = CAIRO_SURFACE_TYPE_GL,
+
+ /**
+ * The surface is of type Direct Render Manager
+ * @since 1.10
+ */
+ DRM = CAIRO_SURFACE_TYPE_DRM,
+
+ /**
+ * The surface is of type script 'tee' (a multiplexing surface)
+ * @since 1.10
+ */
+ TEE = CAIRO_SURFACE_TYPE_TEE,
+
+ /**
+ * The surface is of type XML (for debugging)
+ * @since 1.10
+ */
+ XML = CAIRO_SURFACE_TYPE_XML,
+
+ /**
+ * The surface is of type Skia
+ * @since 1.10
+ */
+ SKIA = CAIRO_SURFACE_TYPE_SKIA,
+
+ /**
+ * The surface is of type The surface is a subsurface created with
+ * Surface::create()
+ * @since 1.10
+ */
+ SUBSURFACE = CAIRO_SURFACE_TYPE_SUBSURFACE
+
+ };
+
+ /**
* Format is used to identify the memory format of
* image data.
*
@@ -323,7 +474,7 @@ public:
*/
void get_fallback_resolution(double& x_pixels_per_inch, double& y_pixels_per_inch) const;
- SurfaceType get_type() const;
+ Type get_type() const;
/**
* This function returns the content type of surface which indicates whether