1 // Copyright 2019 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #include "tools/fiddle/examples.h"
4 // HASH=8b26507690b71462f44642b911890bbf
5 REG_FIDDLE(Dither_a, 256, 256, false, 0) {
6 void draw(SkCanvas* canvas) {
8 bm16.allocPixels(SkImageInfo::Make(32, 32, kRGB_565_SkColorType, kOpaque_SkAlphaType));
11 for (auto dither : { false, true } ) {
12 colorPaint.setDither(dither);
13 for (auto colors : { 0xFF333333, 0xFF666666, 0xFF999999, 0xFFCCCCCC } ) {
14 for (auto mask : { 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFFFFFFFF } ) {
15 colorPaint.setColor(colors & mask);
16 c16.drawRect({0, 0, 8, 4}, colorPaint);
19 c16.translate(-32, 4);
23 canvas->drawImage(bm16.asImage(), 0, 0);