Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
skgpu::graphite::StrokeStyle Class Reference

#include <DrawParams.h>

Public Member Functions

 StrokeStyle ()
 
 StrokeStyle (float width, float miterLimit, SkPaint::Join join, SkPaint::Cap cap)
 
 StrokeStyle (const StrokeStyle &)=default
 
StrokeStyleoperator= (const StrokeStyle &)=default
 
bool isMiterJoin () const
 
bool isBevelJoin () const
 
bool isRoundJoin () const
 
float halfWidth () const
 
float width () const
 
float miterLimit () const
 
SkPaint::Cap cap () const
 
SkPaint::Join join () const
 
float joinLimit () const
 

Detailed Description

Definition at line 24 of file DrawParams.h.

Constructor & Destructor Documentation

◆ StrokeStyle() [1/3]

skgpu::graphite::StrokeStyle::StrokeStyle ( )
inline

Definition at line 26 of file DrawParams.h.

26: fHalfWidth(0.f), fJoinLimit(0.f), fCap(SkPaint::kButt_Cap) {}
@ kButt_Cap
no stroke extension
Definition: SkPaint.h:334

◆ StrokeStyle() [2/3]

skgpu::graphite::StrokeStyle::StrokeStyle ( float  width,
float  miterLimit,
SkPaint::Join  join,
SkPaint::Cap  cap 
)
inline

Definition at line 27 of file DrawParams.h.

31 : fHalfWidth(std::max(0.f, 0.5f * width))
32 , fJoinLimit(join == SkPaint::kMiter_Join ? std::max(0.f, miterLimit) :
33 (join == SkPaint::kBevel_Join ? 0.f : -1.f))
34 , fCap(cap) {}
@ kMiter_Join
extends to miter limit
Definition: SkPaint.h:359
@ kBevel_Join
connects outside edges
Definition: SkPaint.h:361
SkPaint::Join join() const
Definition: DrawParams.h:48
SkPaint::Cap cap() const
Definition: DrawParams.h:47
static float max(float r, float g, float b)
Definition: hsl.cpp:49

◆ StrokeStyle() [3/3]

skgpu::graphite::StrokeStyle::StrokeStyle ( const StrokeStyle )
default

Member Function Documentation

◆ cap()

SkPaint::Cap skgpu::graphite::StrokeStyle::cap ( ) const
inline

Definition at line 47 of file DrawParams.h.

47{ return fCap; }

◆ halfWidth()

float skgpu::graphite::StrokeStyle::halfWidth ( ) const
inline

Definition at line 44 of file DrawParams.h.

44{ return fHalfWidth; }

◆ isBevelJoin()

bool skgpu::graphite::StrokeStyle::isBevelJoin ( ) const
inline

Definition at line 41 of file DrawParams.h.

41{ return fJoinLimit == 0.f; }

◆ isMiterJoin()

bool skgpu::graphite::StrokeStyle::isMiterJoin ( ) const
inline

Definition at line 40 of file DrawParams.h.

40{ return fJoinLimit > 0.f; }

◆ isRoundJoin()

bool skgpu::graphite::StrokeStyle::isRoundJoin ( ) const
inline

Definition at line 42 of file DrawParams.h.

42{ return fJoinLimit < 0.f; }

◆ join()

SkPaint::Join skgpu::graphite::StrokeStyle::join ( ) const
inline

Definition at line 48 of file DrawParams.h.

48 {
49 return fJoinLimit > 0.f ? SkPaint::kMiter_Join :
50 (fJoinLimit == 0.f ? SkPaint::kBevel_Join : SkPaint::kRound_Join);
51 }
@ kRound_Join
adds circle
Definition: SkPaint.h:360

◆ joinLimit()

float skgpu::graphite::StrokeStyle::joinLimit ( ) const
inline

Definition at line 54 of file DrawParams.h.

54{ return fJoinLimit; }

◆ miterLimit()

float skgpu::graphite::StrokeStyle::miterLimit ( ) const
inline

Definition at line 46 of file DrawParams.h.

46{ return std::max(0.f, fJoinLimit); }

◆ operator=()

StrokeStyle & skgpu::graphite::StrokeStyle::operator= ( const StrokeStyle )
default

◆ width()

float skgpu::graphite::StrokeStyle::width ( ) const
inline

Definition at line 45 of file DrawParams.h.

45{ return 2.f * fHalfWidth; }

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