Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Member Functions | Private Member Functions | List of all members
sksg::OffsetEffect Class Referencefinal

#include <SkSGGeometryEffect.h>

Inheritance diagram for sksg::OffsetEffect:
sksg::GeometryEffect sksg::GeometryNode sksg::Node SkRefCnt SkRefCntBase

Static Public Member Functions

static sk_sp< OffsetEffectMake (sk_sp< GeometryNode > child)
 

Private Member Functions

SkPath onRevalidateEffect (const sk_sp< GeometryNode > &) override
 

Additional Inherited Members

- Public Member Functions inherited from sksg::GeometryNode
void clip (SkCanvas *, bool antiAlias) const
 
void draw (SkCanvas *, const SkPaint &) const
 
bool contains (const SkPoint &) const
 
SkPath asPath () const
 
- Public Member Functions inherited from sksg::Node
const SkRectrevalidate (InvalidationController *, const SkMatrix &)
 
void invalidate (bool damage=true)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 
- Protected Types inherited from sksg::Node
enum  InvalTraits { kBubbleDamage_Trait = 1 << 0 , kOverrideDamage_Trait = 1 << 1 }
 
- Protected Member Functions inherited from sksg::GeometryEffect
 GeometryEffect (sk_sp< GeometryNode >)
 
 ~GeometryEffect () override
 
void onClip (SkCanvas *, bool antiAlias) const final
 
void onDraw (SkCanvas *, const SkPaint &) const final
 
bool onContains (const SkPoint &) const final
 
SkRect onRevalidate (InvalidationController *, const SkMatrix &) final
 
SkPath onAsPath () const final
 
- Protected Member Functions inherited from sksg::GeometryNode
 GeometryNode ()
 
- Protected Member Functions inherited from sksg::Node
 Node (uint32_t invalTraits)
 
 ~Node () override
 
const SkRectbounds () const
 
bool hasInval () const
 
void observeInval (const sk_sp< Node > &)
 
void unobserveInval (const sk_sp< Node > &)
 

Detailed Description

Apply an offset effect to the child geometry.

Definition at line 157 of file SkSGGeometryEffect.h.

Member Function Documentation

◆ Make()

static sk_sp< OffsetEffect > sksg::OffsetEffect::Make ( sk_sp< GeometryNode child)
inlinestatic

Definition at line 159 of file SkSGGeometryEffect.h.

159 {
160 return child ? sk_sp<OffsetEffect>(new OffsetEffect(std::move(child))) : nullptr;
161 }

◆ onRevalidateEffect()

SkPath sksg::OffsetEffect::onRevalidateEffect ( const sk_sp< GeometryNode > &  child)
overrideprivatevirtual

Implements sksg::GeometryEffect.

Definition at line 155 of file SkSGGeometryEffect.cpp.

155 {
156 SkPath path = child->asPath();
157
158 if (!SkScalarNearlyZero(fOffset)) {
161 paint.setStrokeWidth(std::abs(fOffset) * 2);
162 paint.setStrokeMiter(fMiterLimit);
163 paint.setStrokeJoin(fJoin);
164
165 SkPath fill_path;
166 skpathutils::FillPathWithPaint(path, paint, &fill_path, nullptr);
167
168 if (fOffset > 0) {
169 Op(path, fill_path, kUnion_SkPathOp, &path);
170 } else {
171 Op(path, fill_path, kDifference_SkPathOp, &path);
172 }
173
174 // TODO: this seems to break path combining (winding mismatch?)
175 // Simplify(path, &path);
176 }
177
178 return path;
179}
@ kDifference_SkPathOp
subtract the op path from the first path
Definition SkPathOps.h:23
@ kUnion_SkPathOp
union (inclusive-or) the two paths
Definition SkPathOps.h:25
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
Definition SkScalar.h:101
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
const Paint & paint
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)

The documentation for this class was generated from the following files: