230 Star 1.2K Fork 357

GVPzlgopen/awtk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.github/workflows
3rd
demos
design
dllexports
docs
dots
images
manual
images
MIME_TYPE.md
XmlBuilder.md
XmlParser.md
action_darray_thread_t.md
action_thread_pool_t.md
action_thread_t.md
align_h_t.md
align_v_t.md
app_bar_t.md
app_conf_t.md
app_type_t.md
arg_desc_flags_t.md
asset_data_type_t.md
asset_font_type_t.md
asset_image_type_t.md
asset_info_flag_t.md
asset_info_t.md
asset_loader_t.md
asset_script_type_t.md
asset_type_t.md
asset_ui_type_t.md
assets_event_t.md
assets_manager_t.md
assets_managers_t.md
async_t.md
bidi_t.md
bidi_type_t.md
bitmap_flag_t.md
bitmap_format_t.md
bitmap_t.md
border_type_t.md
bsvg_t.md
button_group_t.md
button_t.md
bytesize_t.md
calibration_win_t.md
candidates_t.md
canvas_offline_t.md
canvas_t.md
canvas_widget_t.md
check_button_t.md
children_layouter_default_t.md
children_layouter_factory_t.md
children_layouter_list_view_t.md
children_layouter_t.md
clip_board_data_type_t.md
clip_board_t.md
clip_view_t.md
cmd_arg_desc_t.md
cmd_args_t.md
cmd_exec_event_t.md
color_component_t.md
color_parser_t.md
color_picker_t.md
color_t.md
color_tile_t.md
column_t.md
combo_box_ex_t.md
combo_box_item_t.md
combo_box_t.md
compressor_miniz_t.md
compressor_t.md
conf_doc_t.md
conf_ini_t.md
conf_json_t.md
conf_node_t.md
conf_node_type_t.md
conf_node_value_t.md
conf_obj_t.md
conf_ubjson_t.md
conf_xml_t.md
crc_t.md
csv_file_object_t.md
csv_file_t.md
csv_row_object_t.md
csv_row_t.md
custom_prop_t.md
custom_props_t.md
darray_t.md
data_discard_policy_t.md
data_reader_asset_t.md
data_reader_factory_t.md
data_reader_file_t.md
data_reader_http_t.md
data_reader_mem_t.md
data_reader_t.md
data_writer_factory_t.md
data_writer_file_t.md
data_writer_t.md
data_writer_wbuffer_t.md
date_time_format_t.md
date_time_t.md
debugger_breaked_event_t.md
debugger_client_t.md
debugger_client_tcp_t.md
debugger_error_event_t.md
debugger_factory_t.md
debugger_frame_changed_event_t.md
debugger_fscript_t.md
debugger_global_t.md
debugger_lldb_t.md
debugger_log_event_t.md
debugger_program_state_t.md
debugger_req_t.md
debugger_req_type_t.md
debugger_resp_t.md
debugger_resp_type_t.md
debugger_server_t.md
debugger_server_tcp_t.md
debugger_t.md
dialog_client_t.md
dialog_highlighter_default_t.md
dialog_highlighter_factory_t.md
dialog_highlighter_t.md
dialog_highlighter_type_t.md
dialog_quit_code_t.md
dialog_t.md
dialog_title_t.md
digit_clock_t.md
dirty_rects_t.md
dlist_t.md
done_event_t.md
draggable_t.md
dragger_t.md
drop_file_event_t.md
easing_t.md
easing_type_t.md
edit_t.md
emitter_t.md
encoding_name_t.md
encoding_t.md
endian_t.md
enum_helper.md
error_event_t.md
eval_t.md
event_base_type_t.md
event_recorder_player_t.md
event_source_fd_t.md
event_source_idle_t.md
event_source_manager_default_t.md
event_source_manager_t.md
event_source_t.md
event_source_timer_t.md
event_t.md
event_type_t.md
ext_widgets_t.md
fb_item_t.md
file_browser_t.md
file_browser_view_t.md
file_chooser_t.md
file_dialog_t.md
file_receiver_t.md
file_sender_t.md
file_transfer_ack_t.md
file_transfer_data_t.md
file_transfer_meta_t.md
file_transfer_packet_type_t.md
file_transfer_req_t.md
flowcontrol_t.md
font_loader_bitmap_t.md
font_loader_ft_t.md
font_loader_stb_t.md
font_loader_t.md
font_manager_t.md
font_managers_t.md
font_t.md
fps_t.md
fs_dir_t.md
fs_file_t.md
fs_item_t.md
fs_stat_info_t.md
fs_t.md
fscript_args_t.md
fscript_func_call_t.md
fscript_function_def_t.md
fscript_module_t.md
fscript_parser_error_t.md
fscript_t.md
func_call_parser_t.md
func_desc_t.md
g2d_t.md
gauge_pointer_t.md
gauge_t.md
gif_image_t.md
global_t.md
glyph_cache_t.md
glyph_format_t.md
glyph_t.md
gradient_stop_t.md
gradient_t.md
gradient_type_t.md
graphic_buffer_t.md
grid_item_t.md
grid_t.md
group_box_t.md
guage_pointer_t.md
guage_t.md
hal_shell_t.md
hash_table_t.md
hscroll_label_t.md
hscrollable_t.md
icon_at_type_t.md
idle_info_t.md
idle_manager_t.md
idle_t.md
im_action_button_info_event_t.md
im_candidates_event_t.md
im_commit_event_t.md
image_animation_t.md
image_base_t.md
image_draw_type_t.md
image_loader_stb_t.md
image_loader_t.md
image_manager_t.md
image_managers_t.md
image_t.md
image_value_t.md
indicator_default_paint_t.md
input_device_status_t.md
input_engine_null_t.md
input_engine_pinyin_t.md
input_engine_t.md
input_method_default_t.md
input_method_null_t.md
input_method_sdl_t.md
input_method_t.md
input_type_t.md
int_str_t.md
key_code_t.md
key_event_t.md
keyboard_t.md
keyboard_type_t.md
label_t.md
lang_indicator_t.md
lcd_draw_mode_t.md
lcd_fb_dirty_rects_t.md
lcd_mem_bgr565_t.md
lcd_mem_bgr888_t.md
lcd_mem_bgra8888_t.md
lcd_mem_fragment_t.md
lcd_mem_rgb565_t.md
lcd_mem_rgb888_t.md
lcd_mem_rgba8888_t.md
lcd_mem_special_t.md
lcd_mono_t.md
lcd_orientation_t.md
lcd_profile_t.md
lcd_t.md
lcd_type_t.md
line_break_check.md
line_break_type_t.md
line_number_t.md
list_item_seperator_t.md
list_item_t.md
list_view_h_t.md
list_view_t.md
locale_info_t.md
locale_infos_t.md
log_level_t.md
log_message_event_t.md
log_t.md
main_loop_simple_t.md
main_loop_t.md
matrix_t.md
mem_allocator_composite_t.md
mem_allocator_debug_t.md
mem_allocator_lock_t.md
mem_allocator_oom_t.md
mem_allocator_pool_t.md
mem_allocator_simple_t.md
mem_allocator_std_t.md
mem_allocator_t.md
mledit_t.md
mmap_t.md
model_event_t.md
multi_gesture_event_t.md
mutable_image_t.md
named_value_hash_t.md
named_value_t.md
native_window_t.md
network_interface_t.md
network_interface_type_t.md
network_interface_wifi_auth_t.md
network_interface_wifi_freq_t.md
object_app_conf_t.md
object_array_t.md
object_cmd_t.md
object_compositor_t.md
object_date_time_t.md
object_default_t.md
object_hash_t.md
object_locker_t.md
object_prop_t.md
object_rbuffer_t.md
object_t.md
object_typed_array_t.md
object_wbuffer_t.md
object_widget_t.md
offset_change_event_t.md
orientation_event_t.md
overlay_t.md
pages_t.md
paint_event_t.md
parity_t.md
path.md
path_t.md
platform.md
platform_t.md
plugin_manager_t.md
point_t.md
pointer_event_t.md
pointf_t.md
popup_t.md
preload_res_t.md
process_start_info_t.md
progress_bar_t.md
progress_circle_t.md
progress_event_t.md
prop_change_event_t.md
prop_desc_domain_name_t.md
prop_desc_double_t.md
prop_desc_email_t.md
prop_desc_flags_t.md
prop_desc_float_t.md
prop_desc_int32_t.md
prop_desc_int64_t.md
prop_desc_int_enums_t.md
prop_desc_ip4_address_t.md
prop_desc_phone_t.md
prop_desc_scope_t.md
prop_desc_string_enums_t.md
prop_desc_string_t.md
prop_desc_t.md
prop_desc_type_t.md
prop_desc_uint32_t.md
prop_desc_uint64_t.md
prop_desc_url_t.md
qaction_t.md
rbuffer_t.md
rect_t.md
rectf_t.md
remote_ui_dev_info_t.md
remote_ui_msg_code_t.md
remote_ui_reboot_type_t.md
remote_ui_service_args_t.md
remote_ui_service_t.md
remote_ui_t.md
ret_t.md
rgba_t.md
rich_text_t.md
rich_text_view_t.md
ring_buffer_t.md
rlog_t.md
rom_file_t.md
rom_t.md
romfs_t.md
row_t.md
scroll_bar_t.md
scroll_view_t.md
self_layouter_default_t.md
self_layouter_factory_t.md
self_layouter_menu_t.md
self_layouter_t.md
serial_t.md
serial_widget_t.md
shortcut_t.md
slide_indicator_t.md
slide_menu_t.md
slide_view_t.md
slider_t.md
slist_t.md
socket.md
socketpair_t.md
spin_box_t.md
stopbits_t.md
str_str_t.md
str_t.md
style_const_t.md
style_factory_t.md
style_id_t.md
style_mutable_t.md
style_t.md
style_type_t.md
suggest_words_t.md
svg_helper_t.md
svg_image_t.md
svg_path_t.md
switch_t.md
system_bar_t.md
system_event_t.md
system_info_flag_t.md
system_info_t.md
tab_button_group_t.md
tab_button_t.md
tab_control_t.md
tcp_t.md
text_edit_state_t.md
text_edit_t.md
text_selector_t.md
theme_change_event_t.md
theme_default_t.md
theme_t.md
theme_xml_t.md
time_clock_t.md
time_now_t.md
timer_info_t.md
timer_manager_t.md
timer_t.md
timer_widget_t.md
tk_atomic_t.md
tk_client_t.md
tk_cond_t.md
tk_cond_var_t.md
tk_dl_t.md
tk_ext_widgets_t.md
tk_iostream_mbedtls_t.md
tk_iostream_mem_t.md
tk_iostream_noisy_t.md
tk_iostream_process_t.md
tk_iostream_serial_t.md
tk_iostream_shdlc_t.md
tk_iostream_stats_t.md
tk_iostream_t.md
tk_iostream_tcp_t.md
tk_iostream_udp_t.md
tk_istream_buffered_t.md
tk_istream_file_t.md
tk_istream_mbedtls_t.md
tk_istream_mem_t.md
tk_istream_process_t.md
tk_istream_serial_t.md
tk_istream_shdlc_t.md
tk_istream_stats_t.md
tk_istream_t.md
tk_istream_tcp_t.md
tk_istream_udp_t.md
tk_log_level_t.md
tk_mem_t.md
tk_msg_code_t.md
tk_msg_data_type_t.md
tk_msg_header_t.md
tk_mutex_nest_t.md
tk_mutex_t.md
tk_object_t.md
tk_ostream_buffered_t.md
tk_ostream_file_t.md
tk_ostream_mbedtls_t.md
tk_ostream_mem_t.md
tk_ostream_noisy_t.md
tk_ostream_process_t.md
tk_ostream_retry_t.md
tk_ostream_serial_t.md
tk_ostream_shdlc_t.md
tk_ostream_stats_t.md
tk_ostream_t.md
tk_ostream_tcp_t.md
tk_ostream_udp_t.md
tk_semaphore_t.md
tk_service_t.md
tk_sha256_t.md
tk_sm_event_t.md
tk_sm_state_t.md
tk_sm_transition_t.md
tk_socket_t.md
tk_state_machine_t.md
tk_stream_factory_t.md
tk_t.md
tk_thread_t.md
tokenizer_t.md
touch_event_t.md
typed_array_t.md
ubjson_parser_t.md
ubjson_writer_t.md
udp_t.md
ui_binary_writer_t.md
ui_builder_default_t.md
ui_builder_t.md
ui_feedback_t.md
ui_load_event_t.md
ui_loader_default_t.md
ui_loader_t.md
ui_loader_xml_t.md
ui_xml_writer_t.md
url_t.md
utf8.md
utf8_t.md
utils_t.md
value_change_event_t.md
value_desc_binary_t.md
value_desc_bool_t.md
value_desc_double_t.md
value_desc_float_t.md
value_desc_int16_t.md
value_desc_int32_t.md
value_desc_int64_t.md
value_desc_int8_t.md
value_desc_int_enums_t.md
value_desc_string_enums_t.md
value_desc_string_t.md
value_desc_t.md
value_desc_type_t.md
value_desc_uint16_t.md
value_desc_uint32_t.md
value_desc_uint64_t.md
value_desc_uint8_t.md
value_format_type_t.md
value_t.md
value_type_t.md
velocity_t.md
vg_gradient_linear_info_t.md
vg_gradient_radial_info_t.md
vg_gradient_stop_t.md
vg_gradient_t.md
vg_gradient_type_t.md
vgcanvas_line_cap_t.md
vgcanvas_line_join_t.md
vgcanvas_nanovg_gl_t.md
vgcanvas_t.md
view_t.md
vpage_event_t.md
vpage_t.md
waitable_action_darray_t.md
waitable_action_queue_t.md
waitable_ring_buffer_t.md
wbuffer_t.md
wheel_event_t.md
widget_animator_event_t.md
widget_animator_manager_t.md
widget_animator_prop2_t.md
widget_animator_prop_t.md
widget_animator_scroll_t.md
widget_animator_t.md
widget_cursor_t.md
widget_factory_t.md
widget_pool_t.md
widget_prop_t.md
widget_state_t.md
widget_t.md
widget_type_t.md
window_animator_factory_t.md
window_animator_t.md
window_animator_type_t.md
window_base_t.md
window_closable_t.md
window_event_t.md
window_manager_default_t.md
window_manager_simple_t.md
window_manager_t.md
window_stage_t.md
window_t.md
wstr_t.md
xml_builder_t.md
zip_file_t.md
release_notes
README.md
api_doc.md
app_assets.md
app_helper_usage.md
app_type.md
applet.md
assets_dir_changed.md
assets_manager.md
assets_zip.md
awtk_ecology.md
awtk_ecology_intro.md
awtk_font.md
awtk_main.md
awtk_project_description_file.md
binding_custom_widget.md
build_config.md
changes.md
children_layouter_default.md
children_layouter_list_view.md
chinese_ime.md
code_style.md
color_format.md
conf_doc.md
conventions.md
cross_platform_programming.md
custom_widget_rules.md
debug_tips.md
dialog_highlight.md
easing.md
event_listener.md
event_recorder_player.md
faq.md
framebuffer.md
fscript.md
fscript_app_conf.md
fscript_array.md
fscript_awflow.md
fscript_bits.md
fscript_crc.md
fscript_date_time.md
fscript_endian.md
fscript_fs.md
fscript_iostream.md
fscript_iostream_file.md
fscript_iostream_inet.md
fscript_iostream_serial.md
fscript_istream.md
fscript_json.md
fscript_math.md
fscript_module.md
fscript_object.md
fscript_ostream.md
fscript_ram_req.md
fscript_rbuffer.md
fscript_str.md
fscript_typed_array.md
fscript_value.md
fscript_wbuffer.md
fscript_widget.md
func_call_params_format.md
gen_dots.sh
gradient.md
grid.md
hardware_req.md
how_set_app_icon.md
how_to_access_widget_props.md
how_to_auto_scale_children.md
how_to_build_windows_32bit_version.md
how_to_build_with_keil_ac6.md
how_to_change_prop_with_animation.md
how_to_compile_res_into_app_and_use_them.md
how_to_customize_combo_boxox_button.md
how_to_draw_rotate_text.md
how_to_draw_with_opengl.md
how_to_edit_date.md
how_to_edit_ip_addr.md
how_to_edit_time.md
how_to_enable_bidi.md
how_to_enable_edit_context_menu.md
how_to_enable_key_touch_sound.md
how_to_enable_keyboard_preview.md
how_to_enable_mouse_cursor.md
how_to_handle_drop_file_event.md
how_to_hide_up_down_button_of_scrollbar.md
how_to_impl_back_and_home_key.md
how_to_impl_custom_soft_keyboard.md
how_to_impl_popup_menu.md
how_to_load_external_image_and_font.md
how_to_load_font_for_specific_language.md
how_to_modify_stb_truetype_buffer_size.md
how_to_non_gui_thread_operate_widget.md
how_to_optimize_for_512K_flash.md
how_to_release_app.md
how_to_renewal_awtk_designer.md
how_to_scale_font.md
how_to_scroll_you_text.md
how_to_set_custom_keys.md
how_to_set_custom_load_asset.md
how_to_set_form_enter_and_esc.md
how_to_set_key_long_press_time.md
how_to_set_keyboard_visible_num.md
how_to_set_style_of_combo_box_item.md
how_to_show_context_menu.md
how_to_support_5keys_3keys.md
how_to_support_mono_lcd.md
how_to_support_multi_mem_block.md
how_to_update_gpinyin_data.md
how_to_use_3rd_libs.md
how_to_use_action_text.md
how_to_use_app_conf.md
how_to_use_canvas_offline.md
how_to_use_cmake_to_build_awtk_app.md
how_to_use_dialog.md
how_to_use_fast_lcd_portrait.md
how_to_use_hardware_image_decoding.md
how_to_use_icon_at_to_set_icon_position.md
how_to_use_multi_gesture.md
how_to_use_multi_touch_event.md
how_to_use_mutable_image.md
how_to_use_offset_in_custom_widget.md
how_to_use_packed_image.md
how_to_use_stb_hyuv_to_rgb.md
how_to_use_valgrind_detect_memory_bugs.md
how_to_use_wayland_as_sdl_video_driver.md
how_to_write_layout_params_in_style.md
image_draw_type.md
index.md
input_event_flow.md
input_method.md
layout.md
lcd.md
lcd_rotation.md
locale.md
manual.md
map_key.md
mem_alloactor.md
mingw.md
optimation.md
optimation_freetype_gray_font.md
optimation_stb_truetype_mono_font.md
out_of_memory.md
pages_slide_view_default_focused_child_for_each_page.md
picasso_notes.md
porting_common.md
porting_to_awtk_aworks_rt1052.md
porting_to_stm32f103ze.md
porting_to_stm32f429igtx.md
qa.md
screen_saver.md
script_binding.md
sdl_opengl_notes.md
self_layouter_default.md
self_layouter_menu.md
serial_widget.md
shared_static.md
spin_box.md
system_bar.md
t9_notes.md
text_encoding.md
theme.md
theme_switch.md
trap_list.md
ui_desc.md
vgcanvas.md
vs_debug.md
widget_animator.md
widget_focus.md
window_animator.md
res
scripts
src
staticcheck
tests
tools
valgrind
win32_res
.clang-format
.gitignore
CONTRIBUTING.md
LICENSE
README.md
README_zh.md
SConstruct
SDL2Config.cmake
TODO.md
awtk-config.cmake
awtk_config.py
awtk_config_common.py
build.json
build_ui_old.json
component.json
format.sh
project.json
release_version.sh
run_fscript_test.sh
run_ui_test.sh
sync_tkc.sh
克隆/下载
canvas_t.md 43.46 KB
一键复制 编辑 原始数据 按行查看 历史
lixianjing 提交于 10个月前 . update docs

canvas_t

概述

提供基本的绘图功能和状态管理。

函数

函数名称 说明
canvas_begin_frame 绘制开始。
canvas_cast 转换为canvas对象(供脚本语言使用)。
canvas_clear_rect 用填充颜色填充指定矩形。
canvas_draw_hline 画水平线。
canvas_draw_icon 绘制图标。
canvas_draw_icon_in_rect 在指定rect内绘制icon。
canvas_draw_image 绘制图片。
canvas_draw_image_at 在指定位置画图。
canvas_draw_image_ex 绘制图片。
canvas_draw_image_ex2 绘制图片。
canvas_draw_line 画直线。
canvas_draw_points 画多个点。
canvas_draw_text 绘制文本。
canvas_draw_text_bidi_in_rect 绘制文本(支持Unicode Bidirectional Algorithm)。
canvas_draw_text_in_rect 绘制文本。
canvas_draw_utf8 绘制文本。
canvas_draw_utf8_in_rect 绘制文本。
canvas_draw_vline 画垂直线。
canvas_end_frame 绘制结束。
canvas_fill_rect 绘制矩形。
canvas_fill_rect_gradient 绘制矩形。
canvas_fill_rounded_rect 填充区域。
canvas_fill_rounded_rect_ex 填充圆角矩形区域。
canvas_fill_rounded_rect_gradient 填充圆角矩形区域。
canvas_fill_rounded_rect_gradient_ex 填充圆角矩形区域。
canvas_get_clip_rect 获取裁剪区。
canvas_get_font_height 获取字体的高度。
canvas_get_height 获取画布的高度。
canvas_get_text_metrics 获取当前字体的度量信息。
canvas_get_vgcanvas 获取vgcanvas对象。
canvas_get_width 获取画布的宽度。
canvas_init 初始化,系统内部调用。
canvas_is_rect_in_clip_rect 判断改矩形区域是否在裁剪区中
canvas_measure_text 计算文本所占的宽度。
canvas_measure_utf8 计算文本所占的宽度。
canvas_reset 释放相关资源。
canvas_reset_cache 清除canvas中缓存。
canvas_reset_font 释放canvas中字体相关的资源。
canvas_set_assets_manager 设置canvas的assets_manager对象。
canvas_set_clip_rect 设置裁剪区。
canvas_set_clip_rect_ex 设置裁剪区。
canvas_set_fill_color 设置填充颜色。
canvas_set_fill_color_str 设置填充颜色。
canvas_set_font 设置字体。
canvas_set_font_manager 设置canvas的font_manager对象。
canvas_set_fps 设置FPS。
canvas_set_global_alpha 设置全局alpha值。
canvas_set_stroke_color 设置线条颜色。
canvas_set_stroke_color_str 设置线条颜色。
canvas_set_text_align 设置文本对齐方式。
canvas_set_text_color 设置文本颜色。
canvas_set_text_color_str 设置文本颜色。
canvas_stroke_rect 绘制矩形。
canvas_stroke_rounded_rect 绘制边框。
canvas_stroke_rounded_rect_ex 绘制边框。
canvas_translate 平移原点坐标。
canvas_untranslate 反向平移原点坐标。

属性

属性名称 类型 说明
assets_manager assets_manager_t* 资源管理器对象。
clip_bottom xy_t 当前裁剪矩形的底部位置。
clip_left xy_t 当前裁剪矩形的左边位置。
clip_right xy_t 当前裁剪矩形的右边位置。
clip_top xy_t 当前裁剪矩形的顶部位置。
font font_t* 字体对象。
font_manager font_manager_t* 字体管理器对象。
font_name char* 当前字体名称。
font_size font_size_t 当前字体大小。
fps uint32_t 当前的帧率。
fps_position point_t 当前的帧率绘制坐标。
global_alpha uint8_t 当前全局alpha。
lcd lcd_t* lcd对象。
ox xy_t x坐标偏移。
oy xy_t y坐标偏移。
show_fps bool_t 是否显示帧率。
text_align_h align_h_t 文本水平对齐方式。
text_align_v align_v_t 文本垂直对齐方式。

canvas_begin_frame 函数


  • 函数功能:

绘制开始。

  • 函数原型:
ret_t canvas_begin_frame (canvas_t* c, const dirty_rects_t* dirty_rects, lcd_draw_mode_t draw_mode);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
dirty_rects const dirty_rects_t* 脏矩形。
draw_mode lcd_draw_mode_t 绘制模式。

canvas_cast 函数


  • 函数功能:

转换为canvas对象(供脚本语言使用)。

  • 函数原型:
canvas_t* canvas_cast (canvas_t* c);
  • 参数说明:
参数 类型 说明
返回值 canvas_t* canvas对象。
c canvas_t* canvas对象。

canvas_clear_rect 函数


  • 函数功能:

用填充颜色填充指定矩形。

如果lcd的颜色格式带alpha通道,连同alpha的值一起修改。

  • 函数原型:
ret_t canvas_clear_rect (canvas_t* c, xy_t x, xy_t y, wh_t w, wh_t h);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
x xy_t x坐标。
y xy_t y坐标。
w wh_t 宽度。
h wh_t 高度。

canvas_draw_hline 函数


  • 函数功能:

画水平线。

  • 函数原型:
ret_t canvas_draw_hline (canvas_t* c, xy_t x, xy_t y, wh_t w);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
x xy_t x坐标。
y xy_t y坐标。
w wh_t 宽度。

canvas_draw_icon 函数


  • 函数功能:

绘制图标。

  • 函数原型:
ret_t canvas_draw_icon (canvas_t* c, bitmap_t* img, xy_t cx, xy_t cy);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
img bitmap_t* 图片对象。
cx xy_t 中心点x坐标。
cy xy_t 中心点y坐标。

canvas_draw_icon_in_rect 函数


  • 函数功能:

在指定rect内绘制icon。

  • 函数原型:
ret_t canvas_draw_icon_in_rect (canvas_t* c, bitmap_t* img, const rect_t* r);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
img bitmap_t* 图片对象。
r const rect_t* 矩形区域。

canvas_draw_image 函数


  • 函数功能:

绘制图片。

  • 函数原型:
ret_t canvas_draw_image (canvas_t* c, bitmap_t* img, const rect_t* src, const rect_t* dst);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
img bitmap_t* 图片对象。
src const rect_t* 源区域。
dst const rect_t* 目的区域。

canvas_draw_image_at 函数


  • 函数功能:

在指定位置画图。

  • 函数原型:
ret_t canvas_draw_image_at (canvas_t* c, bitmap_t* img, xy_t x, xy_t y);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
img bitmap_t* 图片对象。
x xy_t x坐标。
y xy_t w坐标。

canvas_draw_image_ex 函数


  • 函数功能:

绘制图片。

  • 函数原型:
ret_t canvas_draw_image_ex (canvas_t* c, bitmap_t* img, image_draw_type_t draw_type, const rect_t* dst);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
img bitmap_t* 图片对象。
draw_type image_draw_type_t 绘制类型。
dst const rect_t* 目的区域。

canvas_draw_image_ex2 函数


  • 函数功能:

绘制图片。

  • 函数原型:
ret_t canvas_draw_image_ex2 (canvas_t* c, bitmap_t* img, image_draw_type_t draw_type, const rect_t* src, const rect_t* dst);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
img bitmap_t* 图片对象。
draw_type image_draw_type_t 绘制类型。
src const rect_t* 源区域。
dst const rect_t* 目的区域。

canvas_draw_line 函数


  • 函数功能:

画直线。

  • 函数原型:
ret_t canvas_draw_line (canvas_t* c, xy_t x1, xy_t y1, xy_t x2, xy_t y2);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
x1 xy_t 起始点的x坐标。
y1 xy_t 起始点的y坐标。
x2 xy_t 结束点的x坐标。
y2 xy_t 结束点的y坐标。

canvas_draw_points 函数


  • 函数功能:

画多个点。

  • 函数原型:
ret_t canvas_draw_points (canvas_t* c, const point_t* points, uint32_t nr);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
points const point_t* 点数组。
nr uint32_t 点的个数。

canvas_draw_text 函数


  • 函数功能:

绘制文本。

  • 函数原型:
ret_t canvas_draw_text (canvas_t* c, const wchar_t* str, uint32_t nr, xy_t x, xy_t y);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
str const wchar_t* 字符串。
nr uint32_t 字符数。
x xy_t x坐标。
y xy_t y坐标。

canvas_draw_text_bidi_in_rect 函数


  • 函数功能:

绘制文本(支持Unicode Bidirectional Algorithm)。

  • 函数原型:
ret_t canvas_draw_text_bidi_in_rect (canvas_t* c, const wchar_t* str, uint32_t nr, const rect_t* r, const char* bidi_type, bool_t ellipses);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
str const wchar_t* 字符串。
nr uint32_t 字符数。
r const rect_t* 矩形区域。
bidi_type const char* 类型。
ellipses bool_t 如果目标宽度不够,是否显示省略号。

canvas_draw_text_in_rect 函数


  • 函数功能:

绘制文本。

  • 函数原型:
ret_t canvas_draw_text_in_rect (canvas_t* c, const wchar_t* str, uint32_t nr, const rect_t* r);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
str const wchar_t* 字符串。
nr uint32_t 字符数。
r const rect_t* 矩形区域。

canvas_draw_utf8 函数


  • 函数功能:

绘制文本。

供脚本语言使用。

  • 函数原型:
ret_t canvas_draw_utf8 (canvas_t* c, const char* str, xy_t x, xy_t y);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
str const char* 字符串。
x xy_t x坐标。
y xy_t y坐标。

canvas_draw_utf8_in_rect 函数


  • 函数功能:

绘制文本。

供脚本语言使用。

  • 函数原型:
ret_t canvas_draw_utf8_in_rect (canvas_t* c, const char* str, const rect_t* r);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
str const char* 字符串。
r const rect_t* 矩形区域。

canvas_draw_vline 函数


  • 函数功能:

画垂直线。

  • 函数原型:
ret_t canvas_draw_vline (canvas_t* c, xy_t x, xy_t y, wh_t h);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
x xy_t x坐标。
y xy_t y坐标。
h wh_t 高度。

canvas_end_frame 函数


  • 函数功能:

绘制结束。

  • 函数原型:
ret_t canvas_end_frame (canvas_t* c);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。

canvas_fill_rect 函数


  • 函数功能:

绘制矩形。

  • 函数原型:
ret_t canvas_fill_rect (canvas_t* c, xy_t x, xy_t y, wh_t w, wh_t h);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
x xy_t x坐标。
y xy_t y坐标。
w wh_t 宽度。
h wh_t 高度。

canvas_fill_rect_gradient 函数


  • 函数功能:

绘制矩形。

  • 函数原型:
ret_t canvas_fill_rect_gradient (canvas_t* c, xy_t x, xy_t y, wh_t w, wh_t h, gradient_t* gradient);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
x xy_t x坐标。
y xy_t y坐标。
w wh_t 宽度。
h wh_t 高度。
gradient gradient_t* 渐变颜色。

canvas_fill_rounded_rect 函数


  • 函数功能:

填充区域。

  • 函数原型:
ret_t canvas_fill_rounded_rect (canvas_t* c, const rect_t* r, const rect_t* bg_r, const color_t* color, uint32_t radius);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
r const rect_t* 矩形。
bg_r const rect_t* 矩形(默认为 NULL,当圆角直径大于 r 矩形的宽高后,会根据 bg_r 矩形来决定是否需要缩小圆角半径)。
color const color_t* 颜色。
radius uint32_t 圆角半径。

canvas_fill_rounded_rect_ex 函数


  • 函数功能:

填充圆角矩形区域。

半径半径小于等于2,则表示该角为直角,如果全部角都为直角则返回RET_FAIL。(如果全是直角,该函数效率没有canvas_fill_rect函数快) 如果各个半径都不一样的话,就是会使用vg,如果不支持vg就会返回RET_FAIL(直角的情况除外)。

  • 函数原型:
ret_t canvas_fill_rounded_rect_ex (canvas_t* c, const rect_t* r, const rect_t* bg_r, const color_t* color, uint32_t radius_tl, uint32_t radius_tr, uint32_t radius_bl, uint32_t radius_br);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
r const rect_t* 矩形。
bg_r const rect_t* 矩形。(默认为 NULL,当圆角直径大于 r 矩形的宽高后,会根据 bg_r 矩形来决定是否需要缩小圆角半径)
color const color_t* 颜色。
radius_tl uint32_t 左上角圆角半径。
radius_tr uint32_t 右上角圆角半径。
radius_bl uint32_t 左下角圆角半径。
radius_br uint32_t 右下角圆角半径。

canvas_fill_rounded_rect_gradient 函数


  • 函数功能:

填充圆角矩形区域。

  • 函数原型:
ret_t canvas_fill_rounded_rect_gradient (canvas_t* c, const rect_t* r, const rect_t* bg_r, const gradient_t* gradient, uint32_t radius);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
r const rect_t* 矩形。
bg_r const rect_t* 矩形(默认为 NULL,当圆角直径大于 r 矩形的宽高后,会根据 bg_r 矩形来决定是否需要缩小圆角半径)。
gradient const gradient_t* 渐变颜色。
radius uint32_t 圆角半径。

canvas_fill_rounded_rect_gradient_ex 函数


  • 函数功能:

填充圆角矩形区域。

半径半径小于等于2,则表示该角为直角,如果全部角都为直角则返回RET_FAIL。(如果全是直角,该函数效率没有canvas_fill_rect函数快) 如果各个半径都不一样的话,就是会使用vg,如果不支持vg就会返回RET_FAIL(直角的情况除外)。

  • 函数原型:
ret_t canvas_fill_rounded_rect_gradient_ex (canvas_t* c, const rect_t* r, const rect_t* bg_r, const gradient_t* gradient, uint32_t radius_tl, uint32_t radius_tr, uint32_t radius_bl, uint32_t radius_br);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
r const rect_t* 矩形。
bg_r const rect_t* 矩形。(默认为 NULL,当圆角直径大于 r 矩形的宽高后,会根据 bg_r 矩形来决定是否需要缩小圆角半径)
gradient const gradient_t* 渐变颜色。
radius_tl uint32_t 左上角圆角半径。
radius_tr uint32_t 右上角圆角半径。
radius_bl uint32_t 左下角圆角半径。
radius_br uint32_t 右下角圆角半径。

canvas_get_clip_rect 函数


  • 函数功能:

获取裁剪区。

  • 函数原型:
ret_t canvas_get_clip_rect (canvas_t* c, rect_t* r);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
r rect_t* rect对象。

canvas_get_font_height 函数


  • 函数功能:

获取字体的高度。

  • 函数原型:
float_t canvas_get_font_height (canvas_t* c);
  • 参数说明:
参数 类型 说明
返回值 float_t 返回字体的高度。
c canvas_t* canvas对象。

canvas_get_height 函数


  • 函数功能:

获取画布的高度。

  • 函数原型:
wh_t canvas_get_height (canvas_t* c);
  • 参数说明:
参数 类型 说明
返回值 wh_t 返回画布的高度。
c canvas_t* canvas对象。

canvas_get_text_metrics 函数


  • 函数功能:

获取当前字体的度量信息。

  • 函数原型:
ret_t canvas_get_text_metrics (canvas_t* canvas, float_t* ascent, float_t* descent, float_t* line_hight);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
canvas canvas_t* canvas对象。
ascent float_t* 用于返回ascent。
descent float_t* 用于返回descent。
line_hight float_t* 用于返回line height。

canvas_get_vgcanvas 函数


  • 函数功能:

获取vgcanvas对象。

  • 函数原型:
vgcanvas_t* canvas_get_vgcanvas (canvas_t* c);
  • 参数说明:
参数 类型 说明
返回值 vgcanvas_t* 返回vgcanvas对象。
c canvas_t* canvas对象。

canvas_get_width 函数


  • 函数功能:

获取画布的宽度。

  • 函数原型:
wh_t canvas_get_width (canvas_t* c);
  • 参数说明:
参数 类型 说明
返回值 wh_t 返回画布的宽度。
c canvas_t* canvas对象。

canvas_init 函数


  • 函数功能:

初始化,系统内部调用。

  • 函数原型:
canvas_t* canvas_init (canvas_t* c, lcd_t* lcd, font_manager_t* font_manager);
  • 参数说明:
参数 类型 说明
返回值 canvas_t* 返回canvas对象本身。
c canvas_t* canvas对象。
lcd lcd_t* lcd对象。
font_manager font_manager_t* 字体管理器对象。

canvas_is_rect_in_clip_rect 函数


  • 函数功能:

判断改矩形区域是否在裁剪区中

  • 函数原型:
bool_t canvas_is_rect_in_clip_rect (canvas_t* c, xy_t left, xy_t top, xy_t right, xy_t bottom);
  • 参数说明:
参数 类型 说明
返回值 bool_t 返回TRUE表示是,否则表示不是。
c canvas_t* canvas对象。
left xy_t 矩形区域左边。
top xy_t 矩形区域上边。
right xy_t 矩形区域右边。
bottom xy_t 矩形区域下边。

canvas_measure_text 函数


  • 函数功能:

计算文本所占的宽度。

  • 函数原型:
float_t canvas_measure_text (canvas_t* c, const wchar_t* str, uint32_t nr);
  • 参数说明:
参数 类型 说明
返回值 float_t 返回文本所占的宽度。
c canvas_t* canvas对象。
str const wchar_t* 字符串。
nr uint32_t 字符数。

canvas_measure_utf8 函数


  • 函数功能:

计算文本所占的宽度。

供脚本语言使用。

  • 函数原型:
float_t canvas_measure_utf8 (canvas_t* c, const char* str);
  • 参数说明:
参数 类型 说明
返回值 float_t 返回文本所占的宽度。
c canvas_t* canvas对象。
str const char* 字符串。

canvas_reset 函数


  • 函数功能:

释放相关资源。

  • 函数原型:
ret_t canvas_reset (canvas_t* c);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。

canvas_reset_cache 函数


  • 函数功能:

清除canvas中缓存。 备注:主要用于窗口动画的离线画布绘制完成后重置在线画布,使下一帧中lcd对象的数据保持一致。

  • 函数原型:
ret_t canvas_reset_cache (canvas_t* c);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。

canvas_reset_font 函数


  • 函数功能:

释放canvas中字体相关的资源。

  • 函数原型:
ret_t canvas_reset_font (canvas_t* c);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。

canvas_set_assets_manager 函数


  • 函数功能:

设置canvas的assets_manager对象。

  • 函数原型:
ret_t canvas_set_assets_manager (canvas_t* c, assets_manager_t* assets_manager);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
assets_manager assets_manager_t* assets_manager对象。

canvas_set_clip_rect 函数


  • 函数功能:

设置裁剪区。

  • 函数原型:
ret_t canvas_set_clip_rect (canvas_t* c, const rect_t* r);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
r const rect_t* rect对象。

canvas_set_clip_rect_ex 函数


  • 函数功能:

设置裁剪区。

  • 函数原型:
ret_t canvas_set_clip_rect_ex (canvas_t* c, const rect_t* r, bool_t translate);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
r const rect_t* rect对象。
translate bool_t 是否将裁剪区的位置加上canvas当前的偏移。

canvas_set_fill_color 函数


  • 函数功能:

设置填充颜色。

  • 函数原型:
ret_t canvas_set_fill_color (canvas_t* c, color_t color);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
color color_t 颜色。

canvas_set_fill_color_str 函数


  • 函数功能:

设置填充颜色。

供脚本语言使用。

  • 函数原型:
ret_t canvas_set_fill_color_str (canvas_t* c, const char* color);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
color const char* 颜色。

canvas_set_font 函数


  • 函数功能:

设置字体。

  • 函数原型:
ret_t canvas_set_font (canvas_t* c, const char* name, font_size_t size);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
name const char* 字体名称。
size font_size_t 字体大小。

canvas_set_font_manager 函数


  • 函数功能:

设置canvas的font_manager对象。

  • 函数原型:
ret_t canvas_set_font_manager (canvas_t* c, font_manager_t* font_manager);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
font_manager font_manager_t* font_manager对象。

canvas_set_fps 函数


  • 函数功能:

设置FPS。

  • 函数原型:
ret_t canvas_set_fps (canvas_t* c, bool_t show_fps, uint32_t fps);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
show_fps bool_t 是否显示fps。
fps uint32_t FPS。

canvas_set_global_alpha 函数


  • 函数功能:

设置全局alpha值。

  • 函数原型:
ret_t canvas_set_global_alpha (canvas_t* c, uint8_t alpha);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
alpha uint8_t alpha值。

canvas_set_stroke_color 函数


  • 函数功能:

设置线条颜色。

  • 函数原型:
ret_t canvas_set_stroke_color (canvas_t* c, color_t color);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
color color_t 颜色。

canvas_set_stroke_color_str 函数


  • 函数功能:

设置线条颜色。

供脚本语言使用。

  • 函数原型:
ret_t canvas_set_stroke_color_str (canvas_t* c, const char* color);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
color const char* 颜色。

canvas_set_text_align 函数


  • 函数功能:

设置文本对齐方式。

  • 函数原型:
ret_t canvas_set_text_align (canvas_t* c, align_h_t align_h, align_v_t align_v);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
align_h align_h_t 水平对齐方式。
align_v align_v_t 垂直对齐方式。

canvas_set_text_color 函数


  • 函数功能:

设置文本颜色。

  • 函数原型:
ret_t canvas_set_text_color (canvas_t* c, color_t color);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
color color_t 颜色。

canvas_set_text_color_str 函数


  • 函数功能:

设置文本颜色。

供脚本语言使用。

  • 函数原型:
ret_t canvas_set_text_color_str (canvas_t* c, const char* color);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
color const char* 颜色。

canvas_stroke_rect 函数


  • 函数功能:

绘制矩形。

  • 函数原型:
ret_t canvas_stroke_rect (canvas_t* c, xy_t x, xy_t y, wh_t w, wh_t h);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
x xy_t x坐标。
y xy_t y坐标。
w wh_t 宽度。
h wh_t 高度。

canvas_stroke_rounded_rect 函数


  • 函数功能:

绘制边框。

  • 函数原型:
ret_t canvas_stroke_rounded_rect (canvas_t* c, const rect_t* r, const rect_t* bg_r, const color_t* color, uint32_t radius, uint32_t border_width);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
r const rect_t* 矩形。
bg_r const rect_t* 矩形(默认为 NULL,当圆角直径大于 r 矩形的宽高后,会根据 bg_r 矩形来决定是否需要缩小圆角半径)。
color const color_t* 颜色。
radius uint32_t 圆角半径。
border_width uint32_t 边宽。

canvas_stroke_rounded_rect_ex 函数


  • 函数功能:

绘制边框。

半径半径小于等于2,则表示该角为直角,如果全部角都为直角则返回RET_FAIL。(如果全是直角,该函数效率没有canvas_stroke_rect函数快) 如果各个半径都不一样的话,就是会使用vg,如果不支持vg就会返回RET_FAIL(直角的情况除外)。

  • 函数原型:
ret_t canvas_stroke_rounded_rect_ex (canvas_t* c, const rect_t* r, const rect_t* bg_r, const color_t* color, uint32_t radius_tl, uint32_t radius_tr, uint32_t radius_bl, uint32_t radius_br, uint32_t border_width, int32_t border_model);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
r const rect_t* 矩形。
bg_r const rect_t* 矩形(默认为 NULL,当圆角直径大于 r 矩形的宽高后,会根据 bg_r 矩形来决定是否需要缩小圆角半径)。
color const color_t* 颜色。
radius_tl uint32_t 左上角圆角半径。
radius_tr uint32_t 右上角圆角半径。
radius_bl uint32_t 左下角圆角半径。
radius_br uint32_t 右下角圆角半径。
border_width uint32_t 边宽。
border_model int32_t 边框类型。

canvas_translate 函数


  • 函数功能:

平移原点坐标。

  • 函数原型:
ret_t canvas_translate (canvas_t* c, xy_t dx, xy_t dy);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
dx xy_t x偏移。
dy xy_t y偏移。

canvas_untranslate 函数


  • 函数功能:

反向平移原点坐标。

  • 函数原型:
ret_t canvas_untranslate (canvas_t* c, xy_t dx, xy_t dy);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
c canvas_t* canvas对象。
dx xy_t x偏移。
dy xy_t y偏移。

assets_manager 属性


资源管理器对象。

  • 类型:assets_manager_t*
特性 是否支持
可直接读取
可直接修改

clip_bottom 属性


当前裁剪矩形的底部位置。

  • 类型:xy_t
特性 是否支持
可直接读取
可直接修改

clip_left 属性


当前裁剪矩形的左边位置。

  • 类型:xy_t
特性 是否支持
可直接读取
可直接修改

clip_right 属性


当前裁剪矩形的右边位置。

  • 类型:xy_t
特性 是否支持
可直接读取
可直接修改

clip_top 属性


当前裁剪矩形的顶部位置。

  • 类型:xy_t
特性 是否支持
可直接读取
可直接修改

font 属性


字体对象。

  • 类型:font_t*
特性 是否支持
可直接读取
可直接修改

font_manager 属性


字体管理器对象。

  • 类型:font_manager_t*
特性 是否支持
可直接读取
可直接修改

font_name 属性


当前字体名称。

  • 类型:char*
特性 是否支持
可直接读取
可直接修改
可脚本化

font_size 属性


当前字体大小。

  • 类型:font_size_t
特性 是否支持
可直接读取
可直接修改
可脚本化

fps 属性


当前的帧率。

  • 类型:uint32_t
特性 是否支持
可直接读取
可直接修改

fps_position 属性


当前的帧率绘制坐标。

  • 类型:point_t
特性 是否支持
可直接读取
可直接修改

global_alpha 属性


当前全局alpha。

  • 类型:uint8_t
特性 是否支持
可直接读取
可直接修改
可脚本化

lcd 属性


lcd对象。

  • 类型:lcd_t*
特性 是否支持
可直接读取
可直接修改

ox 属性


x坐标偏移。

  • 类型:xy_t
特性 是否支持
可直接读取
可直接修改
可脚本化

oy 属性


y坐标偏移。

  • 类型:xy_t
特性 是否支持
可直接读取
可直接修改
可脚本化

show_fps 属性


是否显示帧率。

  • 类型:bool_t
特性 是否支持
可直接读取
可直接修改

text_align_h 属性


文本水平对齐方式。

  • 类型:align_h_t
特性 是否支持
可直接读取
可直接修改

text_align_v 属性


文本垂直对齐方式。

  • 类型:align_v_t
特性 是否支持
可直接读取
可直接修改
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/zlgopen/awtk.git
git@gitee.com:zlgopen/awtk.git
zlgopen
awtk
awtk
master

搜索帮助