diff options
author | Murray Cumming <murrayc@murrayc.com> | 2017-04-19 12:00:19 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2017-04-19 12:36:08 +0200 |
commit | 2adabd4e5712f2574b0e2396504114961bbf3a17 (patch) | |
tree | 04a8cdc5a0ca9cacdf84fb9ade116af8064a03ec | |
parent | b02bb4b589281e70d111581205950c8a2037640d (diff) |
Change Cairo::Filter enum to Cairo::SurfacePattern::Filter.
And change this from an old-style enum to a C++11 enum class.
-rw-r--r-- | cairomm/enums.h | 79 | ||||
-rw-r--r-- | cairomm/pattern.cc | 2 | ||||
-rw-r--r-- | cairomm/pattern.h | 41 |
3 files changed, 42 insertions, 80 deletions
diff --git a/cairomm/enums.h b/cairomm/enums.h index 8acaa84..821fd56 100644 --- a/cairomm/enums.h +++ b/cairomm/enums.h @@ -122,85 +122,6 @@ typedef enum CONTENT_COLOR_ALPHA = CAIRO_CONTENT_COLOR_ALPHA } Content; - -/** - * Cairo::Extend is used to describe how pattern color/alpha will be determined - * for areas "outside" the pattern's natural area, (for example, outside the - * surface bounds or outside the gradient geometry). - * - * Mesh patterns are not affected by the extend mode. - * - * The default extend mode is Cairo::EXTEND_NONE for surface patterns and - * Cairo::EXTEND_PAD for gradient patterns. - * - * New entries may be added in future versions. - **/ -typedef enum -{ - /** - * Pixels outside of the source pattern are fully transparent - */ - EXTEND_NONE = CAIRO_EXTEND_NONE, - - /** - * The pattern is tiled by repeating - */ - EXTEND_REPEAT = CAIRO_EXTEND_REPEAT, - - /** - * The pattern is tiled by reflecting at the edges (Implemented for surface - * patterns since 1.6) - */ - EXTEND_REFLECT = CAIRO_EXTEND_REFLECT, - - /** - * Pixels outside of the pattern copy the closest pixel from the source - * (Since 1.2; but only implemented for surface patterns since 1.6) - */ - EXTEND_PAD = CAIRO_EXTEND_PAD -} Extend; - -/** - * Cairo::Filter is used to indicate what filtering should be applied when - * reading pixel values from patterns. See Cairo::SurfacePattern::set_filter() - * for indicating the desired filter to be used with a particular pattern. - */ -typedef enum -{ - /** - * A high-performance filter, with quality similar to Cairo::FILTER_NEAREST - */ - FILTER_FAST = CAIRO_FILTER_FAST, - - /** - * A reasonable-performance filter, with quality similar to - * Cairo::FILTER_BILINEAR - */ - FILTER_GOOD = CAIRO_FILTER_GOOD, - - /** - * The highest-quality available, performance may not be suitable for - * interactive use. - */ - FILTER_BEST = CAIRO_FILTER_BEST, - - /** - * Nearest-neighbor filtering - */ - FILTER_NEAREST = CAIRO_FILTER_NEAREST, - - /** - * Linear interpolation in two dimensions - */ - FILTER_BILINEAR = CAIRO_FILTER_BILINEAR, - - /** - * This filter value is currently unimplemented, and should not be used in - * current code. - */ - FILTER_GAUSSIAN = CAIRO_FILTER_GAUSSIAN -} Filter; - /** * The subpixel order specifies the order of color elements within each pixel on * the display device when rendering with an antialiasing mode of diff --git a/cairomm/pattern.cc b/cairomm/pattern.cc index 48a3ba4..b3a7031 100644 --- a/cairomm/pattern.cc +++ b/cairomm/pattern.cc @@ -167,7 +167,7 @@ void SurfacePattern::set_filter(Filter filter) check_object_status_and_throw_exception(*this); } -Filter SurfacePattern::get_filter() const +SurfacePattern::Filter SurfacePattern::get_filter() const { auto result = static_cast<Filter>(cairo_pattern_get_filter(m_cobject)); check_object_status_and_throw_exception(*this); diff --git a/cairomm/pattern.h b/cairomm/pattern.h index 5e731c2..46d07a8 100644 --- a/cairomm/pattern.h +++ b/cairomm/pattern.h @@ -248,6 +248,47 @@ protected: public: + /** + * Filter is used to indicate what filtering should be applied when + * reading pixel values from patterns. See Cairo::SurfacePattern::set_filter() + * for indicating the desired filter to be used with a particular pattern. + */ + enum class Filter + { + /** + * A high-performance filter, with quality similar to Cairo::Patern::Filter::NEAREST + */ + FAST = CAIRO_FILTER_FAST, + + /** + * A reasonable-performance filter, with quality similar to + * Cairo::BILINEAR + */ + GOOD = CAIRO_FILTER_GOOD, + + /** + * The highest-quality available, performance may not be suitable for + * interactive use. + */ + BEST = CAIRO_FILTER_BEST, + + /** + * Nearest-neighbor filtering + */ + NEAREST = CAIRO_FILTER_NEAREST, + + /** + * Linear interpolation in two dimensions + */ + BILINEAR = CAIRO_FILTER_BILINEAR, + + /** + * This filter value is currently unimplemented, and should not be used in + * current code. + */ + GAUSSIAN = CAIRO_FILTER_GAUSSIAN + }; + /** Create a C++ wrapper for the C instance. This C++ instance should then be given to a RefPtr. * @param cobject The C instance. * @param has_reference Whether we already have a reference. Otherwise, the constructor will take an extra reference. |