update docs

This commit is contained in:
lixianjing 2019-11-28 10:01:31 +08:00
parent 0bfba47eda
commit 6f2cdc1a04
2 changed files with 278 additions and 19 deletions

View File

@ -33,7 +33,8 @@ typedef struct _canvas_t canvas_t;
/**
* @class canvas_t
* @annotation ["scriptable"]
* canvas类
*
*
*/
struct _canvas_t {
/**
@ -50,24 +51,113 @@ struct _canvas_t {
*/
xy_t oy;
xy_t clip_left;
xy_t clip_top;
xy_t clip_right;
xy_t clip_bottom;
uint32_t fps;
bool_t show_fps;
lcd_t* lcd;
font_t* font;
font_size_t font_size;
/**
* @property {char*} font_name
* @annotation ["readable", "scriptable"]
*
*/
char* font_name;
align_v_t text_align_v;
align_h_t text_align_h;
font_manager_t* font_manager;
assets_manager_t* assets_manager;
/**
* @property {uint16_t} font_size
* @annotation ["readable", "scriptable"]
*
*/
font_size_t font_size;
/**
* @property {uint8_t} global_alpha
* @annotation ["readable", "scriptable"]
* alpha
*/
uint8_t global_alpha;
/**
* @property {xy_t} clip_left
* @annotation ["readable"]
*
*/
xy_t clip_left;
/**
* @property {xy_t} clip_top
* @annotation ["readable"]
*
*/
xy_t clip_top;
/**
* @property {xy_t} clip_right
* @annotation ["readable"]
*
*/
xy_t clip_right;
/**
* @property {xy_t} clip_bottom
* @annotation ["readable"]
*
*/
xy_t clip_bottom;
/**
* @property {uint32_t} fps
* @annotation ["readable"]
*
*/
uint32_t fps;
/**
* @property {bool_t} show_fps
* @annotation ["readable"]
*
*/
bool_t show_fps;
/**
* @property {align_v_t} text_align_v
* @annotation ["readable"]
*
*/
align_v_t text_align_v;
/**
* @property {align_h_t} text_align_h
* @annotation ["readable"]
*
*/
align_h_t text_align_h;
/**
* @property {lcd_t*} lcd
* @annotation ["readable"]
* lcd对象
*/
lcd_t* lcd;
/**
* @property {font_t*} font
* @annotation ["readable"]
*
*/
font_t* font;
/**
* @property {font_manager_t*} font_manager
* @annotation ["readable"]
*
*/
font_manager_t* font_manager;
/**
* @property {assets_manager_t*} assets_manager
* @annotation ["readable"]
*
*/
assets_manager_t* assets_manager;
/*private*/
/*确保begin_frame/end_frame配对使用*/
bool_t began_frame;
};
@ -470,6 +560,21 @@ ret_t canvas_draw_icon(canvas_t* c, bitmap_t* img, xy_t cx, xy_t cy);
*/
ret_t canvas_draw_image(canvas_t* c, bitmap_t* img, rect_t* src, rect_t* dst);
/**
* @method canvas_draw_image_ex
*
*
* @annotation ["scriptable"]
* @param {canvas_t*} c canvas对象
* @param {bitmap_t*} img
* @param {image_draw_type_t} draw_type
* @param {rect_t*} dst
*
* @return {ret_t} RET_OK表示成功
*/
ret_t canvas_draw_image_ex(canvas_t* c, bitmap_t* img, image_draw_type_t draw_type,
const rect_t* dst);
/**
* @method canvas_get_vgcanvas
* vgcanvas对象
@ -502,9 +607,7 @@ canvas_t* canvas_cast(canvas_t* c);
*/
ret_t canvas_reset(canvas_t* c);
/*private*/
ret_t canvas_draw_image_ex(canvas_t* c, bitmap_t* img, image_draw_type_t draw_type,
const rect_t* dst);
/*public for internal use*/
ret_t canvas_draw_image_at(canvas_t* c, bitmap_t* img, xy_t x, xy_t y);
ret_t canvas_draw_icon_in_rect(canvas_t* c, bitmap_t* img, rect_t* r);

View File

@ -1496,6 +1496,39 @@
"desc": "返回RET_OK表示成功否则表示失败。"
}
},
{
"params": [
{
"type": "canvas_t*",
"name": "c",
"desc": "canvas对象。"
},
{
"type": "bitmap_t*",
"name": "img",
"desc": "图片对象。"
},
{
"type": "image_draw_type_t",
"name": "draw_type",
"desc": "绘制类型。"
},
{
"type": "rect_t*",
"name": "dst",
"desc": "目的区域。"
}
],
"annotation": {
"scriptable": true
},
"desc": "绘制图片。\n",
"name": "canvas_draw_image_ex",
"return": {
"type": "ret_t",
"desc": "返回RET_OK表示成功否则表示失败。"
}
},
{
"params": [
{
@ -1571,10 +1604,133 @@
"readable": true,
"scriptable": true
}
},
{
"name": "font_name",
"desc": "当前字体名称。\n",
"type": "char*",
"annotation": {
"readable": true,
"scriptable": true
}
},
{
"name": "font_size",
"desc": "当前字体大小。\n",
"type": "uint16_t",
"annotation": {
"readable": true,
"scriptable": true
}
},
{
"name": "global_alpha",
"desc": "当前全局alpha。\n",
"type": "uint8_t",
"annotation": {
"readable": true,
"scriptable": true
}
},
{
"name": "clip_left",
"desc": "当前裁剪矩形的左边位置。\n",
"type": "xy_t",
"annotation": {
"readable": true
}
},
{
"name": "clip_top",
"desc": "当前裁剪矩形的顶部位置。\n",
"type": "xy_t",
"annotation": {
"readable": true
}
},
{
"name": "clip_right",
"desc": "当前裁剪矩形的右边位置。\n",
"type": "xy_t",
"annotation": {
"readable": true
}
},
{
"name": "clip_bottom",
"desc": "当前裁剪矩形的底部位置。\n",
"type": "xy_t",
"annotation": {
"readable": true
}
},
{
"name": "fps",
"desc": "当前的帧率。\n",
"type": "uint32_t",
"annotation": {
"readable": true
}
},
{
"name": "show_fps",
"desc": "是否显示帧率。\n",
"type": "bool_t",
"annotation": {
"readable": true
}
},
{
"name": "text_align_v",
"desc": "文本垂直对齐方式。\n",
"type": "align_v_t",
"annotation": {
"readable": true
}
},
{
"name": "text_align_h",
"desc": "文本水平对齐方式。\n",
"type": "align_h_t",
"annotation": {
"readable": true
}
},
{
"name": "lcd",
"desc": "lcd对象。\n",
"type": "lcd_t*",
"annotation": {
"readable": true
}
},
{
"name": "font",
"desc": "字体对象。\n",
"type": "font_t*",
"annotation": {
"readable": true
}
},
{
"name": "font_manager",
"desc": "字体管理器对象。\n",
"type": "font_manager_t*",
"annotation": {
"readable": true
}
},
{
"name": "assets_manager",
"desc": "资源管理器对象。\n",
"type": "assets_manager_t*",
"annotation": {
"readable": true
}
}
],
"header": "base/canvas.h",
"desc": "canvas类。\n",
"desc": "提供基本的绘图功能和状态管理。\n",
"name": "canvas_t",
"annotation": {
"scriptable": true