ColorFilter

class ColorFilter

ColorFilters are optional objects in the drawing pipeline.

When present in a paint, they are called with the “src” colors, and return new colors, which are then passed onto the next stage (either ImageFilter or Xfermode).

All subclasses are required to be reentrant-safe : it must be legal to share the same instance between several threads.

Subclasses

ColorFilters

ColorMatrixFilter

HighContrastFilter

Color filter that provides transformations to improve contrast for users with low vision.

LumaColorFilter

LumaColorFilter multiplies the luma of its input into the alpha channel, and sets the red, green, and blue channels to zero.

OverdrawColorFilter

Uses the value in the src alpha channel to set the dst pixel.

TableColorFilter

Classes

Type

Members:

Methods

Deserialize

__init__

asAColorMatrix

If the filter can be represented by a 5x4 matrix, this returns list of floats appropriately.

asAColorMode

If the filter can be represented by a source color plus Mode, this returns color and mode appropriately.

asColorMode

filterColor

filterColor4f

Converts the src color (in src colorspace), into the dst colorspace, then applies this filter to it, returning the filtered color in the dst colorspace.

getFlattenableType

getTypeName

Returns the name of the object's class.

makeComposed

Construct a colorfilter whose effect is to first apply the inner filter and then apply this filter, applied to the output of the inner filter.

ref

Increment the reference count.

serialize

unique

May return true if the caller is the only owner.

unref

Decrement the reference count.

Attributes

kColorFilter_Type

kDrawLooper_Type

kDrawable_Type

kImageFilter_Type

kMaskFilter_Type

kPathEffect_Type

Methods

static ColorFilter.Deserialize(data: Buffer) skia.ColorFilter
ColorFilter.__init__(*args, **kwargs)
ColorFilter.asAColorMatrix(self: skia.ColorFilter) object

If the filter can be represented by a 5x4 matrix, this returns list of floats appropriately.

If not, this returns None.

Return type:

List[float] or None

ColorFilter.asAColorMode(self: skia.ColorFilter) object

If the filter can be represented by a source color plus Mode, this returns color and mode appropriately.

If not, this returns None.

Return type:

Tuple[int,skia.BlendMode] or None

ColorFilter.asColorMode(self: skia.ColorFilter) object
ColorFilter.filterColor(self: skia.ColorFilter, color: int) int
ColorFilter.filterColor4f(self: skia.ColorFilter, srcColor: skia.Color4f, srcCS: skia.ColorSpace, dstCS: skia.ColorSpace) skia.Color4f

Converts the src color (in src colorspace), into the dst colorspace, then applies this filter to it, returning the filtered color in the dst colorspace.

ColorFilter.getFlattenableType(self: skia.Flattanable) skia.Flattanable.Type
ColorFilter.getTypeName(self: skia.Flattanable) str

Returns the name of the object’s class.

Implemented in Drawable.

ColorFilter.makeComposed(self: skia.ColorFilter, inner: skia.ColorFilter) skia.ColorFilter

Construct a colorfilter whose effect is to first apply the inner filter and then apply this filter, applied to the output of the inner filter.

result = this(inner(…))

ColorFilter.ref(self: skia.RefCntBase) None

Increment the reference count.

Must be balanced by a call to unref().

ColorFilter.serialize(self: skia.Flattanable) skia.Data
ColorFilter.unique(self: skia.RefCntBase) bool

May return true if the caller is the only owner.

Ensures that all previous owner’s actions are complete.

ColorFilter.unref(self: skia.RefCntBase) None

Decrement the reference count.

If the reference count is 1 before the decrement, then delete the object. Note that if this is the case, then the object needs to have been allocated via new, and not on the stack.

Attributes

ColorFilter.kColorFilter_Type = <Type.kColorFilter_Type: 0>
ColorFilter.kDrawLooper_Type = <Type.kDrawLooper_Type: 3>
ColorFilter.kDrawable_Type = <Type.kDrawable_Type: 2>
ColorFilter.kImageFilter_Type = <Type.kImageFilter_Type: 4>
ColorFilter.kMaskFilter_Type = <Type.kMaskFilter_Type: 5>
ColorFilter.kPathEffect_Type = <Type.kPathEffect_Type: 6>