skia2/docs/examples/skpaint_bitmap_shader.cpp
Mike Reed b86cd3d3f0 Use samplingoptions in imageshader
Change-Id: I7d94fe7aed702afd0626a40db201caaf7c2a7764
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342927
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-12-10 21:59:19 +00:00

16 lines
588 B
C++

// Copyright 2020 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "tools/fiddle/examples.h"
REG_FIDDLE(skpaint_bitmap_shader, 256, 256, false, 5) {
void draw(SkCanvas* canvas) {
canvas->clear(SK_ColorWHITE);
SkMatrix matrix;
matrix.setScale(0.75f, 0.75f);
matrix.preRotate(30.0f);
SkPaint paint;
paint.setShader(image->makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat,
SkSamplingOptions(), matrix));
canvas->drawPaint(paint);
}
} // END FIDDLE