2018-12-20 17:33:31 +08:00
|
|
|
|
## gif\_image\_t
|
|
|
|
|
### 概述
|
|
|
|
|
![image](images/gif_image_t_0.png)
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
GIF图片控件。
|
2019-01-14 11:38:31 +08:00
|
|
|
|
|
|
|
|
|
> 注意:GIF图片的尺寸大于控件大小时会自动缩小图片,但一般的嵌入式系统的硬件加速都不支持图片缩放,
|
|
|
|
|
所以缩放图片会导致性能明显下降。如果性能不满意时,请确认一下GIF图片的尺寸是否小余控件大小。
|
2019-01-14 12:05:54 +08:00
|
|
|
|
|
2019-01-14 11:38:31 +08:00
|
|
|
|
gif\_image\_t是[image\_base\_t](image_base_t.md)的子类控件,image\_base\_t的函数均适用于gif\_image\_t控件。
|
|
|
|
|
|
|
|
|
|
在xml中使用"gif\_image"标签创建GIF图片控件。如:
|
|
|
|
|
|
|
|
|
|
```xml
|
|
|
|
|
<gif_image image="bee"/>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
>更多用法请参考:
|
|
|
|
|
[gif image](https://github.com/zlgopen/awtk/blob/master/demos/assets/raw/ui/gif_image.xml)
|
|
|
|
|
|
|
|
|
|
在c代码中使用函数gif\_image\_create创建GIF图片控件。如:
|
|
|
|
|
|
|
|
|
|
```c
|
|
|
|
|
widget_t* image = gif_image_create(win, 10, 10, 200, 200);
|
|
|
|
|
image_set_image(image, "bee");
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
> 创建之后:
|
|
|
|
|
>
|
|
|
|
|
> 需要用widget\_set\_image设置图片名称。
|
|
|
|
|
|
2019-01-15 14:54:27 +08:00
|
|
|
|
> 完整示例请参考:[gif image demo](
|
|
|
|
|
https://github.com/zlgopen/awtk-c-demos/blob/master/demos/gif_image.c)
|
2019-01-14 11:38:31 +08:00
|
|
|
|
|
|
|
|
|
可用通过style来设置控件的显示风格,如背景和边框等。如:
|
|
|
|
|
|
|
|
|
|
```xml
|
|
|
|
|
<gif_image>
|
|
|
|
|
<style name="border">
|
|
|
|
|
<normal border_color="#000000" bg_color="#e0e0e0" text_color="black"/>
|
|
|
|
|
</style>
|
|
|
|
|
</gif_image>
|
|
|
|
|
```
|
|
|
|
|
|
2019-01-15 14:54:27 +08:00
|
|
|
|
> 更多用法请参考:[theme default](
|
|
|
|
|
https://github.com/zlgopen/awtk/blob/master/demos/assets/raw/styles/default.xml)
|
2019-01-14 11:38:31 +08:00
|
|
|
|
|
2019-01-15 14:34:05 +08:00
|
|
|
|
|
|
|
|
|
----------------------------------
|
2018-12-20 17:33:31 +08:00
|
|
|
|
### 函数
|
|
|
|
|
<p id="gif_image_t_methods">
|
|
|
|
|
|
|
|
|
|
| 函数名称 | 说明 |
|
|
|
|
|
| -------- | ------------ |
|
2018-12-21 12:11:40 +08:00
|
|
|
|
| <a href="#gif_image_t_gif_image_cast">gif\_image\_cast</a> | 转换为gif_image对象(供脚本语言使用)。 |
|
|
|
|
|
| <a href="#gif_image_t_gif_image_create">gif\_image\_create</a> | 创建gif_image对象 |
|
2018-12-20 17:33:31 +08:00
|
|
|
|
#### gif\_image\_cast 函数
|
2018-12-21 18:29:29 +08:00
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
|
|
* 函数功能:
|
|
|
|
|
|
|
|
|
|
> <p id="gif_image_t_gif_image_cast"> 转换为gif_image对象(供脚本语言使用)。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
widget_t* gif_image_cast (widget_t* widget);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
2018-12-20 17:33:31 +08:00
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | widget\_t* | gif\_image对象。 |
|
|
|
|
|
| widget | widget\_t* | gif\_image对象。 |
|
2018-12-21 18:29:29 +08:00
|
|
|
|
#### gif\_image\_create 函数
|
|
|
|
|
-----------------------
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2018-12-21 18:29:29 +08:00
|
|
|
|
> <p id="gif_image_t_gif_image_create"> 创建gif_image对象
|
2018-12-20 17:33:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
widget_t* gif_image_create (widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
2018-12-20 17:33:31 +08:00
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | widget\_t* | 对象。 |
|
|
|
|
|
| parent | widget\_t* | 父控件 |
|
|
|
|
|
| x | xy\_t | x坐标 |
|
|
|
|
|
| y | xy\_t | y坐标 |
|
|
|
|
|
| w | wh\_t | 宽度 |
|
|
|
|
|
| h | wh\_t | 高度 |
|