搜索插件、代码仓与 APP 分类

插件详情v0.1.1

rough

Rough 是一个库,允许您以粗糙、手绘风格进行绘制

近 30 天下载
10
喜欢数
32
Pub 分数
40

安装插件

flutter pub add rough

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Rough 是一个 Flutter 库,使开发者能够在其应用程序中创建粗糙、手绘风格的绘画。它模拟了真实铅笔或钢笔素描的不完美之处,让数字艺术作品感觉更加自然和有机。适用于交互式绘画功能、签名输入或艺术化 UI 元素,Rough 提供了一个简单的 API 来以粗糙的美学渲染线条、形状和文本。该库轻量且可通过 pub.dev 无缝集成到 Flutter 项目中。

适合场景

  • 手绘风格注释
  • 数字签名捕获
  • 艺术化用户界面元素
  • 基于草图的界面
  • 交互式白板

主要特点

  • 手绘线条渲染
  • 可自定义的粗糙度
  • 对形状和文本的支持
  • 轻量且易于集成
  • 实时草图支持

适合对象

  • 寻求富有表现力的绘图工具的应用开发者
  • 想要有机视觉效果的设计师
  • 带有绘图功能的教育类应用程序
  • 原型设计交互草图

使用建议

  • 限制为2D绘图
  • 没有高级编辑工具
  • 性能在复杂场景下可能有所不同
  • 不适用于高精度图形

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Pub GitHub Release Date GitHub

Rough

Rough is a library that allows you draw in a sketchy, hand-drawn-like style. It's a direct port of Rough.js.

Installation

In the dependencies: section of your pubspec.yaml, add the following line:

dependencies:
  rough: <latest_version>

Basic usage

Right now only drawing via canvas is supported. This is a basic documentation in case you want to play around with Rough. I can't ensure non-breaking changes of the library interface.

To draw a figure you have to:

  1. Create a DrawConfig object to determine how your drawing will look.
  2. Create a Filler to be used when drawing objects (you have to provide a configuration for the filling and a DrawConfig for the filling path).
  3. Create a Generator object using the created DrawConfig and Filler. This will define a drawing/filling style.
  4. Invoke the drawing method from the Generator to create a Drawable.
  5. Paint the Drawable in the canvas using the drawRough method extension for Canvas.

Here an example on how to draw a circle:

//Create a `DrawConfig` object.
DrawConfig myDrawConfig = DrawConfig.build(
  roughness: 3,
  curveStepCount: 14,
  maxRandomnessOffset: 3,
);

//Create a `Filler` with a configuration (we reuse the drawConfig in this case).
FillerConfig myFillerConfig = FillerConfig(
    hachureGap: 8,
    hachureAngle: -20,
    drawConfig: myDrawConfig,
);
Filler myFiller = ZigZagFiller(myFillerConfig);

//Create a `Generator` with the created `DrawConfig` and `Filler`
Generator generator = Generator(
  myDrawConfig,
  myFiller,
);

//4. Build a circle `Drawable`.
Drawable figure = generator.circle(200, 200, 320);

//5. Paint the `Drawable` in the canvas.
Canvas.drawRough(figure, pathPaint, fillPaint);

And this is the result:

Result

Both DrawConfig and FillerConfig will use default values for anything not specified.

Samples

Some screenshots of the example app:

Example 1 Example 2 Example 3 Example 4

所属分类

源码仓库

使用此插件的项目

暂无相关数据。