#include#include void setColorFilterExample(SkPaint& paint) { SkColorFilter* filter = SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkBlendMode::kSrcIn); paint.setColorFilter(filter); }
#includeIn this example, we are using the SkColorFilter MakeHighContrast function to create a high contrast color filter. This filter will intensify the colors of the image and make it visually accessible to people with color vision deficiency. We then set the filter to the paint object using SkPaint setColorFilter. This example demonstrates how to create a more complex color filter and apply it to a paint object. Package library: Skia In conclusion, SkPaint setColorFilter is a useful function that allows us to modify the colors of a bitmap or a drawing. With SkColorFilter, we can apply various color filters to the SkPaint object and change the appearance of the image. These examples demonstrate how to use SkPaint setColorFilter to create different types of color filters and apply them to a SkPaint object. All examples use cpp Skia package library.#include void setColorFilterExample(SkPaint& paint) { SkColorFilter* filter = SkColorFilter::MakeHighContrast(3.0f, SkHighContrastConfig::BLACK_INVERTED_HC); paint.setColorFilter(filter); }