Added the flags to the SkBlurMaskFilter
authorMatthew Leibowitz <mattleibow@live.com>
Sat, 4 Feb 2017 20:07:48 +0000 (14:07 -0600)
committerMatthew Leibowitz <mattleibow@live.com>
Sat, 4 Feb 2017 20:07:48 +0000 (14:07 -0600)
include/c/sk_maskfilter.h
include/c/sk_types.h
src/c/sk_enums.cpp
src/c/sk_maskfilter.cpp

index 95b1fae..cd0ca4c 100644 (file)
@@ -34,6 +34,8 @@ SK_C_API void sk_maskfilter_unref(sk_maskfilter_t*);
     @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0.
 */
 SK_C_API sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t, float sigma);
+SK_C_API sk_maskfilter_t* sk_maskfilter_new_blur_with_flags(sk_blurstyle_t, float sigma, const sk_rect_t* occluder, sk_blurmaskfilter_blurflags_t flags);
+
 
 /** Create an emboss maskfilter
     @param blurSigma    standard deviation of the Gaussian blur to apply
index f916bfd..c51194e 100644 (file)
@@ -521,6 +521,13 @@ typedef enum {
 } sk_blurstyle_t;
 
 typedef enum {
+    NONE_SK_BLUR_MASK_FILTER_BLUR_FLAGS = 0x00,
+    IGNORE_TRANSFORM_SK_BLUR_MASK_FILTER_BLUR_FLAGS = 0x01,
+    HIGHT_QUALITY_SK_BLUR_MASK_FILTER_BLUR_FLAGS = 0x02,
+    ALL_SK_BLUR_MASK_FILTER_BLUR_FLAGS = 0x03,
+} sk_blurmaskfilter_blurflags_t;
+
+typedef enum {
     CW_SK_PATH_DIRECTION,
     CCW_SK_PATH_DIRECTION,
 } sk_path_direction_t;
index 7fbcf10..8baac76 100644 (file)
@@ -8,6 +8,7 @@
 #include "sk_types_priv.h"
 #include "SkShadowMaskFilter.h"
 #include "SkBitmapScaler.h"
+#include "SkBlurMaskFilter.h"
 
 #if __cplusplus >= 199711L
 
@@ -175,6 +176,12 @@ static_assert ((int)SkBlurStyle::kSolid_SkBlurStyle    == (int)SOLID_SK_BLUR_STY
 static_assert ((int)SkBlurStyle::kOuter_SkBlurStyle    == (int)OUTER_SK_BLUR_STYLE,    ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
 static_assert ((int)SkBlurStyle::kInner_SkBlurStyle    == (int)INNER_SK_BLUR_STYLE,    ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
 
+// sk_blurmaskfilter_blurflags_t
+static_assert ((int)SkBlurMaskFilter::BlurFlags::kNone_BlurFlag               == (int)NONE_SK_BLUR_MASK_FILTER_BLUR_FLAGS,                ASSERT_MSG(SkBlurMaskFilter::BlurFlags, sk_blurmaskfilter_blurflags_t));
+static_assert ((int)SkBlurMaskFilter::BlurFlags::kIgnoreTransform_BlurFlag    == (int)IGNORE_TRANSFORM_SK_BLUR_MASK_FILTER_BLUR_FLAGS,    ASSERT_MSG(SkBlurMaskFilter::BlurFlags, sk_blurmaskfilter_blurflags_t));
+static_assert ((int)SkBlurMaskFilter::BlurFlags::kHighQuality_BlurFlag        == (int)HIGHT_QUALITY_SK_BLUR_MASK_FILTER_BLUR_FLAGS,       ASSERT_MSG(SkBlurMaskFilter::BlurFlags, sk_blurmaskfilter_blurflags_t));
+static_assert ((int)SkBlurMaskFilter::BlurFlags::kAll_BlurFlag                == (int)ALL_SK_BLUR_MASK_FILTER_BLUR_FLAGS,                 ASSERT_MSG(SkBlurMaskFilter::BlurFlags, sk_blurmaskfilter_blurflags_t));
+
 // sk_stroke_cap_t
 static_assert ((int)SkPaint::Cap::kButt_Cap     == (int)BUTT_SK_STROKE_CAP,     ASSERT_MSG(SkPaint::Cap, sk_stroke_cap_t));
 static_assert ((int)SkPaint::Cap::kRound_Cap    == (int)ROUND_SK_STROKE_CAP,    ASSERT_MSG(SkPaint::Cap, sk_stroke_cap_t));
index 23f27d4..4b9b714 100644 (file)
@@ -45,6 +45,10 @@ sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t cstyle, float sigma) {
     return ToMaskFilter(SkBlurMaskFilter::Make((SkBlurStyle)cstyle, sigma).release());
 }
 
+sk_maskfilter_t* sk_maskfilter_new_blur_with_flags(sk_blurstyle_t cstyle, float sigma, const sk_rect_t* occluder, sk_blurmaskfilter_blurflags_t flags) {
+    return ToMaskFilter(SkBlurMaskFilter::Make((SkBlurStyle)cstyle, sigma, AsRect(*occluder), (SkBlurMaskFilter::BlurFlags)flags).release());
+}
+
 sk_maskfilter_t* sk_maskfilter_new_shadow(float occluderHeight, const sk_point3_t* lightPos, float lightRadius, float ambientAlpha, float spotAlpha, sk_shadowmaskfilter_shadowflags_t flags) {
     return ToMaskFilter(SkShadowMaskFilter::Make(occluderHeight, AsPoint3(*lightPos), lightRadius, ambientAlpha, spotAlpha, (SkShadowMaskFilter::ShadowFlags)flags).release());
 }