Photofilters 是一個 Flutter 套件,讓開發者能在應用程式中對影像套用多種視覺濾鏡。它支援內建濾鏡與自訂濾鏡建立,讓使用者能設計獨特的子濾鏡。此套件非常適合行動與桌面應用程式的照片編輯功能。支援 Android、iOS、macOS、Windows 與 Linux,提供跨平台的一致性。其直覺的 API 簡化了整合至既有專案的過程。
適用情境
照片應用中的圖像編輯
為使用者上傳的圖片添加創意效果
建構可自訂的照片濾鏡畫廊
增強社交媒體應用的照片分享
創建藝術圖像轉換工具
主要特色
對內建和自訂篩選器的支援
建立子篩選器的能力
跨平台相容性
與 Flutter 的輕鬆整合
輕量且高效能的渲染
適合對象
開發照片編輯應用的開發者
創意工具創作者
跨平台多媒體應用
尋求視覺增強的UI設計師
需要即時影像過濾的應用程式
使用建議
需要了解影像處理基礎知識
自訂過濾器的建立可能需要反覆試誤
效能可能在低階設備上有所差異
除了基本範例外,文件有限
可能需要額外的資產管理來處理複雜過濾器
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
Photo Filters package for flutter
A flutter package for iOS and Android for applying filter to an image. A set of preset filters are also available. You can create your own filters too.
There are two types of filters. ImageFilter and ColorFilter.
Image Filter
Image filter applies its subfilters directly to the whole image one by one. It is computationally expensive since the complexity & time increases as the number of subfilters increases.
You can create your own custom image filter as like this:
Color filter applies its subfilters to each pixel one by one. It is computationally less expensive than the ImageFilter. It will loop through the image pixels only once irrespective of the number of subfilters.
You can create your own custom color filter as like this:
import'package:photofilters/filters/color_filters.dart';
var customColorFilter = newColorFilter(name: "Custom Color Filter");
customColorFilter.addSubFilter(SaturationSubFilter(0.5));
customColorFilter
.addSubFilters([BrightnessSubFilter(0.5), HueRotationSubFilter(30)]);
You can inherit the ColorFilter class too
classMyColorFilterextendsColorFilter{
MyColorFilter() : super(name: "My Custom Color Filter") {
this.addSubFilter(BrightnessSubFilter(0.8));
this.addSubFilter(HueRotationSubFilter(30));
}
}
Sub filters
There are two types of subfilters. One can be added to the ColorFilter and the other can be added to the ImageFilter. You can inherit ColorSubFilter class to implement the former and you can use the ImageSubFilter mixin to implement the latter. You can create a same subfilter that can be used for both Image and Color Filters. The BrightnessSubFilter is an example of this.
classBrightnessSubFilterextendsColorSubFilterwithImageSubFilter{
finalnum brightness;
BrightnessSubFilter(this.brightness);
///Apply the [BrightnessSubFilter] to an Image.@overridevoidapply(Uint8List pixels, int width, int height) =>
image_filter_utils.brightness(pixels, brightness);
///Apply the [BrightnessSubFilter] to a color.@override
RGBA applyFilter(RGBA color) =>
color_filter_utils.brightness(color, brightness);
}
Getting Started
For help getting started with Flutter, view our online documentation.
For help on editing package code, view the documentation.