Flutter Engine
The Flutter Engine
ImageInfo_MakeS32.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.
4REG_FIDDLE(ImageInfo_MakeS32, 256, 128, false, 0) {
5void draw(SkCanvas* canvas) {
6 const int width = 256;
7 const int height = 32;
9 SkColor gradColors[] = { 0xFFAA0055, 0xFF11CC88 };
10 SkPoint gradPoints[] = { { 0, 0 }, { width, 0 } };
11 SkPaint gradPaint;
12 gradPaint.setShader(SkGradientShader::MakeLinear(gradPoints, gradColors, nullptr,
13 std::size(gradColors), SkTileMode::kClamp));
16 SkCanvas offScreen(bitmap);
17 offScreen.drawRect(SkRect::MakeWH(width, height), gradPaint);
18 canvas->drawImage(bitmap.asImage(), 0, 0);
20 SkCanvas sRGBOffscreen(bitmap);
21 sRGBOffscreen.drawRect(SkRect::MakeWH(width, height), gradPaint);
22 canvas->drawImage(bitmap.asImage(), 0, 48);
23 SkBitmap noColorSpaceBitmap;
25 noColorSpaceBitmap.setPixels(bitmap.getAddr(0, 0));
26 canvas->drawImage(noColorSpaceBitmap.asImage(), 0, 96);
27}
28} // END FIDDLE
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
REG_FIDDLE(ImageInfo_MakeS32, 256, 128, false, 0)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
uint32_t SkColor
Definition: SkColor.h:37
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
sk_sp< SkImage > asImage() const
Definition: SkBitmap.cpp:645
void setPixels(void *pixels)
Definition: SkBitmap.cpp:207
bool setInfo(const SkImageInfo &imageInfo, size_t rowBytes=0)
Definition: SkBitmap.cpp:114
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
Definition: SkCanvas.h:1528
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
void setShader(sk_sp< SkShader > shader)
Definition: bitmap.py:1
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
int32_t height
int32_t width
static SkImageInfo MakeN32Premul(int width, int height)
static SkImageInfo MakeS32(int width, int height, SkAlphaType at)
static SkImageInfo MakeN32(int width, int height, SkAlphaType at)
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609