SkColorShader Class Reference

#include <SkColorShader.h>

Inherits SkShader.

Collaboration diagram for SkColorShader:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SkColorShader ()
 SkColorShader (SkColor c)
virtual uint32_t getFlags ()
virtual uint8_t getSpan16Alpha () const
virtual bool setContext (const SkBitmap &device, const SkPaint &paint, const SkMatrix &matrix)
virtual void shadeSpan (int x, int y, SkPMColor span[], int count)
virtual void shadeSpan16 (int x, int y, uint16_t span[], int count)
virtual void shadeSpanAlpha (int x, int y, uint8_t alpha[], int count)

Protected Member Functions

 SkColorShader (SkFlattenableReadBuffer &)
virtual void flatten (SkFlattenableWriteBuffer &)
virtual Factory getFactory ()

Detailed Description

A Shader that represents a single color. In general, this effect can be accomplished by just using the color field on the paint, but if an actual shader object is needed, this provides that feature.

Definition at line 27 of file SkColorShader.h.


Constructor & Destructor Documentation

SkColorShader::SkColorShader (  )  [inline]

Create a ColorShader that will inherit its color from the Paint at draw time.

Definition at line 32 of file SkColorShader.h.

SkColorShader::SkColorShader ( SkColor  c  )  [inline]

Create a ColorShader that ignores the color in the paint, and uses the specified color. Note: like all shaders, at draw time the paint's alpha will be respected, and is applied to the specified color.

Definition at line 38 of file SkColorShader.h.

SkColorShader::SkColorShader ( SkFlattenableReadBuffer  )  [protected]

Member Function Documentation

virtual void SkColorShader::flatten ( SkFlattenableWriteBuffer  )  [protected, virtual]

Override this to write data specific to your subclass into the buffer, being sure to call your super-class' version first. This data will later be passed to your Factory function, returned by getFactory().

Reimplemented from SkShader.

virtual Factory SkColorShader::getFactory (  )  [inline, protected, virtual]

Implement this to return a factory function pointer that can be called to recreate your class given a buffer (previously written to by your override of flatten().

Implements SkFlattenable.

Definition at line 51 of file SkColorShader.h.

virtual uint32_t SkColorShader::getFlags (  )  [inline, virtual]

Called sometimes before drawing with this shader. Return the type of alpha your shader will return. The default implementation returns 0. Your subclass should override if it can (even sometimes) report a non-zero value, since that will enable various blitters to perform faster.

Reimplemented from SkShader.

Definition at line 40 of file SkColorShader.h.

virtual uint8_t SkColorShader::getSpan16Alpha (  )  const [virtual]

Return the alpha associated with the data returned by shadeSpan16(). If kHasSpan16_Flag is not set, this value is meaningless.

Reimplemented from SkShader.

virtual bool SkColorShader::setContext ( const SkBitmap device,
const SkPaint paint,
const SkMatrix matrix 
) [virtual]

Called once before drawing, with the current paint and device matrix. Return true if your shader supports these parameters, or false if not. If false is returned, nothing will be drawn.

Reimplemented from SkShader.

virtual void SkColorShader::shadeSpan ( int  x,
int  y,
SkPMColor  [],
int  count 
) [virtual]

Called for each span of the object being drawn. Your subclass should set the appropriate colors (with premultiplied alpha) that correspond to the specified device coordinates.

Implements SkShader.

virtual void SkColorShader::shadeSpan16 ( int  x,
int  y,
uint16_t  [],
int  count 
) [virtual]

Called only for 16bit devices when getFlags() returns kOpaqueAlphaFlag | kHasSpan16_Flag

Reimplemented from SkShader.

virtual void SkColorShader::shadeSpanAlpha ( int  x,
int  y,
uint8_t  alpha[],
int  count 
) [virtual]

Similar to shadeSpan, but only returns the alpha-channel for a span. The default implementation calls shadeSpan() and then extracts the alpha values from the returned colors.

Reimplemented from SkShader.


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

Generated on Tue Oct 20 11:03:42 2009 for Skia by  doxygen 1.6.1