xref: /third_party/skia/docs/examples/Bitmap_eraseARGB.cpp (revision cb93a386)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/skia/docs/examples/
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=67277b0a1003f340473a35982533561c
5cb93a386Sopenharmony_ciREG_FIDDLE(Bitmap_eraseARGB, 256, 80, false, 0) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    SkBitmap bitmap;
8cb93a386Sopenharmony_ci    bitmap.allocPixels(SkImageInfo::MakeN32(1, 1, kPremul_SkAlphaType));
9cb93a386Sopenharmony_ci    bitmap.eraseARGB(0x7f, 0xff, 0x7f, 0x3f);
10cb93a386Sopenharmony_ci    canvas->scale(50, 50);
11cb93a386Sopenharmony_ci    canvas->drawImage(bitmap.asImage(), 0, 0);
12cb93a386Sopenharmony_ci    canvas->drawImage(bitmap.asImage(), .5f, .5f);
13cb93a386Sopenharmony_ci}
14cb93a386Sopenharmony_ci}  // END FIDDLE
15

Indexes created Thu Nov 07 10:32:03 CST 2024