#ifndef TJDUI_APP_SPORT_DRAW_GUI_API_H #define TJDUI_APP_SPORT_DRAW_GUI_API_H #include "TjdUiMultiLanguageExt.h" #include "components/ui_button.h" #include "components/ui_canvas.h" #include "components/ui_canvas_ext.h" #include "components/ui_circle_progress.h" #include "components/ui_image_view.h" #include "components/ui_label.h" #include "components/ui_list.h" #include "components/ui_qrcode.h" #include "components/ui_scroll_view.h" #include "components/ui_transform_list.h" #include "components/ui_view_group.h" namespace TJD { // ---------------------------------------------------------------------------- // 函数: InitLabelHorCenter // 描述: 初始化一个 UILabel,设置其字体大小、文本和垂直位置,并在目标宽度内水平居中。 // 参数: // label - 要初始化的 UILabel 对象 // size - 标签的字体大小 // y - 标签的垂直位置 // target - 用于水平居中的目标区域宽度 // text - 标签显示的文本 // color - 字体颜色 // ---------------------------------------------------------------------------- void InitLabelHorCenter(OHOS::UILabel &label, uint8_t size, int16_t y, int16_t target, const char *text, const char *fontName = TJD_VECTOR_FONT_FILENAME); void InitLabelHorCenter(OHOS::UILabel &label, uint8_t size, int16_t y, int16_t target, const char *text, uint64_t color); // ---------------------------------------------------------------------------- // 函数: InitLabel // 描述: 初始化一个 UILabel,设置其字体大小、文本以及水平和垂直位置。 // 参数: // label - 要初始化的 UILabel 对象 // size - 标签的字体大小 // x - 标签的水平位置 // y - 标签的垂直位置 // text - 标签显示的文本 // ---------------------------------------------------------------------------- void InitLabel(OHOS::UILabel &label, uint8_t size, int16_t x, int16_t y, const char *text, const char *fontName = TJD_VECTOR_FONT_FILENAME); // ---------------------------------------------------------------------------- // 函数: UiDrawImage // 描述: 在 UIImageView 上绘制图片,使用图片的 ID 进行识别。 // 参数: // Image - 指向 UIImageView 对象的指针,用于绘制图片 // x - 图片的水平位置 // y - 图片的垂直位置 // id - 图片的标识符 // imgInfo - 指向 ImageInfo 对象的指针,包含图片数据 // ---------------------------------------------------------------------------- void UiDrawImage(OHOS::UIImageView *Image, int16_t x, int16_t y, const char *id, OHOS::ImageInfo *imgInfo); // ---------------------------------------------------------------------------- // 函数: UiDrawImage // 描述: 在 UIImageView 上绘制图片,不使用图片 ID。 // 参数: // Image - 指向 UIImageView 对象的指针,用于绘制图片 // x - 图片的水平位置 // y - 图片的垂直位置 // imgInfo - 指向 ImageInfo 对象的指针,包含图片数据 // ---------------------------------------------------------------------------- void UiDrawImage(OHOS::UIImageView *Image, int16_t x, int16_t y, OHOS::ImageInfo *imgInfo); // ---------------------------------------------------------------------------- // 函数: UIDrawImageScale // 描述: 在 UIImageView 上绘制缩放后的图片,不使用图片 ID。可以设置缩放比例,并选择是否水平和/或垂直居中。 // 参数: // Image - 指向 UIImageView 对象的指针,用于绘制图片 // x - 图片的水平位置 // y - 图片的垂直位置 // imgInfo - 指向 ImageInfo 对象的指针,包含图片数据 // widthScale - 图片宽度的缩放比例 // heightScale - 图片高度的缩放比例 // center_x - 水平中点坐标 // center_y - 垂直中点坐标 // ---------------------------------------------------------------------------- void UIDrawImageScale(OHOS::UIImageView *Image, int16_t x, int16_t y, OHOS::ImageInfo *imgInfo, float widthScale, float heightScale, uint8_t center_x, uint8_t center_y); // ---------------------------------------------------------------------------- // 函数: UIDrawImageScale // 描述: 在 UIImageView 上绘制缩放后的图片,使用图片的 ID。可以设置缩放比例,并选择是否水平和/或垂直居中。 // 参数: // Image - 指向 UIImageView 对象的指针,用于绘制图片 // x - 图片的水平位置 // y - 图片的垂直位置 // id - 图片的标识符 // imgInfo - 指向 ImageInfo 对象的指针,包含图片数据 // widthScale - 图片宽度的缩放比例 // heightScale - 图片高度的缩放比例 // center_x - 水平中点坐标 // center_y - 垂直中点坐标 // ---------------------------------------------------------------------------- void UIDrawImageScale(OHOS::UIImageView *Image, int16_t x, int16_t y, const char *id, OHOS::ImageInfo *imgInfo, float widthScale, float heightScale, uint8_t center_x, uint8_t center_y); // ---------------------------------------------------------------------------- // 函数: TransformItemBaseOnPosition // 描述: 绘制列表缩放后的图片,并根据位置进行变换。 // ---------------------------------------------------------------------------- bool TransformItemBaseOnPosition(OHOS::UITransformList *list, OHOS::UIView *item); static inline void SetRotateEnable(OHOS::UIScrollView &view) { view.SetThrowDrag(true); view.SetReboundSize(200); // view.SetRotateFactor(ROTATE_FACTOR); // view.SetRotateThreshold(ROTATE_THRESHOLD); view.SetYScrollBarVisible(true); } } // namespace TJD #endif