Skip to content

Improve ColorFilter support #6688

Closed
Closed

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.

Activity

  1. added
    c: new featureNothing broken; request for a new capability
    frameworkflutter/packages/flutter repository. See also f: labels.
    engineflutter/engine related. See also e: labels.
    customer: galleryRelating to flutter/gallery repository. Please transfer non-framework issues there.
    on Nov 3, 2016
  2. added this to the milestone on Feb 27, 2017
  3. long1eu commented on Jan 13, 2019

    @long1eu
    Contributor

    Are there any plans to support passing a Float64List to color filter?

  4. dnfield commented on Jan 14, 2019

    @dnfield
    Contributor
  5. github-actions commented on Aug 31, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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 related. 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