diff --git a/en/application-dev/reference/apis-arkgraphics2d/effect__filter_8h.md b/en/application-dev/reference/apis-arkgraphics2d/effect__filter_8h.md index 1ddccbf9085d7a1ea4a77ad1b23c8bddc593563a..7115f97974ca123f467217cd04a2bd71863f28ce 100644 --- a/en/application-dev/reference/apis-arkgraphics2d/effect__filter_8h.md +++ b/en/application-dev/reference/apis-arkgraphics2d/effect__filter_8h.md @@ -32,3 +32,4 @@ The **effect_filter.h** file declares the APIs of an image effect filter. | [EffectErrorCode](effect_kit.md#effecterrorcode) [OH_Filter_Invert](effect_kit.md#oh_filter_invert) ([OH_Filter](effect_kit.md#oh_filter) \*filter) | Creates the inverted color effect and adds it to a filter.| | [EffectErrorCode](effect_kit.md#effecterrorcode) [OH_Filter_SetColorMatrix](effect_kit.md#oh_filter_setcolormatrix) ([OH_Filter](effect_kit.md#oh_filter) \*filter, [OH_Filter_ColorMatrix](_o_h___filter___color_matrix.md) \*matrix) | Creates a custom effect through a matrix and adds it to a filter.| | [EffectErrorCode](effect_kit.md#effecterrorcode) [OH_Filter_GetEffectPixelMap](effect_kit.md#oh_filter_geteffectpixelmap) ([OH_Filter](effect_kit.md#oh_filter) \*filter, [OH_PixelmapNative](effect_kit.md#oh_pixelmapnative) \*\*pixelmap) | Obtains the pixel map used to create a filter.| +| [EffectErrorCode](effect_kit.md#effecterrorcode) [OH_Filter_GetEffectPixelMapUseCpuRender](effect_kit.md#oh_filter_geteffectpixelmapusecpurender) ([OH_Filter](effect_kit.md#oh_filter) \*filter, [OH_PixelmapNative](effect_kit.md#oh_pixelmapnative) \*\*pixelmap, bool useCpuRender) | Obtains the pixel map used to create a filter.| \ No newline at end of file diff --git a/en/application-dev/reference/apis-arkgraphics2d/effect_kit.md b/en/application-dev/reference/apis-arkgraphics2d/effect_kit.md index b11f1e468ed4ea91326f1ad7bfcb6e8dcaf009ae..d8cd2f162fa32016340b70eb0104ca5a978d6308 100644 --- a/en/application-dev/reference/apis-arkgraphics2d/effect_kit.md +++ b/en/application-dev/reference/apis-arkgraphics2d/effect_kit.md @@ -57,7 +57,7 @@ The EffectKit module provides the basic image processing capabilities, including | [EffectErrorCode](#effecterrorcode) [OH_Filter_Invert](#oh_filter_invert) ([OH_Filter](#oh_filter) \*filter) | Creates the inverted color effect and adds it to a filter.| | [EffectErrorCode](#effecterrorcode) [OH_Filter_SetColorMatrix](#oh_filter_setcolormatrix) ([OH_Filter](#oh_filter) \*filter, [OH_Filter_ColorMatrix](_o_h___filter___color_matrix.md) \*matrix) | Creates a custom effect through a matrix and adds it to a filter.| | [EffectErrorCode](#effecterrorcode) [OH_Filter_GetEffectPixelMap](#oh_filter_geteffectpixelmap) ([OH_Filter](#oh_filter) \*filter, [OH_PixelmapNative](#oh_pixelmapnative) \*\*pixelmap) | Obtains the PixelMap used to create a filter.| - +| [EffectErrorCode](#effecterrorcode) [OH_Filter_GetEffectPixelMapUseCpuRender](#oh_filter_geteffectpixelmapusecpurender) ([OH_Filter](#oh_filter) \*filter, [OH_PixelmapNative](#oh_pixelmapnative) \*\*pixelmap, bool useCpuRender) | Obtains the PixelMap used to create a filter.| ## Type Description @@ -258,6 +258,29 @@ Obtains the PixelMap used to create a filter. Returns a status code defined in [EffectErrorCode](#effecterrorcode). +### OH_Filter_GetEffectPixelMapUseCpuRender() + +``` +EffectErrorCode OH_Filter_GetEffectPixelMapUseCpuRender (OH_Filter* filter, OH_PixelmapNative** pixelmap, bool useCpuRender) +``` + +**Description** + +Obtains the PixelMap used to create a filter. + +**Since**: 20 + +**Parameters** + +| Name| Description| +| -------- | -------- | +| filter | Pointer to the filter.| +| pixelmap | Double pointer to the PixelMap obtained.| +| useCpuRender | Whether to use cpu render.| + +**Returns** + +Returns a status code defined in [EffectErrorCode](#effecterrorcode). ### OH_Filter_GrayScale() diff --git a/en/application-dev/reference/apis-arkgraphics2d/js-apis-effectKit.md b/en/application-dev/reference/apis-arkgraphics2d/js-apis-effectKit.md index 2555484f226cedc389089b45589797d9a26924fb..df155d9aa48bcb5c626257df1fe983f53f89c00e 100644 --- a/en/application-dev/reference/apis-arkgraphics2d/js-apis-effectKit.md +++ b/en/application-dev/reference/apis-arkgraphics2d/js-apis-effectKit.md @@ -997,6 +997,53 @@ image.createPixelMap(color, opts).then((pixelMap) => { }) ``` +### getEffectPixelMap20+ + +getEffectPixelMap(useCpuRender : boolean): Promise + +Obtains **image.PixelMap** of the source image to which the filter linked list is added. This API uses a promise to return the result. + +**Widget capability**: This API can be used in ArkTS widgets since API version 20. + +**Atomic service API**: This API can be used in atomic services since API version 20. + +**System capability**: SystemCapability.Multimedia.Image.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ----------- | ---- | ------------------------------------------------------------ | +| useCpuRender | boolean | Yes | Whether to use cpu render.| + +**Return value** + +| Type | Description | +| ---------------------- | -------------- | +| Promise\ | Promise used to return **image.PixelMap** of the source image.| + + +**Example** + +```ts +import { image } from "@kit.ImageKit"; +import { effectKit } from "@kit.ArkGraphics2D"; + +const color = new ArrayBuffer(96); +let opts : image.InitializationOptions = { + editable: true, + pixelFormat: 3, + size: { + height: 4, + width: 6 + } +}; +image.createPixelMap(color, opts).then((pixelMap) => { + effectKit.createEffect(pixelMap).grayscale().getEffectPixelMap(false).then(data => { + console.info('getPixelBytesNumber = ', data.getPixelBytesNumber()); + }) +}) +``` + ### getPixelMap(deprecated) getPixelMap(): image.PixelMap diff --git a/zh-cn/application-dev/reference/apis-arkgraphics2d/capi-effect-filter-h.md b/zh-cn/application-dev/reference/apis-arkgraphics2d/capi-effect-filter-h.md index 7f8fdb43d8256674bba409003d190f2bf74d5179..7683602c0628a4e44b8ee3a5ac1eae12c3fb6753 100644 --- a/zh-cn/application-dev/reference/apis-arkgraphics2d/capi-effect-filter-h.md +++ b/zh-cn/application-dev/reference/apis-arkgraphics2d/capi-effect-filter-h.md @@ -29,6 +29,7 @@ | [EffectErrorCode OH_Filter_Invert(OH_Filter* filter)](#oh_filter_invert) | 创建一个反色效果并且添加到滤镜中。 | | [EffectErrorCode OH_Filter_SetColorMatrix(OH_Filter* filter, OH_Filter_ColorMatrix* matrix)](#oh_filter_setcolormatrix) | 通过矩阵创建一个自定义的效果并且添加到滤镜中。 | | [EffectErrorCode OH_Filter_GetEffectPixelMap(OH_Filter* filter, OH_PixelmapNative** pixelmap)](#oh_filter_geteffectpixelmap) | 获取滤镜生成的位图。 | +| [EffectErrorCode OH_Filter_GetEffectPixelMapUseCpuRender(OH_Filter* filter, OH_PixelmapNative** pixelmap, bool useCpuRender)](#oh_filter_geteffectpixelmapusecpurender) | 获取滤镜生成的位图。 | ## 函数说明 @@ -264,4 +265,29 @@ EffectErrorCode OH_Filter_GetEffectPixelMap(OH_Filter* filter, OH_PixelmapNative | -- | -- | | [EffectErrorCode](capi-effect-types-h.md#effecterrorcode) | 返回结果参见状态码[EffectErrorCode](capi-effect-types-h.md#effecterrorcode)。 | +### OH_Filter_GetEffectPixelMapUseCpuRender() +``` +EffectErrorCode OH_Filter_GetEffectPixelMapUseCpuRender(OH_Filter* filter, OH_PixelmapNative** pixelmap, bool useCpuRender) +``` + +**描述** + +获取滤镜生成的位图。 + +**起始版本:** 20 + + +**参数:** + +| 参数项 | 描述 | +| -- | -- | +| [OH_Filter](capi-effectkit-oh-filter.md)* filter | 用来创建位图的滤镜指针。 | +| [OH_PixelmapNative](capi-drawing-oh-pixelmapnative.md)** pixelmap | 用来接收位图的二级指针。 | +| bool useCpuRender | 用来指定是否使用CPU绘制。 | + +**返回:** + +| 类型 | 说明 | +| -- | -- | +| [EffectErrorCode](capi-effect-types-h.md#effecterrorcode) | 返回结果参见状态码[EffectErrorCode](capi-effect-types-h.md#effecterrorcode)。 | diff --git a/zh-cn/application-dev/reference/apis-arkgraphics2d/js-apis-effectKit.md b/zh-cn/application-dev/reference/apis-arkgraphics2d/js-apis-effectKit.md index 4ad116264d1721c1218cb517d7f3acafada54c2a..c3b10e4b3d2e016c730a488dd110a68100a24ea9 100644 --- a/zh-cn/application-dev/reference/apis-arkgraphics2d/js-apis-effectKit.md +++ b/zh-cn/application-dev/reference/apis-arkgraphics2d/js-apis-effectKit.md @@ -997,6 +997,53 @@ image.createPixelMap(color, opts).then((pixelMap) => { }) ``` +### getEffectPixelMap20+ + +getEffectPixelMap(useCpuRender : boolean): Promise + +获取已添加链表效果的源图像的image.PixelMap,使用Promise异步回调。 + +**卡片能力:** 从API version 20开始,该接口支持在ArkTS卡片中使用。 + +**原子化服务API:** 从API version 20开始,该接口支持在原子化服务中使用。 + +**系统能力:** SystemCapability.Multimedia.Image.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------- | ---- | ------------------------------------------------------------ | +| useCpuRender | boolean | 是 | 是否使用CPU绘制。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | -------------- | +| Promise\ | Promise对象。返回已添加链表效果的源图像的image.PixelMap。 | + + +**示例:** + +```ts +import { image } from "@kit.ImageKit"; +import { effectKit } from "@kit.ArkGraphics2D"; + +const color = new ArrayBuffer(96); +let opts : image.InitializationOptions = { + editable: true, + pixelFormat: 3, + size: { + height: 4, + width: 6 + } +}; +image.createPixelMap(color, opts).then((pixelMap) => { + effectKit.createEffect(pixelMap).grayscale().getEffectPixelMap(false).then(data => { + console.info('getPixelBytesNumber = ', data.getPixelBytesNumber()); + }) +}) +``` + ### getPixelMap(deprecated) getPixelMap(): image.PixelMap