|
Skia
2DGraphicsLibrary
|
This subclass of shader returns the composition of two other shaders, combined by a xfermode. More...
#include <SkComposeShader.h>
Classes | |
| class | ComposeShaderContext |
Public Member Functions | |
| SkComposeShader (SkShader *sA, SkShader *sB, SkXfermode *mode=NULL) | |
| Create a new compose shader, given shaders A, B, and a combining xfermode mode. More... | |
| size_t | contextSize () const override |
| Return the size of a Context returned by createContext. More... | |
| const GrFragmentProcessor * | asFragmentProcessor (GrContext *, const SkMatrix &viewM, const SkMatrix *localMatrix, SkFilterQuality) const override |
| Returns a GrFragmentProcessor that implements the shader for the GPU backend. More... | |
| SkShader * | getShaderA () |
| SkShader * | getShaderB () |
| bool | asACompose (ComposeRec *rec) const override |
Public Member Functions inherited from SkShader | |
| SkShader (const SkMatrix *localMatrix=NULL) | |
| const SkMatrix & | getLocalMatrix () const |
| Returns the local matrix. More... | |
| virtual bool | isOpaque () const |
| Returns true if the shader is guaranteed to produce only opaque colors, subject to the SkPaint using the shader to apply an opaque alpha value. More... | |
| Context * | createContext (const ContextRec &, void *storage) const |
| Create the actual object that does the shading. More... | |
| bool | isABitmap (SkBitmap *outTexture, SkMatrix *outMatrix, TileMode xy[2]) const |
| Returns true if this shader is just a bitmap, and if not null, returns the bitmap, localMatrix, and tilemodes. More... | |
| bool | isABitmap () const |
| virtual GradientType | asAGradient (GradientInfo *info) const |
| bool | asLuminanceColor (SkColor *) const |
| If the shader can represent its "average" luminance in a single color, return true and if color is not NULL, return that color. More... | |
| SkShader * | newWithLocalMatrix (const SkMatrix &) const |
| Return a shader that will apply the specified localMatrix to this shader. More... | |
| SkShader * | newWithColorFilter (SkColorFilter *) const |
| Create a new shader that produces the same colors as invoking this shader and then applying the colorfilter. | |
| virtual SkShader * | refAsALocalMatrixShader (SkMatrix *localMatrix) const |
| If this shader can be represented by another shader + a localMatrix, return that shader and, if not NULL, the localMatrix. More... | |
Public Member Functions inherited from SkFlattenable | |
| virtual Factory | getFactory () const =0 |
| 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(). | |
| const char * | getTypeName () const |
| Returns the name of the object's class. | |
Public Member Functions inherited from SkRefCntBase | |
| SkRefCntBase () | |
| Default construct, initializing the reference count to 1. | |
| virtual | ~SkRefCntBase () |
| Destruct, asserting that the reference count is 1. | |
| int32_t | getRefCnt () const |
| Return the reference count. More... | |
| bool | unique () const |
| May return true if the caller is the only owner. More... | |
| void | ref () const |
| Increment the reference count. More... | |
| void | unref () const |
| Decrement the reference count. More... | |
| void | validate () const |
Protected Member Functions | |
| SkComposeShader (SkReadBuffer &) | |
| void | flatten (SkWriteBuffer &) const override |
| Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()). | |
| Context * | onCreateContext (const ContextRec &, void *) const override |
| Your subclass must also override contextSize() if it overrides onCreateContext(). More... | |
Protected Member Functions inherited from SkShader | |
| void | flatten (SkWriteBuffer &) const override |
| Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()). | |
| bool | computeTotalInverse (const ContextRec &, SkMatrix *totalInverse) const |
| virtual bool | onAsLuminanceColor (SkColor *) const |
| virtual bool | onIsABitmap (SkBitmap *, SkMatrix *, TileMode[2]) const |
Protected Member Functions inherited from SkRefCntBase | |
| void | internal_dispose_restore_refcnt_to_1 () const |
| Allow subclasses to call this if they've overridden internal_dispose so they can reset fRefCnt before the destructor is called. More... | |
Private Types | |
| typedef SkShader | INHERITED |
Private Attributes | |
| SkShader * | fShaderA |
| SkShader * | fShaderB |
| SkXfermode * | fMode |
Additional Inherited Members | |
Public Types inherited from SkShader | |
| enum | TileMode { kClamp_TileMode, kRepeat_TileMode, kMirror_TileMode } |
| enum | { kTileModeCount = kMirror_TileMode + 1 } |
| enum | Flags { kOpaqueAlpha_Flag = 1 << 0, kConstInY32_Flag = 1 << 1, kSupports4f_Flag = 1 << 2 } |
| enum | GradientType { kNone_GradientType, kColor_GradientType, kLinear_GradientType, kRadial_GradientType, kSweep_GradientType, kConical_GradientType, kLast_GradientType = kConical_GradientType } |
| If the shader subclass can be represented as a gradient, asAGradient returns the matching GradientType enum (or kNone_GradientType if it cannot). More... | |
Public Types inherited from SkFlattenable | |
| enum | Type { kSkColorFilter_Type, kSkDrawLooper_Type, kSkImageFilter_Type, kSkMaskFilter_Type, kSkPathEffect_Type, kSkPixelRef_Type, kSkRasterizer_Type, kSkShader_Type, kSkUnused_Type, kSkXfermode_Type } |
| typedef SkFlattenable *(* | Factory )(SkReadBuffer &) |
Static Public Member Functions inherited from SkShader | |
| static SkShader * | CreateEmptyShader () |
| Call this to create a new "empty" shader, that will not draw anything. | |
| static SkShader * | CreateColorShader (SkColor) |
| Call this to create a new shader that just draws the specified color. More... | |
| static SkShader * | CreateComposeShader (SkShader *dst, SkShader *src, SkXfermode::Mode) |
| static SkShader * | CreateComposeShader (SkShader *dst, SkShader *src, SkXfermode *xfer) |
| Create a new compose shader, given shaders dst, src, and a combining xfermode mode. More... | |
| static SkShader * | CreateBitmapShader (const SkBitmap &src, TileMode tmx, TileMode tmy, const SkMatrix *localMatrix=NULL) |
| Call this to create a new shader that will draw with the specified bitmap. More... | |
| static SkShader * | CreatePictureShader (const SkPicture *src, TileMode tmx, TileMode tmy, const SkMatrix *localMatrix, const SkRect *tile) |
| Call this to create a new shader that will draw with the specified picture. More... | |
Static Public Member Functions inherited from SkFlattenable | |
| static Factory | NameToFactory (const char name[]) |
| static const char * | FactoryToName (Factory) |
| static bool | NameToType (const char name[], Type *type) |
| static void | Register (const char name[], Factory, Type) |
This subclass of shader returns the composition of two other shaders, combined by a xfermode.
| 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 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. |
|
overridevirtual |
Returns a GrFragmentProcessor that implements the shader for the GPU backend.
NULL is returned if there is no GPU implementation.
The GPU device does not call SkShader::createContext(), instead we pass the view matrix, local matrix, and filter quality directly.
The GrContext may be used by the to create textures that are required by the returned processor.
The returned GrFragmentProcessor should expect an unpremultiplied input color and produce a premultiplied output.
Reimplemented from SkShader.
|
overridevirtual |
Return the size of a Context returned by createContext.
Override this if your subclass overrides createContext, to return the correct size of your subclass' context.
Reimplemented from SkShader.
|
overrideprotectedvirtual |
Your subclass must also override contextSize() if it overrides onCreateContext().
Base class impl returns NULL.
Reimplemented from SkShader.