From 232c059b0bed566f7b52e5c3d02f995f3a98f545 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sat, 4 Feb 2017 14:07:48 -0600 Subject: [PATCH] Added the flags to the SkBlurMaskFilter --- include/c/sk_maskfilter.h | 2 ++ include/c/sk_types.h | 7 +++++++ src/c/sk_enums.cpp | 7 +++++++ src/c/sk_maskfilter.cpp | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/include/c/sk_maskfilter.h b/include/c/sk_maskfilter.h index 95b1fae..cd0ca4c 100644 --- a/include/c/sk_maskfilter.h +++ b/include/c/sk_maskfilter.h @@ -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 diff --git a/include/c/sk_types.h b/include/c/sk_types.h index f916bfd..c51194e 100644 --- a/include/c/sk_types.h +++ b/include/c/sk_types.h @@ -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; diff --git a/src/c/sk_enums.cpp b/src/c/sk_enums.cpp index 7fbcf10..8baac76 100644 --- a/src/c/sk_enums.cpp +++ b/src/c/sk_enums.cpp @@ -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)); diff --git a/src/c/sk_maskfilter.cpp b/src/c/sk_maskfilter.cpp index 23f27d4..4b9b714 100644 --- a/src/c/sk_maskfilter.cpp +++ b/src/c/sk_maskfilter.cpp @@ -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()); } -- 2.7.4