Flutter Engine
The Flutter Engine
Canvas_drawImageRect_6.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(Canvas_drawImageRect_6, 256, 64, false, 0) {
5void draw(SkCanvas* canvas) {
6 uint32_t pixels[][2] = { { 0x00000000, 0x55550000},
7 { 0xAAAA0000, 0xFFFF0000} };
9 bitmap.installPixels(SkImageInfo::MakeN32Premul(2, 2),
10 (void*) pixels, sizeof(pixels[0]));
11 sk_sp<SkImage> image = bitmap.asImage();
13 canvas->scale(4, 4);
14 for (auto color : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN } ) {
17 canvas->translate(8, 0);
18 }
19}
20} // END FIDDLE
REG_FIDDLE(Canvas_drawImageRect_6, 256, 64, false, 0)
@ kPlus
r = min(s + d, 1)
constexpr SkColor SK_ColorBLUE
Definition: SkColor.h:135
constexpr SkColor SK_ColorRED
Definition: SkColor.h:126
constexpr SkColor SK_ColorGREEN
Definition: SkColor.h:131
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
Definition: SkCanvas.cpp:2333
void scale(SkScalar sx, SkScalar sy)
Definition: SkCanvas.cpp:1289
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
const Paint & paint
Definition: color_source.cc:38
DlColor color
sk_sp< const SkImage > image
Definition: SkRecords.h:269
Definition: bitmap.py:1
SkSamplingOptions(SkFilterMode::kLinear))
static SkImageInfo MakeN32Premul(int width, int height)
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609