#include <SkXfermode.h>
Inherits SkFlattenable.
Inherited by SkAvoidXfermode, SkPixelXorXfermode, and SkProcXfermode.
SkXfermode is the base class for objects that are called to implement custom "transfer-modes" in the drawing pipeline. The static function Create(Modes) can be called to return an instance of any of the predefined subclasses as specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, then objects drawn with that paint have the xfermode applied.
Definition at line 31 of file SkXfermode.h.
enum SkXfermode::Coeff |
Enum of possible coefficients to describe some xfermodes
Definition at line 46 of file SkXfermode.h.
enum SkXfermode::Mode |
List of predefined xfermodes. The algebra for the modes uses the following symbols: Sa, Sc - source alpha and color Da, Dc - destination alpha and color (before compositing) [a, c] - Resulting (alpha, color) values For these equations, the colors are in premultiplied state. If no xfermode is specified, kSrcOver is assumed.
Reimplemented in SkAvoidXfermode.
Definition at line 86 of file SkXfermode.h.
SkXfermode::SkXfermode | ( | ) | [inline] |
Definition at line 33 of file SkXfermode.h.
SkXfermode::SkXfermode | ( | SkFlattenableReadBuffer & | rb | ) | [inline, protected] |
Definition at line 142 of file SkXfermode.h.
If the xfermode can be expressed as an equation using the coefficients in Coeff, then asCoeff() returns true, and sets (if not null) src and dst accordingly.
result = src_coeff * src_color + dst_coeff * dst_color;
As examples, here are some of the porterduff coefficients
MODE SRC_COEFF DST_COEFF clear zero zero src one zero dst zero one srcover one isa dstover ida one
static SkXfermode* SkXfermode::Create | ( | Mode | mode | ) | [static] |
Return an SkXfermode object for the specified mode.
static SkXfermodeProc SkXfermode::GetProc | ( | Mode | mode | ) | [static] |
Return a function pointer to a routine that applies the specified porter-duff transfer mode.
static SkXfermodeProc16 SkXfermode::GetProc16 | ( | Mode | mode, | |
SkColor | srcColor | |||
) | [static] |
Return a function pointer to a routine that applies the specified porter-duff transfer mode and srcColor to a 16bit device color. Note, if the mode+srcColor might return a non-opaque color, then there is not 16bit proc, and this will return NULL.
static bool SkXfermode::IsMode | ( | SkXfermode * | , | |
Mode * | mode | |||
) | [static] |
If the specified xfermode advertises itself as one of the porterduff modes (via SkXfermode::Coeff), return true and if not null, set mode to the corresponding porterduff mode. If it is not recognized as a one, return false and ignore the mode parameter.
virtual void SkXfermode::xfer16 | ( | uint16_t | dst[], | |
const SkPMColor | src[], | |||
int | count, | |||
const SkAlpha | aa[] | |||
) | [virtual] |
Reimplemented in SkProcXfermode, and SkAvoidXfermode.
virtual void SkXfermode::xfer32 | ( | SkPMColor | dst[], | |
const SkPMColor | src[], | |||
int | count, | |||
const SkAlpha | aa[] | |||
) | [virtual] |
Reimplemented in SkProcXfermode, and SkAvoidXfermode.
virtual void SkXfermode::xfer4444 | ( | uint16_t | dst[], | |
const SkPMColor | src[], | |||
int | count, | |||
const SkAlpha | aa[] | |||
) | [virtual] |
Reimplemented in SkProcXfermode, and SkAvoidXfermode.
virtual void SkXfermode::xferA8 | ( | SkAlpha | dst[], | |
const SkPMColor | src[], | |||
int | count, | |||
const SkAlpha | aa[] | |||
) | [virtual] |
Reimplemented in SkProcXfermode, and SkAvoidXfermode.
The default implementation of xfer32/xfer16/xferA8 in turn call this method, 1 color at a time (upscaled to a SkPMColor). The default implmentation of this method just returns dst. If performance is important, your subclass should override xfer32/xfer16/xferA8 directly.
This method will not be called directly by the client, so it need not be implemented if your subclass has overridden xfer32/xfer16/xferA8
Reimplemented in SkPixelXorXfermode.