From 0eafc9b06cbfd47e9c3471c82580790cef0fdae5 Mon Sep 17 00:00:00 2001 From: reed Date: Tue, 23 Dec 2014 14:11:11 -0800 Subject: add maskfilter to c api BUG=skia: TBR= Review URL: https://codereview.chromium.org/822053002 --- include/c/sk_maskfilter.h | 32 ++++++++++++++++++++++++++++++++ include/c/sk_paint.h | 6 ++++++ include/c/sk_types.h | 1 + 3 files changed, 39 insertions(+) create mode 100644 include/c/sk_maskfilter.h (limited to 'include/c') diff --git a/include/c/sk_maskfilter.h b/include/c/sk_maskfilter.h new file mode 100644 index 0000000000..ce38605a85 --- /dev/null +++ b/include/c/sk_maskfilter.h @@ -0,0 +1,32 @@ +/* + * Copyright 2014 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL +// DO NOT USE -- FOR INTERNAL TESTING ONLY + +#ifndef sk_maskfilter_DEFINED +#define sk_maskfilter_DEFINED + +#include "sk_types.h" + +typedef enum { + NORMAL_SK_BLUR_STYLE, //!< fuzzy inside and outside + SOLID_SK_BLUR_STYLE, //!< solid inside, fuzzy outside + OUTER_SK_BLUR_STYLE, //!< nothing inside, fuzzy outside + INNER_SK_BLUR_STYLE, //!< fuzzy inside, nothing outside +} sk_blurstyle_t; + +SK_C_PLUS_PLUS_BEGIN_GUARD + +void sk_maskfilter_ref(sk_maskfilter_t*); +void sk_maskfilter_unref(sk_maskfilter_t*); + +sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t, float sigma); + +SK_C_PLUS_PLUS_END_GUARD + +#endif diff --git a/include/c/sk_paint.h b/include/c/sk_paint.h index 92ac5d57ba..e6b5cbdb82 100644 --- a/include/c/sk_paint.h +++ b/include/c/sk_paint.h @@ -30,6 +30,12 @@ void sk_paint_set_color(sk_paint_t*, sk_color_t); */ void sk_paint_set_shader(sk_paint_t*, sk_shader_t*); +/** + * Set the paint's maskfilter to the specified parameter. This will automatically call unref() on + * any previous value, and call ref() on the new value. + */ +void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*); + SK_C_PLUS_PLUS_END_GUARD #endif diff --git a/include/c/sk_types.h b/include/c/sk_types.h index f5f4b578fc..67a29dcb5e 100644 --- a/include/c/sk_types.h +++ b/include/c/sk_types.h @@ -80,6 +80,7 @@ typedef struct { typedef struct sk_canvas_t sk_canvas_t; typedef struct sk_image_t sk_image_t; +typedef struct sk_maskfilter_t sk_maskfilter_t; typedef struct sk_paint_t sk_paint_t; typedef struct sk_picture_t sk_picture_t; typedef struct sk_picture_recorder_t sk_picture_recorder_t; -- cgit v1.2.3