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

#include <SkLinearGradient.h>

Inheritance diagram for SkLinearGradient:
SkGradientBaseShader SkShaderBase SkShader SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

 SkLinearGradient (const SkPoint pts[2], const Descriptor &)
 
GradientType asGradient (GradientInfo *info, SkMatrix *localMatrix) const override
 
const SkPointstart () const
 
const SkPointend () 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

 SkLinearGradient (SkReadBuffer &buffer)
 
void flatten (SkWriteBuffer &buffer) const override
 
void appendGradientStages (SkArenaAlloc *alloc, SkRasterPipeline *tPipeline, SkRasterPipeline *postPipeline) const final
 
- 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
 

Friends

class SkGradientShader
 

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 SkLinearGradient.h.

Constructor & Destructor Documentation

◆ SkLinearGradient() [1/2]

SkLinearGradient::SkLinearGradient ( const SkPoint  pts[2],
const Descriptor desc 
)

Definition at line 45 of file SkLinearGradient.cpp.

46 : SkGradientBaseShader(desc, pts_to_unit_matrix(pts)), fStart(pts[0]), fEnd(pts[1]) {}
static SkMatrix pts_to_unit_matrix(const SkPoint pts[2])
SkGradientBaseShader(const Descriptor &desc, const SkMatrix &ptsToUnit)

◆ SkLinearGradient() [2/2]

SkLinearGradient::SkLinearGradient ( SkReadBuffer buffer)
protected

Member Function Documentation

◆ appendGradientStages()

void SkLinearGradient::appendGradientStages ( SkArenaAlloc alloc,
SkRasterPipeline tPipeline,
SkRasterPipeline postPipeline 
) const
finalprotectedvirtual

Implements SkGradientBaseShader.

Definition at line 76 of file SkLinearGradient.cpp.

77 {
78 // No extra stage needed for linear gradients.
79}

◆ asGradient()

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

Reimplemented from SkShaderBase.

Definition at line 81 of file SkLinearGradient.cpp.

82 {
83 if (info) {
85 info->fPoint[0] = fStart;
86 info->fPoint[1] = fEnd;
87 }
88 if (localMatrix) {
89 *localMatrix = SkMatrix::I();
90 }
92}
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
static constexpr skcms_TransferFunction kLinear
Definition: SkColorSpace.h:51

◆ end()

const SkPoint & SkLinearGradient::end ( ) const
inline

Definition at line 28 of file SkLinearGradient.h.

28{ return fEnd; }

◆ flatten()

void SkLinearGradient::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 70 of file SkLinearGradient.cpp.

70 {
72 buffer.writePoint(fStart);
73 buffer.writePoint(fEnd);
74}
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

◆ start()

const SkPoint & SkLinearGradient::start ( ) const
inline

Definition at line 27 of file SkLinearGradient.h.

27{ return fStart; }

Friends And Related Function Documentation

◆ SkGradientShader

friend class SkGradientShader
friend

Definition at line 42 of file SkLinearGradient.h.


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