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

Flags

Members:

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.

getFlags

Returns the flags for this filter.

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

kAlphaUnchanged_Flag

kColorFilter_Type

kDrawLooper_Type

kDrawable_Type

kImageFilter_Type

kMaskFilter_Type

kPathEffect_Type

kPixelRef_Type

kShaderBase_Type

kUnused_Type

kUnused_Type2

kUnused_Type3

kUnused_Type4

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.getFlags(self: skia.ColorFilter) int

Returns the flags for this filter.

Override in subclasses to return custom flags.

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.kAlphaUnchanged_Flag = <Flags.kAlphaUnchanged_Flag: 1>
ColorFilter.kColorFilter_Type = <Type.kColorFilter_Type: 0>
ColorFilter.kDrawLooper_Type = <Type.kDrawLooper_Type: 2>
ColorFilter.kDrawable_Type = <Type.kDrawable_Type: 1>
ColorFilter.kImageFilter_Type = <Type.kImageFilter_Type: 3>
ColorFilter.kMaskFilter_Type = <Type.kMaskFilter_Type: 4>
ColorFilter.kPathEffect_Type = <Type.kPathEffect_Type: 5>
ColorFilter.kPixelRef_Type = <Type.kPixelRef_Type: 6>
ColorFilter.kShaderBase_Type = <Type.kShaderBase_Type: 8>
ColorFilter.kUnused_Type = <Type.kUnused_Type: 9>
ColorFilter.kUnused_Type2 = <Type.kUnused_Type2: 10>
ColorFilter.kUnused_Type3 = <Type.kUnused_Type3: 11>
ColorFilter.kUnused_Type4 = <Type.kUnused_Type4: 7>