Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
SkSweepGradient Class Referencefinal

#include <SkSweepGradient.h>

Inheritance diagram for SkSweepGradient:
SkGradientBaseShader SkShaderBase SkShader SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

 SkSweepGradient (const SkPoint &center, SkScalar t0, SkScalar t1, const Descriptor &)
 
GradientType asGradient (GradientInfo *info, SkMatrix *localMatrix) const override
 
const SkPointcenter () const
 
SkScalar tBias () const
 
SkScalar tScale () const
 
- Public Member Functions inherited from SkGradientBaseShader
 SkGradientBaseShader (const Descriptor &desc, const SkMatrix &ptsToUnit)
 
 ~SkGradientBaseShader () override
 
ShaderType type () const final
 
bool isOpaque () const override
 
bool interpolateInPremul () const
 
const SkMatrixgetGradientMatrix () const
 
int getColorCount () const
 
const float * getPositions () const
 
const InterpolationgetInterpolation () const
 
SkScalar getPos (int i) const
 
SkColor getLegacyColor (int i) const
 
bool colorsAreOpaque () const
 
SkTileMode getTileMode () const
 
const SkBitmapcachedBitmap () const
 
void setCachedBitmap (SkBitmap b) const
 
- Public Member Functions inherited from SkShaderBase
 ~SkShaderBase () override
 
sk_sp< SkShadermakeInvertAlpha () const
 
sk_sp< SkShadermakeWithCTM (const SkMatrix &) const
 
virtual bool isConstant () const
 
virtual ShaderType type () const =0
 
virtual GradientType asGradient (GradientInfo *info=nullptr, SkMatrix *localMatrix=nullptr) const
 
ContextmakeContext (const ContextRec &, SkArenaAlloc *) const
 
bool asLuminanceColor (SkColor4f *) const
 
bool appendRootStages (const SkStageRec &rec, const SkMatrix &ctm) const
 
virtual bool appendStages (const SkStageRec &, const SkShaders::MatrixRec &) const =0
 
virtual SkImageonIsAImage (SkMatrix *, SkTileMode[2]) const
 
virtual SkRuntimeEffectasRuntimeEffect () const
 
Type getFlattenableType () const override
 
virtual sk_sp< SkShadermakeAsALocalMatrixShader (SkMatrix *localMatrix) const
 
- Public Member Functions inherited from SkShader
virtual bool isOpaque () const
 
SkImageisAImage (SkMatrix *localMatrix, SkTileMode xy[2]) const
 
bool isAImage () const
 
sk_sp< SkShadermakeWithLocalMatrix (const SkMatrix &) const
 
sk_sp< SkShadermakeWithColorFilter (sk_sp< SkColorFilter >) const
 
sk_sp< SkShadermakeWithWorkingColorSpace (sk_sp< SkColorSpace >) const
 
- Public Member Functions inherited from SkFlattenable
 SkFlattenable ()
 
virtual Factory getFactory () const =0
 
virtual const char * getTypeName () const =0
 
virtual void flatten (SkWriteBuffer &) const
 
virtual Type getFlattenableType () const =0
 
sk_sp< SkDataserialize (const SkSerialProcs *=nullptr) const
 
size_t serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Protected Member Functions

void flatten (SkWriteBuffer &buffer) const override
 
void appendGradientStages (SkArenaAlloc *alloc, SkRasterPipeline *tPipeline, SkRasterPipeline *postPipeline) const override
 
- Protected Member Functions inherited from SkGradientBaseShader
void flatten (SkWriteBuffer &) const override
 
void commonAsAGradient (GradientInfo *) const
 
bool onAsLuminanceColor (SkColor4f *) const override
 
bool appendStages (const SkStageRec &, const SkShaders::MatrixRec &) const override
 
virtual void appendGradientStages (SkArenaAlloc *alloc, SkRasterPipeline *tPipeline, SkRasterPipeline *postPipeline) const =0
 
- Protected Member Functions inherited from SkShaderBase
 SkShaderBase ()
 
void flatten (SkWriteBuffer &) const override
 
virtual bool onAsLuminanceColor (SkColor4f *) const
 

Additional Inherited Members

- Public Types inherited from SkGradientBaseShader
using Interpolation = SkGradientShader::Interpolation
 
- Public Types inherited from SkShaderBase
enum class  ShaderType { M }
 
enum class  GradientType { kNone , M }
 
enum  Flags { kOpaqueAlpha_Flag = 1 << 0 }
 
- Public Types inherited from SkFlattenable
enum  Type {
  kSkColorFilter_Type , kSkBlender_Type , kSkDrawable_Type , kSkDrawLooper_Type ,
  kSkImageFilter_Type , kSkMaskFilter_Type , kSkPathEffect_Type , kSkShader_Type
}
 
typedef sk_sp< SkFlattenable >(* Factory) (SkReadBuffer &)
 
- Static Public Member Functions inherited from SkGradientBaseShader
static bool ValidGradient (const SkColor4f colors[], int count, SkTileMode tileMode, const Interpolation &interpolation)
 
static sk_sp< SkShaderMakeDegenerateGradient (const SkColor4f colors[], const SkScalar pos[], int colorCount, sk_sp< SkColorSpace > colorSpace, SkTileMode mode)
 
static void AppendGradientFillStages (SkRasterPipeline *p, SkArenaAlloc *alloc, const SkPMColor4f *colors, const SkScalar *positions, int count)
 
static void AppendInterpolatedToDstStages (SkRasterPipeline *p, SkArenaAlloc *alloc, bool colorsAreOpaque, const Interpolation &interpolation, const SkColorSpace *intermediateColorSpace, const SkColorSpace *dstColorSpace)
 
- Static Public Member Functions inherited from SkShaderBase
static Type GetFlattenableType ()
 
static sk_sp< SkShaderBaseDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
static void RegisterFlattenables ()
 
static SkMatrix ConcatLocalMatrices (const SkMatrix &parentLM, const SkMatrix &childLM)
 
- Static Public Member Functions inherited from SkFlattenable
static Factory NameToFactory (const char name[])
 
static const char * FactoryToName (Factory)
 
static void Register (const char name[], Factory)
 
static sk_sp< SkFlattenableDeserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
 
- Public Attributes inherited from SkGradientBaseShader
SkColor4ffColors
 
SkScalarfPositions
 
int fColorCount
 
sk_sp< SkColorSpacefColorSpace
 
Interpolation fInterpolation
 
bool fFirstStopIsImplicit
 
bool fLastStopIsImplicit
 
- Static Public Attributes inherited from SkGradientBaseShader
static constexpr SkScalar kDegenerateThreshold = SK_Scalar1 / (1 << 15)
 
- Protected Attributes inherited from SkGradientBaseShader
const SkMatrix fPtsToUnit
 
SkTileMode fTileMode
 

Detailed Description

Definition at line 21 of file SkSweepGradient.h.

Constructor & Destructor Documentation

◆ SkSweepGradient()

SkSweepGradient::SkSweepGradient ( const SkPoint center,
SkScalar  t0,
SkScalar  t1,
const Descriptor desc 
)

Definition at line 33 of file SkSweepGradient.cpp.

38 , fCenter(center)
39 , fTBias(-t0)
40 , fTScale(1 / (t1 - t0)) {
41 SkASSERT(t0 < t1);
42}
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkGradientBaseShader(const Descriptor &desc, const SkMatrix &ptsToUnit)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
Definition: SkMatrix.h:91
const SkPoint & center() const
constexpr float y() const
Definition: SkPoint_impl.h:187
constexpr float x() const
Definition: SkPoint_impl.h:181

Member Function Documentation

◆ appendGradientStages()

void SkSweepGradient::appendGradientStages ( SkArenaAlloc alloc,
SkRasterPipeline tPipeline,
SkRasterPipeline postPipeline 
) const
overrideprotectedvirtual

Implements SkGradientBaseShader.

Definition at line 94 of file SkSweepGradient.cpp.

95 {
96 p->append(SkRasterPipelineOp::xy_to_unit_angle);
97 p->appendMatrix(alloc, SkMatrix::Scale(fTScale, 1) * SkMatrix::Translate(fTBias, 0));
98}
static SkMatrix Scale(SkScalar sx, SkScalar sy)
Definition: SkMatrix.h:75

◆ asGradient()

SkShaderBase::GradientType SkSweepGradient::asGradient ( GradientInfo info,
SkMatrix localMatrix 
) const
overridevirtual

Reimplemented from SkShaderBase.

Definition at line 44 of file SkSweepGradient.cpp.

45 {
46 if (info) {
48 info->fPoint[0] = fCenter;
49 }
50 if (localMatrix) {
51 *localMatrix = SkMatrix::I();
52 }
53 return GradientType::kSweep;
54}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
void commonAsAGradient(GradientInfo *) const
static const SkMatrix & I()
Definition: SkMatrix.cpp:1544

◆ center()

const SkPoint & SkSweepGradient::center ( ) const
inline

Definition at line 27 of file SkSweepGradient.h.

27{ return fCenter; }

◆ flatten()

void SkSweepGradient::flatten ( SkWriteBuffer ) const
overrideprotectedvirtual

Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()).

DEPRECATED public : will move to protected ... use serialize() instead

Reimplemented from SkGradientBaseShader.

Definition at line 87 of file SkSweepGradient.cpp.

87 {
89 buffer.writePoint(fCenter);
90 buffer.writeScalar(fTBias);
91 buffer.writeScalar(fTScale);
92}
void flatten(SkWriteBuffer &) const override
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ tBias()

SkScalar SkSweepGradient::tBias ( ) const
inline

Definition at line 28 of file SkSweepGradient.h.

28{ return fTBias; }

◆ tScale()

SkScalar SkSweepGradient::tScale ( ) const
inline

Definition at line 29 of file SkSweepGradient.h.

29{ return fTScale; }

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