Skia
2DGraphicsLibrary
|
Public Member Functions | |
bool | affectsTransparentBlack () const override |
![]() | |
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 |
virtual SkRect | computeFastBounds (const SkRect &) 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... | |
![]() | |
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... | |
![]() | |
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 (const SkPaint &paint, const CropRect *cropRect=nullptr) |
Create a new image filter which fills the given rectangle using the given paint. More... | |
![]() | |
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 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) |
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 *xformer) const override |
![]() | |
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... | |
virtual SkIRect | onFilterNodeBounds (const SkIRect &, const SkMatrix &, MapDirection) const |
Performs a forwards or reverse mapping of the given rect to accommodate this filter's margin requirements. 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|. | |
![]() | |
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 | |
SkPaintImageFilter (const SkPaint &paint, const CropRect *rect) | |
Private Attributes | |
SkPaint | fPaint |
Additional Inherited Members | |
![]() | |
enum | TileUsage { kPossible_TileUsage, kNever_TileUsage } |
enum | MapDirection { kForward_MapDirection, kReverse_MapDirection } |
![]() | |
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 &) |
![]() | |
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... | |
|
static |
Create a new image filter which fills the given rectangle using the given paint.
If no rectangle is specified, an output is produced with the same bounds as the input primitive (even though the input primitive's pixels are not used for processing).
paint | Paint to use when filling the rect. |
rect | Rectangle of output pixels. If NULL or a given crop edge is not specified, the source primitive's bounds are used instead. |
|
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.