openharmony 鸿蒙 capi-native-node-h-nodeattributetype-image

2026-08-25 浏览 (1)

ArkUI_NodeAttributeType (Image Component Attribute)

enum ArkUI_NodeAttributeType

Overview

Enumerates the attributes that can be set by ArkUI on the native side for image components including Image and ImageAnimator.

Since: 12

Related module: ArkUI_NativeModule

Header file: native_node.h

NODE_IMAGE_SRC

NODE_IMAGE_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE = 4000

Image address for the Image component. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.stringImage address.
.objectPixelMap object. The parameter type is ArkUI_DrawableDescriptor.
Either .object or .string must be set.

Returns

TypeDescription
.stringImage address.
.objectPixelMap object. The parameter type is ArkUI_DrawableDescriptor.

NODE_IMAGE_OBJECT_FIT

NODE_IMAGE_OBJECT_FIT = 4001

How the image is resized to fit its container. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32How the image is resized to fit its container, specified using the ArkUI_ObjectFit enum.

Returns

TypeDescription
.value[0].i32How the image is resized to fit its container, specified using the ArkUI_ObjectFit enum.

NODE_IMAGE_INTERPOLATION

NODE_IMAGE_INTERPOLATION = 4002

Interpolation effect of the image. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Interpolation effect, which is specified using the ArkUI_ImageInterpolation enum.

Returns

TypeDescription
.value[0].i32Interpolation effect, which is specified using the ArkUI_ImageInterpolation enum.

NODE_IMAGE_OBJECT_REPEAT

NODE_IMAGE_OBJECT_REPEAT = 4003

How the image is repeated. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32How the image is repeated, specified using the ArkUI_ImageRepeat enum.

Returns

TypeDescription
.value[0].i32How the image is repeated, specified using the ArkUI_ImageRepeat enum.

NODE_IMAGE_COLOR_FILTER

NODE_IMAGE_COLOR_FILTER = 4004

Color filter of the image. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].f32 to .value[19].f32Filter matrix array.
.size5 x 4 filter array size.
.objectPointer to the color filter. The parameter type is OH_Drawing_ColorFilter.
Either .object or .size must be set.

Returns

TypeDescription
.value[0].f32 to .value[19].f32Filter matrix array.
.size5 x 4 filter array size.
.objectPointer to the color filter. The parameter type is OH_Drawing_ColorFilter.

NODE_IMAGE_AUTO_RESIZE

NODE_IMAGE_AUTO_RESIZE = 4005

Auto resize attribute, which can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Whether to enable auto resize. The default value is false. true to enable; false otherwise.

Returns

TypeDescription
.value[0].i32Whether auto resize is enabled.

NODE_IMAGE_ALT

NODE_IMAGE_ALT = 4006

Placeholder image attribute, which can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.stringAddress of the placeholder image.
.objectPixelMap object. The parameter type is ArkUI_DrawableDescriptor.
Either .object or .string must be set. Network images are not supported.

Returns

TypeDescription
.stringAddress of the placeholder image.
.objectPixelMap object. The parameter type is ArkUI_DrawableDescriptor.

NODE_IMAGE_DRAGGABLE

NODE_IMAGE_DRAGGABLE = 4007

Whether the image is draggable. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Whether the image is draggable. The value true means that the image is draggable.

Returns

TypeDescription
.value[0].i32Whether the image is draggable.

NODE_IMAGE_RENDER_MODE

NODE_IMAGE_RENDER_MODE = 4008

Image rendering mode. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Image rendering mode. The parameter type is ArkUI_ImageRenderMode.

Returns

TypeDescription
.value[0].i32Image rendering mode. The parameter type is ArkUI_ImageRenderMode.

NODE_IMAGE_FIT_ORIGINAL_SIZE

NODE_IMAGE_FIT_ORIGINAL_SIZE = 4009

Whether the display size of an image follows the original size of the image source. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Whether the display size of an image follows the original size of the image source. The value 1 indicates that the display size of an image follows the original size of the image source, and the value 0 indicates the opposite. The default value is 0.

Returns

TypeDescription
.value[0].i32Whether the display size of an image follows the original size of the image source. The value 1 indicates that the display size of an image follows the original size of the image source, and the value 0 indicates the opposite.

NODE_IMAGE_FILL_COLOR

NODE_IMAGE_FILL_COLOR = 4010

Fill color to be superimposed on the image. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].u32Fill color, in 0xARGB format. For example, 0xFFFF0000 indicates red.

Returns

TypeDescription
.value[0].u32Fill color, in 0xARGB format.

NODE_IMAGE_RESIZABLE

NODE_IMAGE_RESIZABLE = 4011

Resizable image options.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].f32Fixed distance (unchanged during stretching) from the left edge of the image. The unit is vp.
.value[1].f32Fixed distance (unchanged during stretching) from the top edge of the image. The unit is vp.
.value[2].f32Fixed distance (unchanged during stretching) from the right edge of the image. The unit is vp.
.value[3].f32Fixed distance (unchanged during stretching) from the bottom edge of the image. The unit is vp. When this attribute is used together with NODE_IMAGE_ANTIALIASED, the NODE_IMAGE_ANTIALIASED attribute setting does not take effect.
.objectThe parameter type is OH_Drawing_Lattice.

Returns

TypeDescription
.value[0].f32Fixed distance (unchanged during stretching) from the left edge of the image. The unit is vp.
.value[1].f32Fixed distance (unchanged during stretching) from the top edge of the image. The unit is vp.
.value[2].f32Fixed distance (unchanged during stretching) from the right edge of the image. The unit is vp.
.value[3].f32Fixed distance (unchanged during stretching) from the bottom edge of the image. The unit is vp.
.objectThe parameter type is OH_Drawing_Lattice.

NODE_IMAGE_SYNC_LOAD

NODE_IMAGE_SYNC_LOAD = 4012

Synchronous image loading attribute, which can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 20

Parameters

NameDescription
.value[0].i32Whether to load the image synchronously. The default value is false. true: Load the image synchronously. false: Load the image asynchronously.

Returns

TypeDescription
.value[0].i32Whether the image is loaded synchronously.

NODE_IMAGE_SOURCE_SIZE

NODE_IMAGE_SOURCE_SIZE = 4013

Decoding size of the image. This attribute works only when the target size is smaller than the source size. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.value[0].i32Width for image decoding, in px.
.value[1].i32Height for image decoding, in px. If the value of any parameter is less than or equal to 0, the attribute setting fails and ARKUI_ERROR_CODE_PARAM_INVALID is returned, indicating a parameter error.

Returns

TypeDescription
.value[0].i32Width for image decoding, in px.
.value[1].i32Height for image decoding, in px.

NODE_IMAGE_IMAGE_MATRIX

NODE_IMAGE_IMAGE_MATRIX = 4014

Transformation matrix of the image. This attribute can be set, reset, and obtained as required through APIs. Affine image transformation can be implemented using floating-point numbers or matrix objects.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.value[0...15].f324 x 4 matrix represented by a floating-point array with a length of 16. If the number of parameters is less than 16, the attribute setting fails, and ARKUI_ERROR_CODE_PARAM_INVALID is returned, indicating a parameter error. If the number of parameters exceeds 16, only the first 16 data entries are used.
.objectThe parameter type is ArkUI_Matrix4.

Returns

TypeDescription
.value[0...15].f324 x 4 matrix represented by a floating-point array with a length of 16.
.objectThe parameter type is ArkUI_Matrix4.

NODE_IMAGE_MATCH_TEXT_DIRECTION

NODE_IMAGE_MATCH_TEXT_DIRECTION = 4015

Whether the image follows the system language direction, displaying a mirrored effect in a right-to-left (RTL) language environments. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.value[0].i32Whether the image follows the system language direction. The default value is false. true: The image follows the system language direction. false: The image does not follow the system language direction.

Returns

TypeDescription
.value[0].i32whether the image follows the system language direction. true: The image follows the system language direction. false: The image does not follow the system language direction.

NODE_IMAGE_COPY_OPTION

NODE_IMAGE_COPY_OPTION = 4016

Image copy mode. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.value[0].i32Image copy mode, specified using the ArkUI_CopyOptions enum. The default value is ARKUI_COPY_OPTIONS_NONE.

Returns

TypeDescription
.value[0].i32Image copy mode, specified using the ArkUI_CopyOptions enum.

NODE_IMAGE_ENABLE_ANALYZER

NODE_IMAGE_ENABLE_ANALYZER = 4017

Whether to enable the AI analyzer, which supports subject recognition, text recognition, and object lookup. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.value[0].i32Whether to enable the AI analyzer for images. The default value is false. true to enable; false otherwise.

Returns

TypeDescription
.value[0].i32Whether the AI analyzer for images. true indicates that the AI analyzer is enabled; false otherwise.

NODE_IMAGE_DYNAMIC_RANGE_MODE

NODE_IMAGE_DYNAMIC_RANGE_MODE = 4018

Dynamic range attribute for image display, specifying the dynamic range mode for image rendering (for example, SDR/HDR). This attribute can be set, reset, and obtained as required through APIs. It is used to match the capabilities of the display device and ensure accurate presentation of image brightness and colors.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.value[0].i32Dynamic range mode, specified using the ArkUI_DynamicRangeMode enum. The default value is ARKUI_DYNAMIC_RANGE_MODE_STANDARD.

Returns

TypeDescription
.value[0].i32Dynamic range mode, specified using the ArkUI_DynamicRangeMode enum.

NODE_IMAGE_HDR_BRIGHTNESS

NODE_IMAGE_HDR_BRIGHTNESS = 4019

Brightness attribute of the image in HDR mode, used to control brightness parameters for high dynamic range display. This attribute can be set, reset, and obtained as required through APIs. It is used to ensure accurate presentation of details in the bright and dark areas of HDR images.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.value[0].f32Brightness value. The value range is [0, 1]. Values less than 0 or greater than 1.0 are clamped to 1. 0: The image is displayed at SDR brightness. 1: The image is displayed at the highest allowed HDR brightness.

Returns

TypeDescription
.value[0].f32Brightness value. The value range is [0, 1].

NODE_IMAGE_ORIENTATION

NODE_IMAGE_ORIENTATION = 4020

Display orientation of the image content. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.value[0].i32Expected image content display orientation, specified using the ArkUI_Orientation enum. The default value is ARKUI_ORIENTATION_UP.

Returns

TypeDescription
.value[0].i32Expected image content display orientation, specified using the ArkUI_Orientation enum.

NODE_IMAGE_SUPPORT_SVG2

NODE_IMAGE_SUPPORT_SVG2 = 4021

Whether to enable the new SVG parsing capability, which allows you to set the scope of SVG parsing functionality support. This attribute can be set, reset, and obtained as required through APIs. After the Image component is created, the value of this attribute cannot be dynamically changed.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.value[0].i32Whether to enable the new SVG parsing capability.

Returns

TypeDescription
.value[0].i32Whether the new SVG parsing capability is enabled.

NODE_IMAGE_CONTENT_TRANSITION

NODE_IMAGE_CONTENT_TRANSITION = 4022

Transition effect when the image changes. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 21

Parameters

NameDescription
.objectCustom transition animation. The parameter type is ArkUI_ContentTransitionEffect.

Returns

TypeDescription
.objectCustom transition animation. The parameter type is ArkUI_ContentTransitionEffect.

NODE_IMAGE_ALT_PLACEHOLDER

NODE_IMAGE_ALT_PLACEHOLDER  = 4023

Placeholder image during the loading process. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 22

Parameters

NameDescription
.stringPlaceholder image address during the loading of the image component.
.objectPixelMap object. The parameter type is ArkUI_DrawableDescriptor.
Either .object or .string must be set. Network images are not supported.

Returns

TypeDescription
.stringPlaceholder image address during the loading of the image component.
.objectPixelMap object. The parameter type is ArkUI_DrawableDescriptor.

NODE_IMAGE_ALT_ERROR

NODE_IMAGE_ALT_ERROR  = 4024

Placeholder image in the loading failure scenarios. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 22

Parameters

NameDescription
.stringPlaceholder image address in the loading failure scenarios.
.objectPixelMap object. The parameter type is ArkUI_DrawableDescriptor.
Either .object or .string must be set. Network images are not supported.

Returns

TypeDescription
.stringPlaceholder image address in the loading failure scenarios.
.objectPixelMap object. The parameter type is ArkUI_DrawableDescriptor.

NODE_IMAGE_ANTIALIASED

NODE_IMAGE_ANTIALIASED = 4025

Whether to enable anti-aliasing for the edges of a bitmap image. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 23

Parameters

NameDescription
.value[0].i32Whether to enable anti-aliasing for the edges of a bitmap image. The default value is false. true to enable; false otherwise. This attribute does not take effect when used together with NODE_IMAGE_RESIZABLE.

Returns

TypeDescription
.value[0].i32Whether anti-aliasing is enabled for the edges of a bitmap image. true means enabled; false otherwise.

NODE_IMAGE_ANIMATOR_IMAGES

NODE_IMAGE_ANIMATOR_IMAGES = ARKUI_NODE_IMAGE_ANIMATOR * MAX_NODE_SCOPE_NUM = 19000

Image frame information set of the frame animation component. Dynamic update is not supported. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.sizeNumber of image frames.
.objectImage frame array. The parameter type is ArkUI_ImageAnimatorFrameInfo.

Returns

TypeDescription
.sizeNumber of image frames.
.objectImage frame array. The parameter type is ArkUI_ImageAnimatorFrameInfo.

NODE_IMAGE_ANIMATOR_STATE

NODE_IMAGE_ANIMATOR_STATE = 19001

Playback status of the frame-by-frame animation. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Playback state of the frame-by-frame animation. The parameter type is ArkUI_AnimationStatus. The default state is initial.

Returns

TypeDescription
.value[0].i32Playback state of the frame-by-frame animation. The parameter type is ArkUI_AnimationStatus.

NODE_IMAGE_ANIMATOR_DURATION

NODE_IMAGE_ANIMATOR_DURATION = 19002

Playback duration of the frame-by-frame animation. This attribute does not take effect when a separate duration is set for any of the image frames. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Playback duration, in milliseconds. The default value is 1000.

Returns

TypeDescription
.value[0].i32Playback duration, in milliseconds. The default value is 1000.

NODE_IMAGE_ANIMATOR_REVERSE

NODE_IMAGE_ANIMATOR_REVERSE = 19003

Playback direction of the frame-by-frame animation. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Playback direction. The value 0 indicates that images are played from the first one to the last one, and 1 indicates that images are played from the last one to the first one. The default value is 0.

Returns

TypeDescription
.value[0].i32Playback direction. The value 0 indicates that images are played from the first one to the last one, and 1 indicates that images are played from the last one to the first one.

NODE_IMAGE_ANIMATOR_FIXED_SIZE

NODE_IMAGE_ANIMATOR_FIXED_SIZE = 19004

Whether the image size is fixed at the component size. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Whether the image size is fixed at the component size. The value 1 indicates that the image size is fixed at the component size. The value 0 indicates that the width, height, top, and left attributes of each image must be set separately. The default value is 1.

Returns

TypeDescription
.value[0].i32Whether the image size is fixed at the component size. The value 1 indicates that the image size is fixed at the component size. The value 0 indicates that the width, height, top, and left attributes of each image must be set separately.

NODE_IMAGE_ANIMATOR_FILL_MODE

NODE_IMAGE_ANIMATOR_FILL_MODE = 19005

Status before and after execution of the frame-by-frame animation in the current playback direction. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Status before and after execution of the frame-by-frame animation in the current playback direction. The parameter type is ArkUI_AnimationFillMode. The default value is ARKUI_ANIMATION_FILL_MODE_FORWARDS.

Returns

TypeDescription
.value[0].i32Status before and after execution of the frame-by-frame animation in the current playback direction. The parameter type is ArkUI_AnimationFillMode.

NODE_IMAGE_ANIMATOR_ITERATION

NODE_IMAGE_ANIMATOR_ITERATION = 19006

Number of times that the frame-by-frame animation is played. This attribute can be set, reset, and obtained as required through APIs.
The format of the ArkUI_AttributeItem parameter for setting the attribute and the format of the return value ArkUI_AttributeItem are as follows.

Since: 12

Parameters

NameDescription
.value[0].i32Number of times that the animation is played.

Returns

TypeDescription
.value[0].i32Number of times that the animation is played.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-uicontext-contextmenucontroller

openharmony 鸿蒙 errorcode-canvas

openharmony 鸿蒙 capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent

openharmony 鸿蒙 errorcode-bindSheet

openharmony 鸿蒙 js-apis-arkui-uiExtension-sys

openharmony 鸿蒙 capi-arkui-accessibility-arkui-accessibilityeventinfo

openharmony 鸿蒙 capi-arkui-rendernodeutils

openharmony 鸿蒙 js-apis-arkui-node

openharmony 鸿蒙 capi-native-node-h

openharmony 鸿蒙 capi-arkui-nativemodule-arkui-listitemswipeactionitem

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/OYEYsgxj