Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Image_colorType.cpp
Go to the documentation of this file.
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.
4// HASH=50396fad4a128f58e400ca00fe09711f
5REG_FIDDLE(Image_colorType, 256, 96, false, 4) {
6void draw(SkCanvas* canvas) {
7 const char* colors[] = { "Unknown", "Alpha_8", "RGB_565", "ARGB_4444", "RGBA_8888", "RGB_888x",
8 "BGRA_8888", "RGBA_1010102", "RGB_101010x", "Gray_8", "RGBA_F16Norm",
9 "RGBA_F16" };
11 canvas->drawImage(image, 16, 0);
12 SkFont defaultFont = SkFont(fontMgr->matchFamilyStyle(nullptr, {}));
13 canvas->drawString(colors[(int)colorType], 20, image->height() + 20, defaultFont, SkPaint());
14}
15} // END FIDDLE
SkColorType
Definition SkColorType.h:19
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
Definition SkCanvas.h:1803
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition SkCanvas.h:1528
sk_sp< SkTypeface > matchFamilyStyle(const char familyName[], const SkFontStyle &) const
SkColorType colorType() const
Definition SkImage.cpp:152
int height() const
Definition SkImage.h:291
sk_sp< SkFontMgr > fontMgr
Definition examples.cpp:32
sk_sp< SkImage > image
Definition examples.cpp:29
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60