Skip to content

Feature: post process tiles with ColorFiltered widget #581

@matthiasdittmer

Description

@matthiasdittmer

Hello, I suggest a small update to TileLayerOptions with an optional parameter for a ColorFilter.matrix to post process the tiles. Widget ColorFiltered.

Below the modified code sample for gray scale tiles (hard coded). Could also be used for visual enhancements (contrast, night vision, ...).

    return ColorFiltered(
        colorFilter: ColorFilter.matrix(<double>[
          0.2126,0.7152,0.0722,0,0,
          0.2126,0.7152,0.0722,0,0,
          0.2126,0.7152,0.0722,0,0,
          0,0,0,1,0,
        ]),
      child: Opacity(
        opacity: options.opacity,
        child: Container(
          color: options.backgroundColor,
          child: Stack(
          children: tileWidgets,
        ),
      ),
      ),
    );
  }

Edit: posted wrong code, now with child.

Not sure if this is the best place to do the filtering performance wise. Please comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions