1cb93a386Sopenharmony_ci// Copyright 2020 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_ciREG_FIDDLE(blurbug, 256, 256, false, 0) { 5cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 6cb93a386Sopenharmony_ci uint8_t pixels[][8] = {{0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00}, 7cb93a386Sopenharmony_ci {0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00}, 8cb93a386Sopenharmony_ci {0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00}, 9cb93a386Sopenharmony_ci {0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF}, 10cb93a386Sopenharmony_ci {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 11cb93a386Sopenharmony_ci {0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00}, 12cb93a386Sopenharmony_ci {0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00}, 13cb93a386Sopenharmony_ci {0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00}}; 14cb93a386Sopenharmony_ci SkBitmap bitmap; 15cb93a386Sopenharmony_ci bitmap.installPixels(SkImageInfo::MakeA8(8, 8), (void*)pixels, sizeof(pixels[0])); 16cb93a386Sopenharmony_ci SkPaint paint; 17cb93a386Sopenharmony_ci paint.setMaskFilter(SkMaskFilter::MakeBlur(kSolid_SkBlurStyle, 3)); 18cb93a386Sopenharmony_ci for (auto color : {SK_ColorRED, SK_ColorBLUE, 0xFF007F00}) { 19cb93a386Sopenharmony_ci paint.setColor(color); 20cb93a386Sopenharmony_ci canvas->drawImageRect(bitmap.asImage(), SkRect::MakeWH(8, 8), SkRect::MakeWH(32, 32), 21cb93a386Sopenharmony_ci SkSamplingOptions(), &paint, 22cb93a386Sopenharmony_ci SkCanvas::kStrict_SrcRectConstraint); 23cb93a386Sopenharmony_ci canvas->translate(48, 0); 24cb93a386Sopenharmony_ci } 25cb93a386Sopenharmony_ci} 26cb93a386Sopenharmony_ci} // END FIDDLE 27