鸿蒙开发图形图像——@ohos.effectKit (图像效果)

图像效果提供处理图像的一些基础能力,包括对当前图像的亮度调节、模糊化、灰度调节、智能取色等。

该模块提供以下图像效果相关的常用功能:

  • Filter:效果类,用于添加指定效果到图像源。
  • Color:颜色类,用于保存取色的结果。
  • ColorPicker:智能取色器。

NOTE
本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

导入模块

import effectKit from '@ohos.effectKit';

effectKit.createEffect

createEffect(source: image.PixelMap): Filter

通过传入的PixelMap创建Filter实例。

系统能力: SystemCapability.Multimedia.Image.Core

参数:

在这里插入图片描述

返回值:

在这里插入图片描述

示例:

import image from "@ohos.multimedia.image";

const color = new ArrayBuffer(96);
let opts = {
    editable: true, pixelFormat: 3, size: {
    height: 4, width: 6 } }
image.createPixelMap(color, opts).then((pixelMap) => {
   
  let headFilter = effectKit.createEffect(pixelMap);
})

effectKit.createColorPicker

createColorPicker(source: image.PixelMap): Promise

通过传入的PixelMap创建ColorPicker实例,使用Promise异步回调。

系统能力: SystemCapability.Multimedia.Image.Core

参数:

在这里插入图片描述

返回值:

在这里插入图片描述

示例:

import image from "@ohos.multimedia.image";

const color = new ArrayBuffer(96);
let opts = {
    editable: true, pixelFormat: 3, size: {
    height: 4, width: 6 } }
image.createPixelMap(color, opts).then((pixelMap) =>
  • 16
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值