Flutter Engine
The Flutter Engine
fadefilter.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm/gm.h"
13#include "include/core/SkRect.h"
16
17#include <utility>
18
19// This GM renders correctly in 8888, but fails in PDF
20DEF_SIMPLE_GM(fadefilter, canvas, 256, 256) {
21 float matrix[20] = { 1, 0, 0, 0, 0.5f,
22 0, 1, 0, 0, 0.5f,
23 0, 0, 1, 0, 0.5f,
24 0, 0, 0, 1, 0 };
26 SkPaint layerPaint;
27 layerPaint.setImageFilter(SkImageFilters::ColorFilter(std::move(colorFilter), nullptr));
28 canvas->drawRect(SkRect::MakeLTRB(64, 64, 192, 192), layerPaint);
29}
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
void setImageFilter(sk_sp< SkImageFilter > imageFilter)
DEF_SIMPLE_GM(fadefilter, canvas, 256, 256)
Definition: fadefilter.cpp:20
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646