blob: 9fc343e5feedb4ce2c9e8afb012990ab2d704340 [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001// 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.
Mike Kleinc0bd9f92019-04-23 12:05:21 -05003#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04004// HASH=18f6f376f771f5ffa56d5e5b2ebd20fb
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(ColorSetA, 256, 256, false, 3) {
Hal Canary87515122019-03-15 14:22:51 -04006void draw(SkCanvas* canvas) {
7 canvas->drawBitmap(source, 0, 0);
8 for (int y = 0; y < 256; y += 16) {
9 for (int x = 0; x < 256; x += 16) {
10 SkColor color = source.getColor(x + 8, y + 8);
11 SkPaint paint;
12 paint.setColor(SkColorSetA(color, x + y));
13 canvas->drawRect(SkRect::MakeXYWH(x, y, 16, 16), paint);
14 }
15 }
16}
17} // END FIDDLE