Flutter Impeller
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 }
float Scalar
Definition: scalar.h:19

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  {
27  switch (options) {
28  case flutter::DlImageSampling::kNearestNeighbor:
31  desc.label = "Nearest Sampler";
32  break;
33  case flutter::DlImageSampling::kLinear:
36  desc.label = "Linear Sampler";
37  break;
38  case flutter::DlImageSampling::kCubic:
39  case flutter::DlImageSampling::kMipmapLinear:
42  desc.label = "Mipmap Linear Sampler";
43  break;
44  }
45  return desc;
46 }
@ kLinear
Sample from the two nearest mip levels and linearly interpolate.
@ kBase
The texture is sampled as if it only had a single mipmap level.
@ kNearest
Select nearest to the sample point. Most widely supported.

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().