| Flutter Impeller |

Functions
impeller::skia_conversions Namespace Reference

## Functions
Color | ToColor (const flutter::DlColor &color)
impeller::SamplerDescriptor | ToSamplerDescriptor (const flutter::DlImageSampling options)

## Function Documentation

## ◆ ToColor()

Color impeller::skia_conversions::ToColor | ( | const flutter::DlColor & | color | ) |

Definition at line 13 of file skia_conversions.cc.

13 {
14 FML_DCHECK(color.getColorSpace() == flutter::DlColorSpace::kExtendedSRGB ||
15 color.getColorSpace() == flutter::DlColorSpace::kSRGB);
16 return {
17 static_cast<Scalar>(color.getRedF()), //
18 static_cast<Scalar>(color.getGreenF()), //
19 static_cast<Scalar>(color.getBlueF()), //
20 static_cast<Scalar>(color.getAlphaF()) //
21 };
22 }
impeller::Scalar
float Scalar
Definition: scalar.h:18

Referenced by impeller::Paint::ConvertStops(), impeller::DlAtlasGeometry::CreateBlendVertexBuffer(), impeller::DlDispatcherBase::drawColor(), impeller::DlDispatcherBase::drawShadow(), impeller::GetCPUColorFilterProc(), impeller::DlVerticesGeometry::GetPositionUVColorBuffer(), impeller::DlDispatcherBase::setColor(), impeller::FirstPassDispatcher::setColor(), impeller::testing::TEST(), and impeller::WrapWithGPUColorFilter().

## ◆ ToSamplerDescriptor()

impeller::SamplerDescriptor impeller::skia_conversions::ToSamplerDescriptor | ( | const flutter::DlImageSampling | options | ) |

Definition at line 24 of file skia_conversions.cc.

25 {
26 impeller::SamplerDescriptor desc;
27 switch (options) {
28 case flutter::DlImageSampling::kNearestNeighbor:
29 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kNearest;
30 desc.mip_filter = impeller::MipFilter::kBase;
31 desc.label = "Nearest Sampler";
32 break;
33 case flutter::DlImageSampling::kLinear:
34 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
35 desc.mip_filter = impeller::MipFilter::kBase;
36 desc.label = "Linear Sampler";
37 break;
38 case flutter::DlImageSampling::kCubic:
39 case flutter::DlImageSampling::kMipmapLinear:
40 desc.min_filter = desc.mag_filter = impeller::MinMagFilter::kLinear;
41 desc.mip_filter = impeller::MipFilter::kLinear;
42 desc.label = "Mipmap Linear Sampler";
43 break;
44 }
45 return desc;
46 }
impeller::MipFilter::kLinear
@ kLinear
Sample from the two nearest mip levels and linearly interpolate.
impeller::MipFilter::kBase
@ kBase
The texture is sampled as if it only had a single mipmap level.
impeller::MinMagFilter::kLinear
@ kLinear
impeller::MinMagFilter::kNearest
@ kNearest
Select nearest to the sample point. Most widely supported.
impeller::SamplerDescriptor
Definition: sampler_descriptor.h:14
impeller::SamplerDescriptor::mip_filter
MipFilter mip_filter
Definition: sampler_descriptor.h:17
impeller::SamplerDescriptor::mag_filter
MinMagFilter mag_filter
Definition: sampler_descriptor.h:16
impeller::SamplerDescriptor::label
std::string_view label
Definition: sampler_descriptor.h:23
impeller::SamplerDescriptor::min_filter
MinMagFilter min_filter
Definition: sampler_descriptor.h:15

References impeller::kBase, impeller::kLinear, impeller::kNearest, impeller::SamplerDescriptor::label, impeller::SamplerDescriptor::mag_filter, impeller::SamplerDescriptor::min_filter, and impeller::SamplerDescriptor::mip_filter.

Referenced by impeller::Paint::CreateContents(), impeller::DlDispatcherBase::drawAtlas(), impeller::DlDispatcherBase::drawImageRect(), impeller::Canvas::DrawVertices(), impeller::testing::TEST(), and impeller::WrapInput().