Flutter Engine
The Flutter Engine
Canvas_drawImageRect_5.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_5, 256, 64, false, 0) {
5void draw(SkCanvas* canvas) {
6 uint32_t pixels[][2] = { { 0x00000000, 0x55555555},
7 { 0xAAAAAAAA, 0xFFFFFFFF} };
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 } ) {
18 canvas->translate(8, 0);
19 }
20}
21} // END FIDDLE
REG_FIDDLE(Canvas_drawImageRect_5, 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
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
Definition: SkCanvas.h:1542
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