28 paint.setAntiAlias(
true);
31 for (
int i = 0; i < 20; ++i) {
35 return surface->makeImageSnapshot();
44 str.
printf(
"scale %g %g", dst.width() / img->width(), dst.height() / img->height());
54 canvas->translate(20, 20);
55 for (
size_t i = 0; i < std::size(samplings); ++i) {
56 canvas->drawImageRect(img.
get(), dst, samplings[i],
nullptr);
57 canvas->translate(0, 20);
59 canvas->drawImage(img.
get(), 20, 20);
71 for (
int y = 0;
y <
N; ++
y) {
72 for (
int x = 0;
x <
N; ++
x) {
86 while (dst.width() > 5) {
88 dst.offset(dst.width() + 10, 0);
89 dst.fRight = dst.fLeft + dst.width()/2;
90 dst.fBottom = dst.fTop + dst.height()/2;
105 canvas->translate(10, 10);
107 canvas->translate(0, limg->height() + 10.0f);
120 for (
int y = 0;
y <
N; ++
y) {
121 for (
int x = 0;
x <
N; ++
x) {
122 *bm.
getAddr8(
x,
y) =
static_cast<uint8_t
>(255.0f * ((
x +
y) / (2.0f * (
N - 1))));
135 while (dst.width() > 5) {
137 dst.offset(dst.width() + 10, 0);
138 dst.fRight = dst.fLeft + dst.width() / 2;
139 dst.fBottom = dst.fTop + dst.height() / 2;
154 canvas->translate(10, 10);
156 canvas->translate(0, limg->height() + 10.0f);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kOpaque_SkAlphaType
pixel is opaque
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kGray_8_SkColorType
pixel with grayscale level in 8-bit byte
void allocPixels(const SkImageInfo &info, size_t rowBytes)
sk_sp< SkImage > asImage() const
uint8_t * getAddr8(int x, int y) const
uint32_t * getAddr32(int x, int y) const
void translate(SkScalar dx, SkScalar dy)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
static sk_sp< SkColorSpace > MakeSRGB()
@ kStroke_Style
set to stroke geometry
void printf(const char format[],...) SK_PRINTF_LIKE(2
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
static sk_sp< SkImage > make_g8_gradient(sk_sp< SkColorSpace > cs)
static sk_sp< SkImage > make(sk_sp< SkColorSpace > cs)
static sk_sp< SkImage > make_image()
static void show_mips(SkCanvas *canvas, SkImage *img)
static void show_mips_only(SkCanvas *canvas, SkImage *img)
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
static constexpr SkCubicResampler Mitchell()
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static SkImageInfo MakeN32Premul(int width, int height)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkRect Make(const SkISize &size)
static constexpr SkRect MakeWH(float w, float h)