impl super::Image {
pub fn set_image_src<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageSrc,
value.into(),
)
}
pub fn get_image_src(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageSrc,
)
}
pub fn set_image_object_fit<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageObjectFit,
value.into(),
)
}
pub fn get_image_object_fit(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageObjectFit,
)
}
pub fn set_image_interpolation<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageInterpolation,
value.into(),
)
}
pub fn get_image_interpolation(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageInterpolation,
)
}
pub fn set_image_object_repeat<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageObjectRepeat,
value.into(),
)
}
pub fn get_image_object_repeat(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageObjectRepeat,
)
}
pub fn set_image_color_filter<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageColorFilter,
value.into(),
)
}
pub fn get_image_color_filter(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageColorFilter,
)
}
pub fn set_image_auto_resize<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageAutoResize,
value.into(),
)
}
pub fn get_image_auto_resize(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageAutoResize,
)
}
pub fn set_image_alt<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageAlt,
value.into(),
)
}
pub fn get_image_alt(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageAlt,
)
}
pub fn set_image_draggable<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageDraggable,
value.into(),
)
}
pub fn get_image_draggable(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageDraggable,
)
}
pub fn set_image_render_mode<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageRenderMode,
value.into(),
)
}
pub fn get_image_render_mode(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageRenderMode,
)
}
pub fn set_image_fit_original_size<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageFitOriginalSize,
value.into(),
)
}
pub fn get_image_fit_original_size(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageFitOriginalSize,
)
}
pub fn set_image_fill_color<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageFillColor,
value.into(),
)
}
pub fn get_image_fill_color(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageFillColor,
)
}
pub fn set_image_resizable<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageResizable,
value.into(),
)
}
pub fn get_image_resizable(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageResizable,
)
}
#[cfg(feature = "api-22")]
pub fn set_image_alt_error<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageAltError,
value.into(),
)
}
#[cfg(feature = "api-22")]
pub fn get_image_alt_error(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageAltError,
)
}
#[cfg(feature = "api-22")]
pub fn set_image_alt_placeholder<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageAltPlaceholder,
value.into(),
)
}
#[cfg(feature = "api-22")]
pub fn get_image_alt_placeholder(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageAltPlaceholder,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_content_transition<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageContentTransition,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_content_transition(
&self,
) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageContentTransition,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_copy_option<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageCopyOption,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_copy_option(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageCopyOption,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_dynamic_range_mode<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageDynamicRangeMode,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_dynamic_range_mode(
&self,
) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageDynamicRangeMode,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_enable_analyzer<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageEnableAnalyzer,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_enable_analyzer(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageEnableAnalyzer,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_hdr_brightness<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageHdrBrightness,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_hdr_brightness(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageHdrBrightness,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_image_matrix<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageImageMatrix,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_image_matrix(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageImageMatrix,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_match_text_direction<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageMatchTextDirection,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_match_text_direction(
&self,
) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageMatchTextDirection,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_orientation<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageOrientation,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_orientation(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageOrientation,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_source_size<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageSourceSize,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_source_size(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageSourceSize,
)
}
#[cfg(feature = "api-21")]
pub fn set_image_support_svg2<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageSupportSvg2,
value.into(),
)
}
#[cfg(feature = "api-21")]
pub fn get_image_support_svg2(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageSupportSvg2,
)
}
#[cfg(feature = "api-20")]
pub fn set_image_sync_load<T: Into<crate::ArkUINodeAttributeItem>>(
&self,
value: T,
) -> crate::ArkUIResult<()> {
<Self as crate::ArkUICommonAttribute>::set_attribute(
self,
crate::ArkUINodeAttributeType::ImageSyncLoad,
value.into(),
)
}
#[cfg(feature = "api-20")]
pub fn get_image_sync_load(&self) -> crate::ArkUIResult<crate::ArkUINodeAttributeItem> {
<Self as crate::ArkUICommonAttribute>::get_attribute(
self,
crate::ArkUINodeAttributeType::ImageSyncLoad,
)
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ImageCompleteEvent {
pub loading_status: i32,
pub width: f32,
pub height: f32,
pub component_width: f32,
pub component_height: f32,
pub content_offset_x: f32,
pub content_offset_y: f32,
pub content_width: f32,
pub content_height: f32,
}
impl super::Image {
pub fn on_image_complete<T: Fn(ImageCompleteEvent) + 'static>(&mut self, cb: T) {
crate::ArkUIEvent::on_event(self, crate::NodeEventType::ImageOnComplete, move |event| {
cb(ImageCompleteEvent {
loading_status: event.i32_value(0).unwrap_or_default(),
width: event.f32_value(1).unwrap_or_default(),
height: event.f32_value(2).unwrap_or_default(),
component_width: event.f32_value(3).unwrap_or_default(),
component_height: event.f32_value(4).unwrap_or_default(),
content_offset_x: event.f32_value(5).unwrap_or_default(),
content_offset_y: event.f32_value(6).unwrap_or_default(),
content_width: event.f32_value(7).unwrap_or_default(),
content_height: event.f32_value(8).unwrap_or_default(),
});
});
}
pub fn on_image_error<T: Fn(i32) + 'static>(&mut self, cb: T) {
crate::ArkUIEvent::on_event(self, crate::NodeEventType::ImageOnError, move |event| {
cb(event.i32_value(0).unwrap_or_default());
});
}
pub fn on_image_svg_play_finish<T: Fn() + 'static>(&mut self, cb: T) {
crate::ArkUIEvent::on_event_no_param(self, crate::NodeEventType::ImageOnSvgPlayFinish, cb);
}
pub fn on_image_download_progress<T: Fn(u32, u32) + 'static>(&mut self, cb: T) {
crate::ArkUIEvent::on_event(
self,
crate::NodeEventType::ImageOnDownloadProgress,
move |event| {
cb(
event.u32_value(0).unwrap_or_default(),
event.u32_value(1).unwrap_or_default(),
);
},
);
}
}