Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions
sksg Namespace Reference

Classes

class  BlenderEffect
 
class  BlurImageFilter
 
class  ClipEffect
 
class  Color
 
class  ColorFilter
 
class  CustomRenderNode
 
class  DashEffect
 
class  Draw
 
class  DropShadowImageFilter
 
class  EffectNode
 
class  ExternalColorFilter
 
class  ExternalImageFilter
 
class  GeometryEffect
 
class  GeometryNode
 
class  GeometryTransform
 
class  Gradient
 
class  GradientColorFilter
 
class  Group
 
class  Image
 
class  ImageFilter
 
class  ImageFilterEffect
 
class  InvalidationController
 
class  LayerEffect
 
class  LinearGradient
 
class  MaskEffect
 
class  MaskShaderEffect
 
class  Matrix
 
class  Merge
 
class  ModeColorFilter
 
class  Node
 
class  NodePriv
 
class  OffsetEffect
 
class  OpacityEffect
 
class  PaintNode
 
class  Path
 
class  Plane
 
class  RadialGradient
 
class  Rect
 
class  RenderNode
 
class  RoundEffect
 
class  RRect
 
class  Scene
 
class  Shader
 
class  ShaderEffect
 
class  ShaderPaint
 
class  Text
 
class  Transform
 
class  TransformEffect
 
class  TransformPriv
 
class  TrimEffect
 

Functions

static bool is_inverted (sksg::MaskEffect::Mode mode)
 
static bool is_luma (sksg::MaskEffect::Mode mode)
 
static SkPathOp mode_to_op (Merge::Mode mode)
 
static SkAlpha ScaleAlpha (SkAlpha alpha, float opacity)
 
static sk_sp< SkShaderLocalShader (const sk_sp< SkShader > &shader, const SkMatrix &base, const SkMatrix &ctm)
 

Function Documentation

◆ is_inverted()

static bool sksg::is_inverted ( sksg::MaskEffect::Mode  mode)
static

Definition at line 24 of file SkSGMaskEffect.cpp.

24 {
25 return static_cast<uint32_t>(mode) & 1;
26}

◆ is_luma()

static bool sksg::is_luma ( sksg::MaskEffect::Mode  mode)
static

Definition at line 28 of file SkSGMaskEffect.cpp.

28 {
29 return static_cast<uint32_t>(mode) & 2;
30}

◆ LocalShader()

static sk_sp< SkShader > sksg::LocalShader ( const sk_sp< SkShader > &  shader,
const SkMatrix base,
const SkMatrix ctm 
)
static

Definition at line 64 of file SkSGRenderNode.cpp.

66 {
67 // Mask filters / shaders are declared to operate under a specific transform, but due to the
68 // deferral mechanism, other transformations might have been pushed to the state.
69 // We want to undo these transforms (T):
70 //
71 // baseCTM x T = ctm
72 //
73 // => T = Inv(baseCTM) x ctm
74 //
75 // => Inv(T) = Inv(Inv(baseCTM) x ctm)
76 //
77 // => Inv(T) = Inv(ctm) x baseCTM
78
79 SkMatrix lm;
80 if (base != ctm && ctm.invert(&lm)) {
81 lm.preConcat(base);
82 } else {
83 lm = SkMatrix::I();
84 }
85
86 // Note: this doesn't play ball with existing shader local matrices (what we really want is
87 // SkShader::makeWithPostLocalMatrix). Probably a good signal that the whole mechanism is
88 // contrived and should be redesigned (use SkCanvas::clipShader when available, drop shader
89 // "effects" completely, etc).
90 return shader->makeWithLocalMatrix(lm);
91}
bool invert(SkMatrix *inverse) const
Definition SkMatrix.h:1206
static const SkMatrix & I()
SkMatrix & preConcat(const SkMatrix &other)
Definition SkMatrix.cpp:674
sk_sp< SkShader > makeWithLocalMatrix(const SkMatrix &) const
Definition SkShader.cpp:26

◆ mode_to_op()

static SkPathOp sksg::mode_to_op ( Merge::Mode  mode)
static

Definition at line 51 of file SkSGMerge.cpp.

51 {
52 switch (mode) {
53 case Merge::Mode::kUnion:
54 return kUnion_SkPathOp;
55 case Merge::Mode::kIntersect:
57 case Merge::Mode::kDifference:
59 case Merge::Mode::kReverseDifference:
61 case Merge::Mode::kXOR:
62 return kXOR_SkPathOp;
63 default:
64 break;
65 }
66
67 return kUnion_SkPathOp;
68}
@ kReverseDifference_SkPathOp
subtract the first path from the op path
Definition SkPathOps.h:27
@ kDifference_SkPathOp
subtract the op path from the first path
Definition SkPathOps.h:23
@ kIntersect_SkPathOp
intersect the two paths
Definition SkPathOps.h:24
@ kUnion_SkPathOp
union (inclusive-or) the two paths
Definition SkPathOps.h:25
@ kXOR_SkPathOp
exclusive-or the two paths
Definition SkPathOps.h:26

◆ ScaleAlpha()

static SkAlpha sksg::ScaleAlpha ( SkAlpha  alpha,
float  opacity 
)
static

Definition at line 60 of file SkSGRenderNode.cpp.

60 {
61 return SkToU8(sk_float_round2int(alpha * opacity));
62}
#define sk_float_round2int(x)
constexpr uint8_t SkToU8(S x)
Definition SkTo.h:22