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=547388991687b8e10d482d8b1c82777d 5cb93a386Sopenharmony_ciREG_FIDDLE(ImageInfo_MakeA8, 256, 64, false, 0) { 6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) { 7cb93a386Sopenharmony_ci uint8_t pixels[][8] = { { 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00}, 8cb93a386Sopenharmony_ci { 0x00, 0x7f, 0xff, 0x3f, 0x3f, 0x7f, 0x3f, 0x00}, 9cb93a386Sopenharmony_ci { 0x3f, 0xff, 0x7f, 0x00, 0x7f, 0xff, 0x7f, 0x00}, 10cb93a386Sopenharmony_ci { 0x00, 0x3f, 0x00, 0x00, 0x3f, 0x7f, 0x3f, 0x00}, 11cb93a386Sopenharmony_ci { 0x3f, 0x7f, 0x7f, 0x3f, 0x00, 0x00, 0x00, 0x00}, 12cb93a386Sopenharmony_ci { 0x7f, 0xff, 0xff, 0x7f, 0x00, 0x3f, 0x7f, 0x3f}, 13cb93a386Sopenharmony_ci { 0x7f, 0xff, 0xff, 0x7f, 0x00, 0x7f, 0xff, 0x7f}, 14cb93a386Sopenharmony_ci { 0x3f, 0x7f, 0x7f, 0x3f, 0x00, 0x3f, 0x7f, 0x3f} }; 15cb93a386Sopenharmony_ci SkBitmap bitmap; 16cb93a386Sopenharmony_ci bitmap.installPixels(SkImageInfo::MakeA8(8, 8), 17cb93a386Sopenharmony_ci (void*) pixels, sizeof(pixels[0])); 18cb93a386Sopenharmony_ci SkPaint paint; 19cb93a386Sopenharmony_ci canvas->scale(4, 4); 20cb93a386Sopenharmony_ci for (auto color : { SK_ColorRED, SK_ColorBLUE, 0xFF007F00} ) { 21cb93a386Sopenharmony_ci paint.setColor(color); 22cb93a386Sopenharmony_ci canvas->drawImage(bitmap.asImage(), 0, 0, SkSamplingOptions(), &paint); 23cb93a386Sopenharmony_ci canvas->translate(12, 0); 24cb93a386Sopenharmony_ci } 25cb93a386Sopenharmony_ci} 26cb93a386Sopenharmony_ci} // END FIDDLE 27