패키지, 저장소 및 앱 카테고리 검색

finger_painter 표지
패키지 상세v1.1.0

finger_painter

다양한 브러시와 혼합 모드로 손가락으로 그림을 그릴 수 있는 페인팅 패키지입니다. 결과는 비트맵 또는 지도 등에 사용할 수 있는 점 목록으로 읽을 수 있습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
59
좋아요
45
Pub 점수
130

패키지 설치

flutter pub add finger_painter

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

사용자 정의 브러시와 블렌드 모드를 지원하는 상호작용식 손가락 그림을 가능하게 하는 플러터 패키지입니다. 사용자는 화면에 직접 디지털 아트워크를 만들 수 있으며, 여러 플랫폼에서 터치 입력을 지원합니다. 그려진 결과는 비트맵 이미지 또는 포인트 목록으로 내보낼 수 있어, 매핑이나 데이터 처리 등에 활용할 수 있습니다. 창의적 애플리케이션, 드로잉 도구, 또는 제스처 기반 입력이 필수적인 인터랙티브 맵에 적합합니다.

사용 사례

  • 디지털 스케치
  • 인터랙티브 지도 주석
  • 제스처 기반 예술 앱
  • 교육용 도면 도구
  • 사용자 지정 서명 캡처

주요 기능

  • 다양한 브러시 유형
  • 블렌드 모드 지원
  • 비트맵 내보내기
  • 점 목록 출력
  • 크로스 플랫폼 호환성

적합한 대상

  • 예술가 및 디자이너
  • 교육 앱 개발자
  • 지도 상호작용 기능
  • 터치 기반 사용자 인터페이스
  • 창의적인 프로토타이핑

고려 사항

  • 저사양 기기에서는 성능이 다를 수 있습니다
  • 최적의 사용을 위해서는 터치 입력이 필요합니다
  • 2D 캔버스 렌더링에 제한됨
  • 내장된 되돌리기/다시실행 기능 없음
  • 복잡한 제스처를 처리하기 위해 추가 로직이 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Painting package that let you finger paint with different brushes and different blend modes. The result can be read as a bitmap or list of Points to be used ie on a Map.

Features

Pub Version Pub Publisher

Image

Getting started

The usage is simple: put the Painter() widget into your widget tree then use PainterController() to control its parameters and to get current painting image and/or drawn points.

Try online

Features

  • 3 kinds of pens
  • min and max stroke width for paintbrush strokes
  • get the last drawing image and drawing points
  • set a background widget (like Google Map)
  • set background color
  • uses image blending modes while painting

Usage

initialize the painter controller ie in the initState():

@override
void initState() {
  super.initState();
  painterController = PainterController()
    ..setPenType(PenType.pencil)
    ..setStrokeColor(Colors.black)
    ..setMinStrokeWidth(3)
    ..setMaxStrokeWidth(10)
    ..setBlurSigma(0.0)
    ..setBlendMode(ui.BlendMode.srcOver);
}

insert Painter() widget somewhere in your widget tree:

Painter(
  controller: painterController,
  backgroundColor: Colors.green.withOpacity(0.4),
  size: const Size(300, 300),
  child: Image.asset(...),
  onDrawingEnded: (Uint8List bytes) async{
    ...
  },
  // the child could be ie a Google Map
  // PS: the [backgroundColor] and child are not rendered in the resulting image 
  child: Image.asset('assets/...'),
),

Full example

📜 Painter widget properties
Properties Required Default Description
key false Widget key.
controller false Get and set Painter parameters (see PainterController below).
backgroundColor false Colors.transparent Color of the active painting area.
size false Size of painting area. If not set it takes the child area. If also the child is not set, it will take the available size from the parent.
child false Child Widget to put as the background of the painting area
onDrawingEnded false Callbackd that returns the last drawing as Uint8List filled with uncompressed BMP 32 bpp format. Here it's possible to get the drawn point with controller.getPoints()
📜 PainterController
Method return type Description
getState() PenState? Get the penType, strokeColor, strokeMinWidth, strokeMaxWidth, blendMode.
getImageBytes() Uint8List? Get current drawing image as uncompressed 32bit BMP Uint8List.
getPoints() List<Offset>? Get the point list drawn.
clearContent({Color? clearColor}) Clear current drawings with [clearColor] color. Default is transparent.
setPenType(PenType type) Set pen type: pencil, paintbrush, paintbrush2.
setBlendMode(ui.BlendMode mode) Set the painting blending mode. ui.BlendMode.dstOut can be used as an eraser pen.
setStrokeColor(Color color) Set stroke color.
setMinStrokeWidth(double width) Set the minimum stroke width.
setMaxStrokeWidth(double width) Set the maximum stroke width.
setBlurSigma(double sigma) Set the blur. 0 means no blur.
setBackgroundImage(Uint8List image) Set the background image. The painting will not modify this image.
📜 PenState
Method Default Description
penType PenType.paintbrush enum with pencil, paintbrush, paintbrush2.
pencil: constant stroke width using strokeMinWidth
paintBrush: variable stroke width. Near strokeMinWidth when moving slowly, near strokeMaxWidth when moving fast.
paintBrush2: variable stroke width. Near strokeMaxWidth when moving slowly, near strokeMinWidth when moving fast.
strokeColor Colors.black pen color
strokeMinWidth 3 Pen width when moving slowing.
strokeMaxWidth 10 Pen width when moving fast.
blurSigma 0 Blur stroke.
blendMode ui.BlendMode.srcOver Painting blending mode. See ui.BlendMode
⚠️ Note on web

The html renderer running on Web is not supported and using it will not save the drawing. https://github.com/flutter/flutter/issues/42767

Hence when using this package on web, the canvaskit renderer must be used, ie: flutter run -d chrome --web-renderer canvaskit

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.