5#include "flutter/display_list/skia/dl_sk_conversions.h"
35 if (
paint.isInvertColors()) {
38 invert_filter = invert_filter->makeComposed(
color_filter);
44 auto color_source =
paint.getColorSourcePtr();
47 sk_paint.
setDither(color_source->isGradient());
59 return ToSk(stroked_paint);
65 return ToSk(non_shader_paint);
73 return reinterpret_cast<const SkColor*
>(gradient->colors());
95 source->asLinearGradient();
100 pts, ToSkColors(linear_source), linear_source->
stops(),
106 source->asRadialGradient();
110 ToSkColors(radial_source), radial_source->
stops(),
116 source->asConicalGradient();
121 ToSkColors(conical_source), conical_source->
stops(),
127 source->asSweepGradient();
131 ToSkColors(sweep_source), sweep_source->
stops(),
133 sweep_source->
start(), sweep_source->
end(), 0,
138 source->asRuntimeEffect();
141 if (!runtime_effect || !runtime_effect->skia_runtime_effect()) {
145 auto samplers = runtime_source->
samplers();
146 std::vector<sk_sp<SkShader>> sk_samplers(samplers.size());
147 for (
size_t i = 0;
i < samplers.size();
i++) {
148 auto sampler = samplers[
i];
149 if (sampler ==
nullptr) {
152 sk_samplers[
i] =
ToSk(sampler);
156 auto ref =
new std::shared_ptr<std::vector<uint8_t>>(uniform_data);
158 uniform_data->data(), uniform_data->size(),
159 [](
const void* ptr,
void* context) {
160 delete reinterpret_cast<std::shared_ptr<std::vector<uint8_t>>*>(
165 return runtime_effect->skia_runtime_effect()->makeShader(
166 sk_uniform_data, sk_samplers.data(), sk_samplers.size());
168#ifdef IMPELLER_ENABLE_3D
169 case DlColorSourceType::kScene: {
180 switch (filter->
type()) {
192 dilate_filter->
radius_y(),
nullptr);
239 switch (filter->
type()) {
266 switch (filter->
type()) {
271 blur_filter->
sigma(),
static sk_sp< SkImage > color_filter(const SkImage *image, SkColorFilter *colorFilter)
sk_sp< SkImage > asImage() const
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > SRGBToLinearGamma()
static sk_sp< SkColorFilter > LinearToSRGBGamma()
static sk_sp< SkData > MakeWithProc(const void *ptr, size_t length, ReleaseProc proc, void *ctx)
static sk_sp< SkShader > MakeTwoPointConical(const SkPoint &start, SkScalar startRadius, const SkPoint &end, SkScalar endRadius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, SkScalar startAngle, SkScalar endAngle, uint32_t flags, const SkMatrix *localMatrix)
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
sk_sp< SkImageFilter > makeWithLocalMatrix(const SkMatrix &matrix) const
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Erode(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Compose(sk_sp< SkImageFilter > outer, sk_sp< SkImageFilter > inner)
static sk_sp< SkImageFilter > MatrixTransform(const SkMatrix &matrix, const SkSamplingOptions &sampling, sk_sp< SkImageFilter > input)
static sk_sp< SkImageFilter > Dilate(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
void setStyle(Style style)
void setColor(SkColor color)
void setStrokeMiter(SkScalar miter)
void setAntiAlias(bool aa)
void setDither(bool dither)
void setImageFilter(sk_sp< SkImageFilter > imageFilter)
void setStrokeCap(Cap cap)
void setStrokeJoin(Join join)
void setMaskFilter(sk_sp< SkMaskFilter > maskFilter)
void setShader(sk_sp< SkShader > shader)
void setBlendMode(SkBlendMode mode)
void setColorFilter(sk_sp< SkColorFilter > colorFilter)
void setStrokeWidth(SkScalar width)
static sk_sp< SkVertices > MakeCopy(VertexMode mode, int vertexCount, const SkPoint positions[], const SkPoint texs[], const SkColor colors[], int indexCount, const uint16_t indices[])
virtual T type() const =0
DlTileMode tile_mode() const
DlBlurStyle style() const
const std::shared_ptr< const DlColorFilter > color_filter() const
virtual const DlBlendColorFilter * asBlend() const
virtual const DlMatrixColorFilter * asMatrix() const
std::shared_ptr< const DlImageFilter > outer() const
std::shared_ptr< const DlImageFilter > inner() const
SkScalar end_radius() const
SkPoint end_center() const
SkPoint start_center() const
SkScalar start_radius() const
SkScalar radius_y() const
SkScalar radius_x() const
SkScalar radius_y() const
SkScalar radius_x() const
DlTileMode tile_mode() const
const float * stops() const
DlImageSampling sampling() const
DlTileMode vertical_tile_mode() const
DlTileMode horizontal_tile_mode() const
sk_sp< const DlImage > image() const
virtual const DlLocalMatrixImageFilter * asLocalMatrix() const
virtual const DlColorFilterImageFilter * asColorFilter() const
virtual const DlMatrixImageFilter * asMatrix() const
virtual const DlComposeImageFilter * asCompose() const
virtual const DlBlurImageFilter * asBlur() const
virtual const DlDilateImageFilter * asDilate() const
virtual const DlErodeImageFilter * asErode() const
const SkPoint & start_point() const
const SkPoint & end_point() const
const SkMatrix & matrix() const
const std::shared_ptr< DlImageFilter > image_filter() const
virtual const DlBlurMaskFilter * asBlur() const
void get_matrix(float matrix[20]) const
const SkMatrix * matrix_ptr() const
const SkMatrix & matrix() const
DlImageSampling sampling() const
DlPaint & setDrawStyle(DlDrawStyle style)
DlPaint & setColorSource(std::shared_ptr< const DlColorSource > source)
const std::shared_ptr< std::vector< uint8_t > > uniform_data() const
const sk_sp< DlRuntimeEffect > runtime_effect() const
const std::vector< std::shared_ptr< DlColorSource > > samplers() const
Holds all of the data (both required and optional) for a DisplayList drawVertices call.
const DlColor * colors() const
DlVertexMode mode() const
const SkPoint * vertices() const
Returns a pointer to the vertex information. Should be non-null.
const uint16_t * indices() const
const SkPoint * texture_coordinates() const
#define FML_DCHECK(condition)
unsigned useCenter Optional< SkMatrix > matrix
sk_sp< const SkImage > image
SK_API sk_sp< SkShader > Color(SkColor)
SkPaint ToSk(const DlPaint &paint)
SkPaint ToStrokedSk(const DlPaint &paint)
SkPaint ToNonShaderSk(const DlPaint &paint)
@ kStroke
strokes boundary of shapes
constexpr float kInvertColorMatrix[20]
constexpr float y() const
constexpr float x() const