Skia
2DGraphicsLibrary
|
Public Types | |
enum | ShadowMode { kDrawShadowAndForeground_ShadowMode, kDrawShadowOnly_ShadowMode, kLast_ShadowMode = kDrawShadowOnly_ShadowMode } |
Public Types inherited from SkImageFilter | |
enum | TileUsage { kPossible_TileUsage, kNever_TileUsage } |
enum | MapDirection { kForward_MapDirection, kReverse_MapDirection } |
Public Types inherited from SkFlattenable | |
enum | Type { kSkColorFilter_Type, kSkDrawable_Type, kSkDrawLooper_Type, kSkImageFilter_Type, kSkMaskFilter_Type, kSkPathEffect_Type, kSkPixelRef_Type, kSkRasterizer_Type, kSkShaderBase_Type, kSkUnused_Type, kSkUnused_Xfermode_Type, kSkNormalSource_Type } |
typedef sk_sp< SkFlattenable >(* | Factory )(SkReadBuffer &) |
Public Member Functions | |
SkRect | computeFastBounds (const SkRect &) const override |
Public Member Functions inherited from SkImageFilter | |
sk_sp< SkSpecialImage > | filterImage (SkSpecialImage *src, const Context &, SkIPoint *offset) const |
Request a new filtered image to be created from the src image. More... | |
SkIRect | filterBounds (const SkIRect &src, const SkMatrix &ctm, MapDirection=kReverse_MapDirection) const |
Map a device-space rect recursively forward or backward through the filter DAG. More... | |
bool | isColorFilterNode (SkColorFilter **filterPtr) const |
Returns whether this image filter is a color filter and puts the color filter into the "filterPtr" parameter if it can. More... | |
bool | asColorFilter (SkColorFilter **filterPtr) const |
bool | asAColorFilter (SkColorFilter **filterPtr) const |
Returns true (and optionally returns a ref'd filter) if this imagefilter can be completely replaced by the returned colorfilter. More... | |
int | countInputs () const |
Returns the number of inputs this filter will accept (some inputs can be NULL). | |
SkImageFilter * | getInput (int i) const |
Returns the input filter at a given index, or NULL if no input is connected. More... | |
bool | cropRectIsSet () const |
Returns whether any edges of the crop rect have been set. More... | |
CropRect | getCropRect () const |
bool | canComputeFastBounds () const |
sk_sp< SkImageFilter > | makeWithLocalMatrix (const SkMatrix &) const |
If this filter can be represented by another filter + a localMatrix, return that filter, else return null. | |
bool | canHandleComplexCTM () const |
ImageFilters can natively handle scaling and translate components in the CTM. 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(). | |
virtual const char * | getTypeName () const |
Returns the name of the object's class. More... | |
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... | |
void | validate () const |
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... | |
Static Public Member Functions | |
static sk_sp< SkImageFilter > | Make (SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor color, ShadowMode shadowMode, sk_sp< SkImageFilter > input, const CropRect *cropRect=nullptr) |
Static Public Member Functions inherited from SkImageFilter | |
static sk_sp< SkSpecialImage > | DrawWithFP (GrContext *context, sk_sp< GrFragmentProcessor > fp, const SkIRect &bounds, const OutputProperties &outputProperties) |
static sk_sp< SkImageFilter > | MakeMatrixFilter (const SkMatrix &matrix, SkFilterQuality quality, sk_sp< SkImageFilter > input) |
Return an imagefilter which transforms its input by the given matrix. | |
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) |
Static Public Attributes | |
static const int | kShadowModeCount = kLast_ShadowMode+1 |
Protected Member Functions | |
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()). | |
sk_sp< SkSpecialImage > | onFilterImage (SkSpecialImage *source, const Context &, SkIPoint *offset) const override |
This is the virtual which should be overridden by the derived class to perform image filtering. More... | |
sk_sp< SkImageFilter > | onMakeColorSpace (SkColorSpaceXformer *) const override |
SkIRect | onFilterNodeBounds (const SkIRect &src, const SkMatrix &, MapDirection) const override |
Performs a forwards or reverse mapping of the given rect to accommodate this filter's margin requirements. More... | |
Protected Member Functions inherited from SkImageFilter | |
SkImageFilter (sk_sp< SkImageFilter > const *inputs, int inputCount, const CropRect *cropRect) | |
SkImageFilter (int inputCount, SkReadBuffer &rb) | |
Constructs a new SkImageFilter read from an SkReadBuffer object. More... | |
const CropRect * | getCropRectIfSet () const |
virtual SkIRect | onFilterBounds (const SkIRect &, const SkMatrix &, MapDirection) const |
This function recurses into its inputs with the given rect (first argument), calls filterBounds() with the given map direction on each, and returns the union of those results. More... | |
sk_sp< SkSpecialImage > | filterInput (int index, SkSpecialImage *src, const Context &, SkIPoint *offset) const |
virtual bool | onIsColorFilterNode (SkColorFilter **) const |
Return true (and return a ref'd colorfilter) if this node in the DAG is just a colorfilter w/o CropRect constraints. | |
virtual bool | onCanHandleComplexCTM () const |
Override this to describe the behavior of your subclass - as a leaf node. More... | |
bool | applyCropRect (const Context &, const SkIRect &srcBounds, SkIRect *dstBounds) const |
Given a "srcBounds" rect, computes destination bounds for this filter. More... | |
sk_sp< SkSpecialImage > | applyCropRect (const Context &, SkSpecialImage *src, SkIPoint *srcOffset, SkIRect *bounds) const |
A variant of the above call which takes the original source bitmap and source offset. More... | |
Context | mapContext (const Context &ctx) const |
Creates a modified Context for use when recursing up the image filter DAG. More... | |
sk_sp< SkImageFilter > | makeColorSpace (SkColorSpaceXformer *xformer) const |
Returns an image filter transformed into a new color space via the |xformer|. | |
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 or if they choose not to call the destructor (e.g. More... | |
Private Types | |
typedef SkImageFilter | INHERITED |
Private Member Functions | |
SkDropShadowImageFilter (SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor, ShadowMode shadowMode, sk_sp< SkImageFilter > input, const CropRect *cropRect) | |
Private Attributes | |
SkScalar | fDx |
SkScalar | fDy |
SkScalar | fSigmaX |
SkScalar | fSigmaY |
SkColor | fColor |
ShadowMode | fShadowMode |
Additional Inherited Members | |
Static Protected Member Functions inherited from SkImageFilter | |
static sk_sp< SkSpecialImage > | ImageToColorSpace (SkSpecialImage *src, const OutputProperties &) |
Returns a version of the passed-in image (possibly the original), that is in a colorspace with the same gamut as the one from the OutputProperties. More... | |
|
overrideprotectedvirtual |
This is the virtual which should be overridden by the derived class to perform image filtering.
src is the original primitive bitmap. If the filter has a connected input, it should recurse on that input and use that in place of src.
The matrix is the current matrix on the canvas.
Offset is the amount to translate the resulting image relative to the src when it is drawn. This is an out-param.
If the result image cannot be created (either because of error or if, say, the result is entirely clipped out), this should return nullptr. Callers that affect transparent black should explicitly handle nullptr results and press on. In the error case this behavior will produce a better result than nothing and is necessary for the clipped out case. If the return value is nullptr then offset should be ignored.
Implements SkImageFilter.
|
overrideprotectedvirtual |
Performs a forwards or reverse mapping of the given rect to accommodate this filter's margin requirements.
kForward_MapDirection is used to determine the destination pixels which would be touched by filtering the given given source rect (e.g., given source bitmap bounds, determine the optimal bounds of the filtered offscreen bitmap). kReverse_MapDirection is used to determine which pixels of the input(s) would be required to fill the given destination rect (e.g., clip bounds). NOTE: these operations may not be the inverse of the other. For example, blurring expands the given rect in both forward and reverse directions. Unlike onFilterBounds(), this function is non-recursive.
Reimplemented from SkImageFilter.