#include <SkComposeShader.h>
Inherits SkShader.
Public Member Functions | |
SkComposeShader (SkShader *sA, SkShader *sB, SkXfermode *mode=NULL) | |
virtual | ~SkComposeShader () |
virtual bool | setContext (const SkBitmap &device, const SkPaint &paint, const SkMatrix &matrix) |
virtual void | shadeSpan (int x, int y, SkPMColor result[], int count) |
virtual void | beginSession () |
virtual void | endSession () |
Protected Member Functions | |
SkComposeShader (SkFlattenableReadBuffer &) | |
virtual void | flatten (SkFlattenableWriteBuffer &) |
virtual Factory | getFactory () |
This subclass of shader returns the coposition of two other shaders, combined by a xfermode.
Definition at line 30 of file SkComposeShader.h.
SkComposeShader::SkComposeShader | ( | SkShader * | sA, | |
SkShader * | sB, | |||
SkXfermode * | mode = NULL | |||
) |
Create a new compose shader, given shaders A, B, and a combining xfermode mode. When the xfermode is called, it will be given the result from shader A as its "dst", and the result of from shader B as its "src". mode->xfer32(sA_result, sB_result, ...)
shaderA | The colors from this shader are seen as the "dst" by the xfermode | |
shaderB | The colors from this shader are seen as the "src" by the xfermode | |
mode | The xfermode that combines the colors from the two shaders. If mode is null, then SRC_OVER is assumed. |
virtual SkComposeShader::~SkComposeShader | ( | ) | [virtual] |
SkComposeShader::SkComposeShader | ( | SkFlattenableReadBuffer & | ) | [protected] |
virtual void SkComposeShader::beginSession | ( | ) | [virtual] |
Called before a session using the shader begins. Some shaders override this to defer some of their work (like calling bitmap.lockPixels()). Must be balanced by a call to endSession.
Reimplemented from SkShader.
virtual void SkComposeShader::endSession | ( | ) | [virtual] |
Reimplemented from SkShader.
virtual void SkComposeShader::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 SkComposeShader::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 53 of file SkComposeShader.h.
virtual bool SkComposeShader::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 SkComposeShader::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.