Index: src/c/sk_paint.cpp |
diff --git a/src/c/sk_paint.cpp b/src/c/sk_paint.cpp |
index e71285d4d5ca16924051fedc5750d28d558fc1be..330c796d7e21e4662700ddcdfa8a9c24c7542470 100644 |
--- a/src/c/sk_paint.cpp |
+++ b/src/c/sk_paint.cpp |
@@ -132,4 +132,43 @@ void sk_paint_set_stroke_join(sk_paint_t* cpaint, sk_stroke_join_t cjoin) { |
} |
} |
- |
+void sk_paint_set_xfermode_mode(sk_paint_t* paint, sk_xfermode_mode_t mode) { |
+ SkASSERT(paint); |
+ SkXfermode::Mode skmode; |
+ switch (mode) { |
+ #define MAP(X, Y) case (X): skmode = (Y); break |
+ MAP( CLEAR_SK_XFERMODE_MODE, SkXfermode::kClear_Mode ); |
+ MAP( SRC_SK_XFERMODE_MODE, SkXfermode::kSrc_Mode ); |
+ MAP( DST_SK_XFERMODE_MODE, SkXfermode::kDst_Mode ); |
+ MAP( SRCOVER_SK_XFERMODE_MODE, SkXfermode::kSrcOver_Mode ); |
+ MAP( DSTOVER_SK_XFERMODE_MODE, SkXfermode::kDstOver_Mode ); |
+ MAP( SRCIN_SK_XFERMODE_MODE, SkXfermode::kSrcIn_Mode ); |
+ MAP( DSTIN_SK_XFERMODE_MODE, SkXfermode::kDstIn_Mode ); |
+ MAP( SRCOUT_SK_XFERMODE_MODE, SkXfermode::kSrcOut_Mode ); |
+ MAP( DSTOUT_SK_XFERMODE_MODE, SkXfermode::kDstOut_Mode ); |
+ MAP( SRCATOP_SK_XFERMODE_MODE, SkXfermode::kSrcATop_Mode ); |
+ MAP( DSTATOP_SK_XFERMODE_MODE, SkXfermode::kDstATop_Mode ); |
+ MAP( XOR_SK_XFERMODE_MODE, SkXfermode::kXor_Mode ); |
+ MAP( PLUS_SK_XFERMODE_MODE, SkXfermode::kPlus_Mode ); |
+ MAP( MODULATE_SK_XFERMODE_MODE, SkXfermode::kModulate_Mode ); |
+ MAP( SCREEN_SK_XFERMODE_MODE, SkXfermode::kScreen_Mode ); |
+ MAP( OVERLAY_SK_XFERMODE_MODE, SkXfermode::kOverlay_Mode ); |
+ MAP( DARKEN_SK_XFERMODE_MODE, SkXfermode::kDarken_Mode ); |
+ MAP( LIGHTEN_SK_XFERMODE_MODE, SkXfermode::kLighten_Mode ); |
+ MAP( COLORDODGE_SK_XFERMODE_MODE, SkXfermode::kColorDodge_Mode ); |
+ MAP( COLORBURN_SK_XFERMODE_MODE, SkXfermode::kColorBurn_Mode ); |
+ MAP( HARDLIGHT_SK_XFERMODE_MODE, SkXfermode::kHardLight_Mode ); |
+ MAP( SOFTLIGHT_SK_XFERMODE_MODE, SkXfermode::kSoftLight_Mode ); |
+ MAP( DIFFERENCE_SK_XFERMODE_MODE, SkXfermode::kDifference_Mode ); |
+ MAP( EXCLUSION_SK_XFERMODE_MODE, SkXfermode::kExclusion_Mode ); |
+ MAP( MULTIPLY_SK_XFERMODE_MODE, SkXfermode::kMultiply_Mode ); |
+ MAP( HUE_SK_XFERMODE_MODE, SkXfermode::kHue_Mode ); |
+ MAP( SATURATION_SK_XFERMODE_MODE, SkXfermode::kSaturation_Mode ); |
+ MAP( COLOR_SK_XFERMODE_MODE, SkXfermode::kColor_Mode ); |
+ MAP( LUMINOSITY_SK_XFERMODE_MODE, SkXfermode::kLuminosity_Mode ); |
+ #undef MAP |
+ default: |
+ return; |
+ } |
+ AsPaint(paint)->setXfermodeMode(skmode); |
+} |