[stm32] 利用uC-BmpCvt软件生成uc-gui可调用的bmp图片

 

>_<:学习贴图[bmp图]:首先找一张bmp格式的图片,然后下载uC-BmpCvt软件,打开改图片

>_<:然后点击Image-Conver-Into-Best Palatte调成最佳调色板,然后save格式为默认格式:

>_<:结果生成了一个kk.c文件:

  • 这里Colorskk[]是16个颜色;
  • Palkk是根据上面的16个颜色构建对应的调色板;
  • ackk[]为Bmp图的内容;
  • bmkk为根据上面的调色板,bmp内容建立uc-gui的函数可以调用的图片格式,在Fun函数里用函数GUI_DrawBitmap(&bmkk,0,0);就能把这幅图贴在(0,0)位置啦!
复制代码
 1 #include "stdlib.h"
 2 
 3 #include "GUI.H"
 4 
 5 /*   Palette
 6 The following are the entries of the palette table.
 7 Every entry is a 32-bit value (of which 24 bits are actually used)
 8 the lower   8 bits represent the Red component,
 9 the middle  8 bits represent the Green component,
10 the highest 8 bits (of the 24 bits used) represent the Blue component
11 as follows:   0xBBGGRR
12 */
13 
14 const GUI_COLOR Colorskk[] = {
15      0xFFFFFF,0x000000,0xC0C0C0,0x808080
16     ,0x00FFFF,0xFF0000,0x008080,0x800000
17     ,0x0000FF,0x000080,0xFFFF00,0x808000
18     ,0x008000,0x800080,0xFF00FF,0x00FF00
19 };
20 
21 const GUI_LOGPALETTE Palkk = {
22   16,    /* number of entries */
23   0,     /* No transparency */
24   &Colorskk[0]
25 };
26 
27 const unsigned char ackk[] = {...};
28 const GUI_BITMAP bmkk = {
29  798, /* XSize */
30  480, /* YSize */
31  399, /* BytesPerLine */
32  4, /* BitsPerPixel */
33  ackk,  /* Pointer to picture data (indices) */
34  &Palkk  /* Pointer to palette */
35 };
复制代码
posted @   beautifulzzzz  阅读(4017)  评论(0编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?
点击右上角即可分享
微信分享提示