Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve ColorFilter support #6688

Closed
Closed
@HansMuller

Description

@HansMuller

Currently our support for color filters is just a subset of what SKIA supports.

One simple color filter transformation that isn't currently possible is displaying a color image as grayscale.

In SKIA terms this isn't exactly intuitive, but it's possible:

// See https://skia.org/user/api/skpaint
SkScalar grayscale[20] = {
    0.21, 0.72, 0.07, 0.0, 0.0,
    0.21, 0.72, 0.07, 0.0, 0.0,
    0.21, 0.72, 0.07, 0.0, 0.0,
    0.0,  0.0,  0.0,  1.0, 0.0};
SkPaint paint;
paint.setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(grayscale));

Most of the predefined CSS filters (grayscale is among them) seem like a reasonable and intuitive set to support explicitly in Flutter. Likewise for the CSS support for just stringing together a list of predefined filters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: contributor-productivityTeam-specific productivity, code health, technical debt.c: new featureNothing broken; request for a new capabilitycustomer: galleryRelating to flutter/gallery repository. Please transfer non-framework issues there.engineflutter/engine repository. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions