Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Typedefs | Functions
SkShadowTessellator Namespace Reference

Typedefs

typedef std::function< SkScalar(SkScalar, SkScalar)> HeightFunc
 

Functions

sk_sp< SkVerticesMakeAmbient (const SkPath &path, const SkMatrix &ctm, const SkPoint3 &zPlane, bool transparent)
 
sk_sp< SkVerticesMakeSpot (const SkPath &path, const SkMatrix &ctm, const SkPoint3 &zPlane, const SkPoint3 &lightPos, SkScalar lightRadius, bool transparent, bool directional)
 

Typedef Documentation

◆ HeightFunc

Definition at line 25 of file SkShadowTessellator.h.

Function Documentation

◆ MakeAmbient()

sk_sp< SkVertices > SkShadowTessellator::MakeAmbient ( const SkPath path,
const SkMatrix ctm,
const SkPoint3 zPlane,
bool  transparent 
)

This function generates an ambient shadow mesh for a path by walking the path, outsetting by the radius, and setting inner and outer colors to umbraColor and penumbraColor, respectively. If transparent is true, then the center of the ambient shadow will be filled in.

Definition at line 1167 of file SkShadowTessellator.cpp.

1168 {
1169 if (!ctm.mapRect(path.getBounds()).isFinite() || !zPlane.isFinite()) {
1170 return nullptr;
1171 }
1172 SkAmbientShadowTessellator ambientTess(path, ctm, zPlane, transparent);
1173 return ambientTess.releaseVertices();
1174}
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
bool isFinite() const
Definition SkPoint3.h:116

◆ MakeSpot()

sk_sp< SkVertices > SkShadowTessellator::MakeSpot ( const SkPath path,
const SkMatrix ctm,
const SkPoint3 zPlane,
const SkPoint3 lightPos,
SkScalar  lightRadius,
bool  transparent,
bool  directional 
)

This function generates a spot shadow mesh for a path by walking the transformed path, further transforming by the scale and translation, and outsetting and insetting by a radius. The center will be clipped against the original path unless transparent is true.

Definition at line 1176 of file SkShadowTessellator.cpp.

1179 {
1180 if (!ctm.mapRect(path.getBounds()).isFinite() || !zPlane.isFinite() ||
1181 !lightPos.isFinite() || !(lightPos.fZ >= SK_ScalarNearlyZero) ||
1182 !SkIsFinite(lightRadius) || !(lightRadius >= SK_ScalarNearlyZero)) {
1183 return nullptr;
1184 }
1185 SkSpotShadowTessellator spotTess(path, ctm, zPlane, lightPos, lightRadius, transparent,
1186 directional);
1187 return spotTess.releaseVertices();
1188}
static bool SkIsFinite(T x, Pack... values)
#define SK_ScalarNearlyZero
Definition SkScalar.h:99
SkScalar fZ
Definition SkPoint3.h:16