搜尋套件、儲存庫與 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

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。