1cb93a386Sopenharmony_ci// Copyright 2019 Google LLC. 2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. 3cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h" 4cb93a386Sopenharmony_ci// HASH=a544ee1c67c7c557a9e54d5e99f94bb6 5cb93a386Sopenharmony_ciREG_FIDDLE(Exclusion, 256, 256, false, 5) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci canvas->drawImage(image, 0, 0); 8cb93a386Sopenharmony_ci canvas->drawImage(image, 128, 0); 9cb93a386Sopenharmony_ci canvas->drawImage(image, 0, 128); 10cb93a386Sopenharmony_ci canvas->drawImage(image, 128, 128); 11cb93a386Sopenharmony_ci SkPaint paint; 12cb93a386Sopenharmony_ci paint.setBlendMode(SkBlendMode::kDstATop); 13cb93a386Sopenharmony_ci SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT }; 14cb93a386Sopenharmony_ci SkPoint vert[] = { { 0, 0 }, { 0, 256 } }; 15cb93a386Sopenharmony_ci paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas), 16cb93a386Sopenharmony_ci SkTileMode::kClamp)); 17cb93a386Sopenharmony_ci canvas->drawPaint(paint); 18cb93a386Sopenharmony_ci canvas->clipRect( { 30, 30, 226, 226 } ); 19cb93a386Sopenharmony_ci canvas->drawColor(0x80bb9977, SkBlendMode::kExclusion); 20cb93a386Sopenharmony_ci} 21cb93a386Sopenharmony_ci} // END FIDDLE 22