Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Unified Diff: src/c/sk_paint.cpp

Issue 1242403005: C API: add sk_xfermode.h, impl, test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: consistant behaviour Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/c/sk_types.h ('k') | tests/CTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « include/c/sk_types.h ('k') | tests/CTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698