xref: /third_party/skia/docs/examples/Canvas_getProps.cpp
  • 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=0fbf2dedc2619bbfbf173c9e3bc1a508
5cb93a386Sopenharmony_ciREG_FIDDLE(Canvas_getProps, 256, 256, true, 0) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* ) {
7cb93a386Sopenharmony_ci    SkBitmap bitmap;
8cb93a386Sopenharmony_ci    bitmap.allocN32Pixels(1, 1);
9cb93a386Sopenharmony_ci    SkCanvas canvas(bitmap, SkSurfaceProps(0, kRGB_V_SkPixelGeometry));
10cb93a386Sopenharmony_ci    SkSurfaceProps surfaceProps(0, kUnknown_SkPixelGeometry);
11cb93a386Sopenharmony_ci    SkDebugf("isRGB:%d\n", SkPixelGeometryIsRGB(surfaceProps.pixelGeometry()));
12cb93a386Sopenharmony_ci    if (!canvas.getProps(&surfaceProps)) {
13cb93a386Sopenharmony_ci        SkDebugf("getProps failed unexpectedly.\n");
14cb93a386Sopenharmony_ci    }
15cb93a386Sopenharmony_ci    SkDebugf("isRGB:%d\n", SkPixelGeometryIsRGB(surfaceProps.pixelGeometry()));
16cb93a386Sopenharmony_ci}
17cb93a386Sopenharmony_ci}  // END FIDDLE
18

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