flutter-canvas

Masking two images in Flutter using a Custom Painter

别来无恙 提交于 2020-03-04 15:38:24
问题 Hello can anyone tell me why the background to this masking attempt is black. This must be close but I just can't kill the background. I've seen others reference that saveLayer(rect, paint) is the key here as that shoves the whole canvas rect in to the masking operation. This question (no masking operation) and this one (no actual answer) are similar but were no use to me. main.dart import 'dart:typed_data'; import 'dart:ui' as ui; import 'package:flutter/cupertino.dart'; import 'package

How to crop circular(or Square or Hexagon ) area from canvas in Flutter

痞子三分冷 提交于 2020-01-06 04:49:08
问题 I want to crop a rectangular image-file and make it circular or square or hexagon shape and save it as image-file locally . I have a bitmap and I want to crop a circular or hexagon region from this bitmap. All pixels outside the circle should be transparent. How can I do this? I found the similar question in android platform. But unable to find a good resource that really help or direct me to achieve this in flutter. Please share me the idea to achieve this result. 回答1: Use Clipper to crop