新增测试动态效果
This commit is contained in:
parent
fd78dad719
commit
57e26b8fca
107
fb2/fbtool.c~
107
fb2/fbtool.c~
|
@ -1,107 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
//打开并且初始化该frame buffer
|
||||
int fb_open(PFBDEV pFbdev)
|
||||
{
|
||||
//打开frame buffer
|
||||
pFbdev->fb = open(pFbdev->dev,O_RDWR);
|
||||
|
||||
if(pFbdev->fb < 0)
|
||||
{
|
||||
printf("打开错误 %s : %n.请检查内核配置\n",pFbdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_var
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_VSCREENINFO,&(pFbdev->fb_var)))
|
||||
{
|
||||
printf("ioctl FBIOGET_VSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_fix
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_FSCREENINFO,&(pFbdev->fb_fix)))
|
||||
{
|
||||
printf("ioctl FBIOGET_FSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//关闭frame buffer
|
||||
int fb_close(PFBDEV pFbdev)
|
||||
{
|
||||
close(pFbdev->fb);
|
||||
pFbdev->fb = -1;
|
||||
}
|
||||
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
void pmem_start(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer所占内存的开始地址为:%lu\n",pFbdev->fb_fix.smem_start);
|
||||
}
|
||||
|
||||
//打印FB_TYPE
|
||||
void p_type(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer 的类型为:%d\n",pFbdev->fb_fix.type);
|
||||
}
|
||||
|
||||
//打印可见清晰度
|
||||
void p_visible_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的可见清晰度为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xres,pFbdev->fb_var.yres);
|
||||
}
|
||||
|
||||
//打印虚拟分辨率
|
||||
void p_virt_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟清晰度为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xres_virtual,pFbdev->fb_var.yres_virtual);
|
||||
}
|
||||
|
||||
//打印虚拟到可见的偏移量
|
||||
void p_offset(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟分辨率到可见分辨率的偏移量为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xoffset,pFbdev->fb_var.yoffset);
|
||||
}
|
||||
|
||||
//打印每个像素的位数
|
||||
void p_bpp(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的BPP为:%d\n",pFbdev->fb_var.bits_per_pixel);
|
||||
}
|
||||
|
||||
//打印R,G,B和透明度
|
||||
void p_rgbt(PFBDEV pFbdev)
|
||||
{
|
||||
printf("这个后面再说!!\n");
|
||||
}
|
||||
|
||||
//打印在内存中的高度和宽度
|
||||
void p_hw(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer在内存中所占的高度和宽度分别是:\n\t宽度 = %d\n\t高度 = %d\n",pFbdev->fb_var.height,pFbdev->fb_var.width);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
#ifndef __FBTOOL_H_
|
||||
#define __FBTOOL_H_
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct fbdev{
|
||||
int fb; //framebuffer打开后的唯一标识符
|
||||
struct fb_fix_screeninfo fb_fix;
|
||||
struct fb_var_screeninfo fb_var;
|
||||
char dev[20];
|
||||
}FBDEV,*PFBDEV;
|
||||
|
||||
//打开framebuffer
|
||||
int fb_open(PFBDEV pFbdev);
|
||||
//关闭framebuffer
|
||||
int fb_close(PFBDEV pFbdev);
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
void pmem_start(PFBDEV pFbdev);
|
||||
//打印FB_TYPE
|
||||
void p_type(PFBDEV pFbdev);
|
||||
//打印可见清晰度
|
||||
void p_visible_res(PFBDEV pFbdev);
|
||||
//打印虚拟分辨率
|
||||
void p_virt_res(PFBDEV pFbdev);
|
||||
//打印虚拟到可见的偏移量
|
||||
void p_offset(PFBDEV pFbdev);
|
||||
//打印每个像素的位数
|
||||
void p_bpp(PFBDEV pFbdev);
|
||||
//打印R,G,B和透明度
|
||||
void p_rgbt(PFBDEV pFbdev);
|
||||
//打印在内存中的高度和宽度
|
||||
void p_hw(PFBDEV pFbdev);
|
||||
|
||||
#endif
|
34
fb2/test.c~
34
fb2/test.c~
|
@ -1,34 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
FBDEV fbdev;
|
||||
memset(&fbdev,0,sizeof(FBDEV));
|
||||
strcpy(fbdev.dev,"/dev/fb0");
|
||||
|
||||
if(0 == fb_open(&fbdev)){
|
||||
printf("Open fail!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
pmem_start(&fbdev);
|
||||
//打印FB_TYPE
|
||||
p_type(&fbdev);
|
||||
//打印可见清晰度
|
||||
p_visible_res(&fbdev);
|
||||
//打印虚拟分辨率
|
||||
p_virt_res(&fbdev);
|
||||
//打印虚拟到可见的偏移量
|
||||
p_offset(&fbdev);
|
||||
//打印每个像素的位数
|
||||
p_bpp(&fbdev);
|
||||
//打印R,G,B和透明度
|
||||
p_rgbt(&fbdev);
|
||||
//打印在内存中的高度和宽度
|
||||
p_hw(&fbdev);
|
||||
|
||||
fb_close(PFBDEV pFbdev);
|
||||
|
||||
return 0;
|
||||
}
|
133
fb3/fbtool.c~
133
fb3/fbtool.c~
|
@ -1,133 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
//打开并且初始化该frame buffer
|
||||
int fb_open(PFBDEV pFbdev)
|
||||
{
|
||||
//打开frame buffer
|
||||
pFbdev->fb = open(pFbdev->dev,O_RDWR);
|
||||
|
||||
if(pFbdev->fb < 0)
|
||||
{
|
||||
printf("打开错误 %s : %n.请检查内核配置\n",pFbdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_var
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_VSCREENINFO,&(pFbdev->fb_var)))
|
||||
{
|
||||
printf("ioctl FBIOGET_VSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_fix
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_FSCREENINFO,&(pFbdev->fb_fix)))
|
||||
{
|
||||
printf("ioctl FBIOGET_FSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//关闭frame buffer
|
||||
int fb_close(PFBDEV pFbdev)
|
||||
{
|
||||
close(pFbdev->fb);
|
||||
pFbdev->fb = -1;
|
||||
}
|
||||
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
void pmem_start(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer所占内存的开始地址为:%d\n",pFbdev->fb_fix.smem_start);
|
||||
}
|
||||
|
||||
//打印FB_TYPE
|
||||
void p_type(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer 的类型为:%d\n",pFbdev->fb_fix.type);
|
||||
}
|
||||
|
||||
//打印可见清晰度
|
||||
void p_visible_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的可见清晰度为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xres,pFbdev->fb_var.yres);
|
||||
}
|
||||
|
||||
//打印虚拟分辨率
|
||||
void p_virt_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟清晰度为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xres_virtual,pFbdev->fb_var.yres_virtual);
|
||||
}
|
||||
|
||||
//打印虚拟到可见的偏移量
|
||||
void p_offset(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟分辨率到可见分辨率的偏移量为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xoffset,pFbdev->fb_var.yoffset);
|
||||
}
|
||||
|
||||
//打印每个像素的位数
|
||||
void p_bpp(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的BPP为:%d\n",pFbdev->fb_var.bits_per_pixel);
|
||||
}
|
||||
|
||||
//打印R,G,B和透明度
|
||||
void p_rgbt(PFBDEV pFbdev)
|
||||
{
|
||||
//R位域
|
||||
printf("R位域:\n");
|
||||
struct fb_bitfield bf = pFbdev->fb_var.red;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
|
||||
//G位域
|
||||
printf("G位域:\n");
|
||||
bf = pFbdev->fb_var.green;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
|
||||
// B位域
|
||||
printf("B位域:\n");
|
||||
bf = pFbdev->fb_var.blue;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
|
||||
// 透明度位域
|
||||
printf("透明度位域:\n");
|
||||
bf = pFbdev->fb_var.transp;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
}
|
||||
|
||||
//打印在内存中的高度和宽度
|
||||
void p_hw(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer在内存中所占的高度和宽度分别是:\n\t宽度 = %d\n\t高度 = %d\n",pFbdev->fb_var.height,pFbdev->fb_var.width);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
#ifndef __FBTOOL_H_
|
||||
#define __FBTOOL_H_
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct fbdev{
|
||||
int fb; //framebuffer打开后的唯一标识符
|
||||
struct fb_fix_screeninfo fb_fix;
|
||||
struct fb_var_screeninfo fb_var;
|
||||
char dev[20];
|
||||
}FBDEV,*PFBDEV;
|
||||
|
||||
//打开framebuffer
|
||||
int fb_open(PFBDEV pFbdev);
|
||||
//关闭framebuffer
|
||||
int fb_close(PFBDEV pFbdev);
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
void pmem_start(PFBDEV pFbdev);
|
||||
//打印FB_TYPE
|
||||
void p_type(PFBDEV pFbdev);
|
||||
//打印可见清晰度
|
||||
void p_visible_res(PFBDEV pFbdev);
|
||||
//打印虚拟分辨率
|
||||
void p_virt_res(PFBDEV pFbdev);
|
||||
//打印虚拟到可见的偏移量
|
||||
void p_offset(PFBDEV pFbdev);
|
||||
//打印每个像素的位数
|
||||
void p_bpp(PFBDEV pFbdev);
|
||||
//打印R,G,B和透明度
|
||||
void p_rgbt(PFBDEV pFbdev);
|
||||
//打印在内存中的高度和宽度
|
||||
void p_hw(PFBDEV pFbdev);
|
||||
|
||||
#endif
|
38
fb3/test.c~
38
fb3/test.c~
|
@ -1,38 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
FBDEV fbdev;
|
||||
|
||||
memset(&fbdev,0,sizeof(FBDEV));
|
||||
strcpy(fbdev.dev,"/dev/fb0");
|
||||
|
||||
if(0 == fb_open(&fbdev)){
|
||||
printf("Open fail!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
pmem_start(&fbdev);
|
||||
//打印FB_TYPE
|
||||
p_type(&fbdev);
|
||||
//打印可见清晰度
|
||||
p_visible_res(&fbdev);
|
||||
//打印虚拟分辨率
|
||||
p_virt_res(&fbdev);
|
||||
//打印虚拟到可见的偏移量
|
||||
p_offset(&fbdev);
|
||||
//打印每个像素的位数
|
||||
p_bpp(&fbdev);
|
||||
//打印R,G,B和透明度
|
||||
p_rgbt(&fbdev);
|
||||
//打印在内存中的高度和宽度
|
||||
p_hw(&fbdev);
|
||||
//打印fb的RGB和透明度的位域
|
||||
p_rgbt(&fbdev);
|
||||
|
||||
fb_close(&fbdev);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
//打开并且初始化该frame buffer
|
||||
int fb_open(PFBDEV pFbdev)
|
||||
{
|
||||
//打开frame buffer
|
||||
pFbdev->fb = open(pFbdev->dev,O_RDWR);
|
||||
|
||||
if(pFbdev->fb < 0)
|
||||
{
|
||||
printf("打开错误 %s : %n.请检查内核配置\n",pFbdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_var
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_VSCREENINFO,&(pFbdev->fb_var)))
|
||||
{
|
||||
printf("ioctl FBIOGET_VSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_fix
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_FSCREENINFO,&(pFbdev->fb_fix)))
|
||||
{
|
||||
printf("ioctl FBIOGET_FSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//关闭frame buffer
|
||||
int fb_close(PFBDEV pFbdev)
|
||||
{
|
||||
close(pFbdev->fb);
|
||||
pFbdev->fb = -1;
|
||||
}
|
||||
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
void pmem_start(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer所占内存的开始地址为:%lu\n",pFbdev->fb_fix.smem_start);
|
||||
}
|
||||
|
||||
//打印FB_TYPE
|
||||
void p_type(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer 的类型为:%u\n",pFbdev->fb_fix.type);
|
||||
}
|
||||
|
||||
//打印可见清晰度
|
||||
void p_visible_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的可见清晰度为:\n\tx = %u\n\ty = %u\n",pFbdev->fb_var.xres,pFbdev->fb_var.yres);
|
||||
}
|
||||
|
||||
//打印虚拟分辨率
|
||||
void p_virt_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟清晰度为:\n\tx = %u\n\ty = %u\n",pFbdev->fb_var.xres_virtual,pFbdev->fb_var.yres_virtual);
|
||||
}
|
||||
|
||||
//打印虚拟到可见的偏移量
|
||||
void p_offset(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟分辨率到可见分辨率的偏移量为:\n\tx = %u\n\ty = %u\n",pFbdev->fb_var.xoffset,pFbdev->fb_var.yoffset);
|
||||
}
|
||||
|
||||
//打印每个像素的位数
|
||||
void p_bpp(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的BPP为:%d\n",pFbdev->fb_var.bits_per_pixel);
|
||||
}
|
||||
|
||||
//打印R,G,B和透明度
|
||||
void p_rgbt(PFBDEV pFbdev)
|
||||
{
|
||||
printf("这个后面再说!!\n");
|
||||
}
|
||||
|
||||
//打印在内存中的高度和宽度
|
||||
void p_hw(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer在内存中所占的高度和宽度分别是:\n\t宽度 = %u\n\t高度 = %u\n",pFbdev->fb_var.height,pFbdev->fb_var.width);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
#ifndef __FBTOOL_H_
|
||||
#define __FBTOOL_H_
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct fbdev{
|
||||
int fb; //framebuffer打开后的唯一标识符
|
||||
struct fb_fix_screeninfo fb_fix;
|
||||
struct fb_var_screeninfo fb_var;
|
||||
char dev[20];
|
||||
}FBDEV,*PFBDEV;
|
||||
|
||||
//打开framebuffer
|
||||
int fb_open(PFBDEV pFbdev);
|
||||
//关闭framebuffer
|
||||
int fb_close(PFBDEV pFbdev);
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
void pmem_start(PFBDEV pFbdev);
|
||||
//打印FB_TYPE
|
||||
void p_type(PFBDEV pFbdev);
|
||||
//打印可见清晰度
|
||||
void p_visible_res(PFBDEV pFbdev);
|
||||
//打印虚拟分辨率
|
||||
void p_virt_res(PFBDEV pFbdev);
|
||||
//打印虚拟到可见的偏移量
|
||||
void p_offset(PFBDEV pFbdev);
|
||||
//打印每个像素的位数
|
||||
void p_bpp(PFBDEV pFbdev);
|
||||
//打印R,G,B和透明度
|
||||
void p_rgbt(PFBDEV pFbdev);
|
||||
//打印在内存中的高度和宽度
|
||||
void p_hw(PFBDEV pFbdev);
|
||||
|
||||
#endif
|
|
@ -1,34 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
FBDEV fbdev;
|
||||
memset(&fbdev,0,sizeof(FBDEV));
|
||||
strcpy(fbdev.dev,"/dev/fb0");
|
||||
|
||||
if(0 == fb_open(&fbdev)){
|
||||
printf("Open fail!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
pmem_start(&fbdev);
|
||||
//打印FB_TYPE
|
||||
p_type(&fbdev);
|
||||
//打印可见清晰度
|
||||
p_visible_res(&fbdev);
|
||||
//打印虚拟分辨率
|
||||
p_virt_res(&fbdev);
|
||||
//打印虚拟到可见的偏移量
|
||||
p_offset(&fbdev);
|
||||
//打印每个像素的位数
|
||||
p_bpp(&fbdev);
|
||||
//打印R,G,B和透明度
|
||||
p_rgbt(&fbdev);
|
||||
//打印在内存中的高度和宽度
|
||||
p_hw(&fbdev);
|
||||
|
||||
fb_close(PFBDEV pFbdev);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
all:
|
||||
gcc page.h fbtool.h fbtool.c test.c -o test
|
||||
clean:
|
||||
rm test
|
226
fb5/fbtool.c~
226
fb5/fbtool.c~
|
@ -1,226 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
//打开并且初始化该frame buffer
|
||||
int fb_open(PFBDEV pFbdev)
|
||||
{
|
||||
//打开frame buffer
|
||||
pFbdev->fb = open(pFbdev->dev,O_RDWR);
|
||||
|
||||
if(pFbdev->fb < 0)
|
||||
{
|
||||
printf("打开错误 %s : %n.请检查内核配置\n",pFbdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_var
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_VSCREENINFO,&(pFbdev->fb_var)))
|
||||
{
|
||||
printf("ioctl FBIOGET_VSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_fix
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_FSCREENINFO,&(pFbdev->fb_fix)))
|
||||
{
|
||||
printf("ioctl FBIOGET_FSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//将物理地址映射到虚拟地址
|
||||
pFbdev->fb_mem_offset = (unsigned long)pFbdev->fb_fix.smem_start & (~PAGE_MASK);
|
||||
|
||||
pFbdev->fb_mem = (unsigned long int)mmap(NULL,pFbdev->fb_fix.smem_len + pFbdev->fb_mem_offset,PROT_READ|PROT_WRITE,MAP_SHARED,pFbdev->fb,0);
|
||||
|
||||
if(-1L == (long)pFbdev->fb_mem){
|
||||
printf("mmap error with mem:%lu,mem_offset:%lu\n",pFbdev->fb_mem_offset,pFbdev->fb_mem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//关闭frame buffer
|
||||
int fb_close(PFBDEV pFbdev)
|
||||
{
|
||||
close(pFbdev->fb);
|
||||
pFbdev->fb = -1;
|
||||
}
|
||||
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
void pmem_start(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer所占内存的开始地址为:%lu\n",pFbdev->fb_fix.smem_start);
|
||||
}
|
||||
|
||||
//打印FB_TYPE
|
||||
void p_type(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer 的类型为:%d\n",pFbdev->fb_fix.type);
|
||||
}
|
||||
|
||||
//打印可见清晰度
|
||||
void p_visible_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的可见清晰度为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xres,pFbdev->fb_var.yres);
|
||||
}
|
||||
|
||||
//打印虚拟分辨率
|
||||
void p_virt_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟清晰度为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xres_virtual,pFbdev->fb_var.yres_virtual);
|
||||
}
|
||||
|
||||
//打印虚拟到可见的偏移量
|
||||
void p_offset(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟分辨率到可见分辨率的偏移量为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xoffset,pFbdev->fb_var.yoffset);
|
||||
}
|
||||
|
||||
//打印每个像素的位数
|
||||
void p_bpp(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的BPP为:%d\n",pFbdev->fb_var.bits_per_pixel);
|
||||
}
|
||||
|
||||
//打印R,G,B和透明度
|
||||
void p_rgbt(PFBDEV pFbdev)
|
||||
{
|
||||
//R位域
|
||||
printf("R位域:\n");
|
||||
struct fb_bitfield bf = pFbdev->fb_var.red;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
|
||||
//G位域
|
||||
printf("G位域:\n");
|
||||
bf = pFbdev->fb_var.green;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
|
||||
// B位域
|
||||
printf("B位域:\n");
|
||||
bf = pFbdev->fb_var.blue;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
|
||||
// 透明度位域
|
||||
printf("透明度位域:\n");
|
||||
bf = pFbdev->fb_var.transp;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
}
|
||||
|
||||
//打印在内存中的高度和宽度
|
||||
void p_hw(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer在内存中所占的高度和宽度分别是:\n\t宽度 = %d\n\t高度 = %d\n",pFbdev->fb_var.height,pFbdev->fb_var.width);
|
||||
}
|
||||
|
||||
//清空控制台
|
||||
void clear_con(void *addr,int n,size_t len)
|
||||
{
|
||||
memset(addr,n,len);
|
||||
}
|
||||
|
||||
//映射到内存
|
||||
void fb_memcpy(void *addr,void *color,size_t len)
|
||||
{
|
||||
memcpy(addr,color,len);
|
||||
}
|
||||
|
||||
//画点
|
||||
void draw_dot(PFBDEV pFbdev,POINT p,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
uint32_t offset;
|
||||
uint8_t color[4];
|
||||
color[0] = b;
|
||||
color[1] = g;
|
||||
color[2] = r;
|
||||
color[3] = 0x0; //透明度
|
||||
|
||||
offset = p.y * pFbdev->fb_fix.line_length + 4 * p.x;
|
||||
//将操作映射到内存中
|
||||
fb_memcpy((void*)pFbdev->fb_mem + pFbdev->fb_mem_offset + offset,color,4);
|
||||
|
||||
}
|
||||
|
||||
//画横线
|
||||
void draw_h_line(PFBDEV pFbdev,POINT minX,POINT maxX,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
int m;
|
||||
|
||||
int length = maxX.x - minX.x;
|
||||
for(m = 0;m < length;m++){
|
||||
POINT tp;
|
||||
tp.x = minX.x + m;
|
||||
tp.y = minX.y;
|
||||
|
||||
draw_dot(pFbdev,tp,r,g,b);
|
||||
}
|
||||
}
|
||||
|
||||
//画竖线
|
||||
void draw_v_line(PFBDEV pFbdev,POINT minY,POINT maxY,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
int m;
|
||||
|
||||
int length = maxY.y - minY.y;
|
||||
for(m = 0;m < length;m++){
|
||||
POINT tp;
|
||||
tp.x = minY.x;
|
||||
tp.y = minY.y + m;
|
||||
|
||||
draw_dot(pFbdev,tp,r,g,b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//画一个矩形框
|
||||
void draw_rec(PFBDEV pFbdev,POINT lu,POINT ld,POINT ru,POINT rd,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
draw_h_line(pFbdev,lu,ru,r,g,b);
|
||||
draw_h_line(pFbdev,ld,rd,r,g,b);
|
||||
draw_v_line(pFbdev,lu,ld,r,g,b);
|
||||
draw_v_line(pFbdev,ru,rd,r,g,b);
|
||||
}
|
||||
|
||||
//填充一个矩形框
|
||||
void fill_rec(PFBDEV pFbdev,POINT lu,POINT ld,POINT ru,POINT rd,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
int xlen = ru.x - lu.x;
|
||||
int ylen = ld.y - lu.y;
|
||||
|
||||
int m,n;
|
||||
|
||||
for(m = 0;m < ylen;m++){
|
||||
for(n = 0;n < xlen;n++){
|
||||
POINT p;
|
||||
p.x = lu.x + n;
|
||||
p.y = lu.y + m;
|
||||
|
||||
draw_dot(pFbdev,p,r,g,b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
#ifndef __FBTOOL_H_
|
||||
#define __FBTOOL_H_
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include "page.h"
|
||||
|
||||
typedef struct fbdev{
|
||||
int fb; //framebuffer打开后的唯一标识符
|
||||
struct fb_fix_screeninfo fb_fix;
|
||||
struct fb_var_screeninfo fb_var;
|
||||
/* 新增 */
|
||||
unsigned long fb_mem_offset; //frame buffer所占内存的偏移量
|
||||
unsigned long fb_mem; //frame buffer的映射到进程内存空间的起始地址
|
||||
|
||||
char dev[20];
|
||||
}FBDEV,*PFBDEV;
|
||||
|
||||
typedef struct point{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
}POINT,*PPOINT;
|
||||
|
||||
//打开framebuffer
|
||||
int fb_open(PFBDEV pFbdev);
|
||||
//关闭framebuffer
|
||||
int fb_close(PFBDEV pFbdev);
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
void pmem_start(PFBDEV pFbdev);
|
||||
//打印FB_TYPE
|
||||
void p_type(PFBDEV pFbdev);
|
||||
//打印可见清晰度
|
||||
void p_visible_res(PFBDEV pFbdev);
|
||||
//打印虚拟分辨率
|
||||
void p_virt_res(PFBDEV pFbdev);
|
||||
//打印虚拟到可见的偏移量
|
||||
void p_offset(PFBDEV pFbdev);
|
||||
//打印每个像素的位数
|
||||
void p_bpp(PFBDEV pFbdev);
|
||||
//打印R,G,B和透明度
|
||||
void p_rgbt(PFBDEV pFbdev);
|
||||
//打印在内存中的高度和宽度
|
||||
void p_hw(PFBDEV pFbdev);
|
||||
//清空控制台
|
||||
void clear_con(void *addr,int n,size_t len);
|
||||
//映射到内存
|
||||
void fb_memcpy(void *addr,void *color,size_t len);
|
||||
//画点
|
||||
void draw_dot(PFBDEV pFbdev,POINT p,uint8_t r,uint8_t g,uint8_t b);
|
||||
//画横线
|
||||
void draw_h_line(PFBDEV pFbdev,POINT minX,POINT maxX,uint8_t r,uint8_t g,uint8_t b);
|
||||
//画竖线
|
||||
void draw_v_line(PFBDEV pFbdev,POINT minY,POINT maxY,uint8_t r,uint8_t g,uint8_t b);
|
||||
//画一个矩形框
|
||||
void draw_rec(PFBDEV pFbdev,POINT lu,POINT ld,POINT ru,POINT rd,uint8_t r,uint8_t g,uint8_t b);
|
||||
//填充一个矩形框
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
109
fb5/test.c~
109
fb5/test.c~
|
@ -1,109 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
FBDEV fbdev;
|
||||
|
||||
memset(&fbdev,0,sizeof(FBDEV));
|
||||
strcpy(fbdev.dev,"/dev/fb0");
|
||||
|
||||
if(0 == fb_open(&fbdev)){
|
||||
printf("Open fail!!\n");
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
pmem_start(&fbdev);
|
||||
//打印FB_TYPE
|
||||
p_type(&fbdev);
|
||||
//打印可见清晰度
|
||||
p_visible_res(&fbdev);
|
||||
//打印虚拟分辨率
|
||||
p_virt_res(&fbdev);
|
||||
//打印虚拟到可见的偏移量
|
||||
p_offset(&fbdev);
|
||||
//打印每个像素的位数
|
||||
p_bpp(&fbdev);
|
||||
//打印R,G,B和透明度
|
||||
p_rgbt(&fbdev);
|
||||
//打印在内存中的高度和宽度
|
||||
p_hw(&fbdev);
|
||||
//打印fb的RGB和透明度的位域
|
||||
p_rgbt(&fbdev);
|
||||
|
||||
getchar();
|
||||
|
||||
//清屏
|
||||
clear_con(fbdev.fb_mem + fbdev.fb_mem_offset,-1,fbdev.fb_fix.smem_len); */
|
||||
|
||||
POINT p;
|
||||
p.x = 100;
|
||||
p.y = 100;
|
||||
//画点
|
||||
draw_dot(&fbdev,p,0x0,0xff,0x0);
|
||||
|
||||
//划横线
|
||||
//画横线
|
||||
POINT p21;
|
||||
p21.x = 120;
|
||||
p21.y = 100;
|
||||
POINT p2;
|
||||
p2.x = 160;
|
||||
p2.y = 160;
|
||||
draw_h_line(&fbdev,p21,p2,0x0,0xff,0x0);
|
||||
|
||||
//画竖线
|
||||
POINT p31;
|
||||
p31.x = 100;
|
||||
p31.y = 120;
|
||||
POINT p3;
|
||||
p3.x = 100;
|
||||
p3.y = 160;
|
||||
draw_v_line(&fbdev,p31,p3,0x0,0xff,0x0);
|
||||
|
||||
POINT p40;
|
||||
p40.x = 120;
|
||||
p40.y = 120;
|
||||
POINT p41;
|
||||
p41.x = 160;
|
||||
p41.y = 120;
|
||||
POINT p42;
|
||||
p42.x = 120;
|
||||
p42.y = 160;
|
||||
POINT p43;
|
||||
p43.x = 160;
|
||||
p43.y = 160;
|
||||
//画矩形
|
||||
draw_rec(&fbdev,p40,p42,p41,p43,0x0,0xff,0x0);
|
||||
|
||||
POINT p50;
|
||||
p50.x = 100;
|
||||
p50.y = 180;
|
||||
POINT p51;
|
||||
p51.x = 160;
|
||||
p51.y = 180;
|
||||
POINT p52;
|
||||
p52.x = 100;
|
||||
p52.y = 220;
|
||||
POINT p53;
|
||||
p53.x = 160;
|
||||
p53.y = 220;
|
||||
//填充矩形
|
||||
fill_rec(&fbdev,p50,p52,p51,p53,0x0,0xff,0x0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
all:
|
||||
gcc page.h fbtool.h fbtool.c test.c -o test -lm
|
||||
clean:
|
||||
rm test
|
47
fb6/color.h~
47
fb6/color.h~
|
@ -1,47 +0,0 @@
|
|||
#ifndef _COLOR_H_
|
||||
#define _COLOR_H_
|
||||
|
||||
/**
|
||||
* 代表颜色的结构体
|
||||
* @property r 颜色对应的R值
|
||||
* @property g 颜色对应的G值
|
||||
* @property b 颜色对应的B值
|
||||
* @property t 颜色对应的T值
|
||||
*/
|
||||
typedef struct rgbt{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t t;
|
||||
}RGBT;
|
||||
|
||||
//定义一些常用的颜色属性
|
||||
#define BLACK "00000000" //黑色
|
||||
#define YELLOW "ffff0000" //黄色
|
||||
#define BLUE_LIGHT "B0E0E600" //淡蓝色
|
||||
#define YELLOW_BANANA "E3CF5700" //香蕉色
|
||||
#define BLUE_SKY "87CEEB00" //天蓝色
|
||||
#define ORIANGE "ff610000" //橙色
|
||||
#define GREEN "00ff0000" //绿色
|
||||
#define PURPLE "A020F000" //紫色
|
||||
#define RED "FF000000" //红色
|
||||
|
||||
|
||||
#endif //_COLOR_H_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
358
fb6/fbtool.c~
358
fb6/fbtool.c~
|
@ -1,358 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
//打开并且初始化该frame buffer
|
||||
int fb_open(PFBDEV pFbdev)
|
||||
{
|
||||
//打开frame buffer
|
||||
pFbdev->fb = open(pFbdev->dev,O_RDWR);
|
||||
|
||||
if(pFbdev->fb < 0)
|
||||
{
|
||||
printf("打开错误 %s : %n.请检查内核配置\n",pFbdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_var
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_VSCREENINFO,&(pFbdev->fb_var)))
|
||||
{
|
||||
printf("ioctl FBIOGET_VSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 初始化fb_fix
|
||||
if(-1 == ioctl(pFbdev->fb,FBIOGET_FSCREENINFO,&(pFbdev->fb_fix)))
|
||||
{
|
||||
printf("ioctl FBIOGET_FSCREENINFO\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
//将物理地址映射到虚拟地址
|
||||
pFbdev->fb_mem_offset = (unsigned long)pFbdev->fb_fix.smem_start & (~PAGE_MASK);
|
||||
|
||||
pFbdev->fb_mem = (unsigned long int)mmap(NULL,pFbdev->fb_fix.smem_len + pFbdev->fb_mem_offset,PROT_READ|PROT_WRITE,MAP_SHARED,pFbdev->fb,0);
|
||||
|
||||
if(-1L == (long)pFbdev->fb_mem){
|
||||
printf("mmap error with mem:%lu,mem_offset:%lu\n",pFbdev->fb_mem_offset,pFbdev->fb_mem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//关闭frame buffer
|
||||
int fb_close(PFBDEV pFbdev)
|
||||
{
|
||||
int r = close(pFbdev->fb);
|
||||
pFbdev->fb = -1;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
void pmem_start(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer所占内存的开始地址为:%lu\n",pFbdev->fb_fix.smem_start);
|
||||
}
|
||||
|
||||
//打印FB_TYPE
|
||||
void p_type(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer 的类型为:%d\n",pFbdev->fb_fix.type);
|
||||
}
|
||||
|
||||
//打印可见清晰度
|
||||
void p_visible_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的可见清晰度为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xres,pFbdev->fb_var.yres);
|
||||
}
|
||||
|
||||
//打印虚拟分辨率
|
||||
void p_virt_res(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟清晰度为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xres_virtual,pFbdev->fb_var.yres_virtual);
|
||||
}
|
||||
|
||||
//打印虚拟到可见的偏移量
|
||||
void p_offset(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的虚拟分辨率到可见分辨率的偏移量为:\n\tx = %d\n\ty = %d\n",pFbdev->fb_var.xoffset,pFbdev->fb_var.yoffset);
|
||||
}
|
||||
|
||||
//打印每个像素的位数
|
||||
void p_bpp(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer的BPP为:%d\n",pFbdev->fb_var.bits_per_pixel);
|
||||
}
|
||||
|
||||
//打印R,G,B和透明度
|
||||
void p_rgbt(PFBDEV pFbdev)
|
||||
{
|
||||
//R位域
|
||||
printf("R位域:\n");
|
||||
struct fb_bitfield bf = pFbdev->fb_var.red;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
|
||||
//G位域
|
||||
printf("G位域:\n");
|
||||
bf = pFbdev->fb_var.green;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
|
||||
// B位域
|
||||
printf("B位域:\n");
|
||||
bf = pFbdev->fb_var.blue;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
|
||||
// 透明度位域
|
||||
printf("透明度位域:\n");
|
||||
bf = pFbdev->fb_var.transp;
|
||||
printf("\t开始:%d\n",bf.offset);
|
||||
printf("\t长度:%d\n",bf.length);
|
||||
printf("\tMSB:%d\n",bf.msb_right);
|
||||
}
|
||||
|
||||
//打印在内存中的高度和宽度
|
||||
void p_hw(PFBDEV pFbdev)
|
||||
{
|
||||
printf("frame buffer在内存中所占的高度和宽度分别是:\n\t宽度 = %d\n\t高度 = %d\n",pFbdev->fb_var.height,pFbdev->fb_var.width);
|
||||
}
|
||||
|
||||
//清空控制台
|
||||
void clear_con(void *addr,int n,size_t len)
|
||||
{
|
||||
memset(addr,n,len);
|
||||
}
|
||||
|
||||
//映射到内存
|
||||
void fb_memcpy(void *addr,void *color,size_t len)
|
||||
{
|
||||
memcpy(addr,color,len);
|
||||
}
|
||||
|
||||
//画点
|
||||
void draw_dot(PFBDEV pFbdev,POINT p,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
uint32_t offset;
|
||||
uint8_t color[4];
|
||||
color[0] = b;
|
||||
color[1] = g;
|
||||
color[2] = r;
|
||||
color[3] = 0x0; //透明度
|
||||
|
||||
offset = p.y * pFbdev->fb_fix.line_length + 4 * p.x;
|
||||
//将操作映射到内存中
|
||||
fb_memcpy((void*)pFbdev->fb_mem + pFbdev->fb_mem_offset + offset,color,4);
|
||||
}
|
||||
|
||||
//画点
|
||||
void draw_dot_with_trans(PFBDEV pFbdev,POINT p,uint8_t r,uint8_t g,uint8_t b,uint8_t t)
|
||||
{
|
||||
uint32_t offset;
|
||||
uint8_t color[4];
|
||||
color[0] = b;
|
||||
color[1] = g;
|
||||
color[2] = r;
|
||||
color[3] = t; //透明度
|
||||
|
||||
offset = p.y * pFbdev->fb_fix.line_length + 4 * p.x;
|
||||
//将操作映射到内存中
|
||||
fb_memcpy((void*)pFbdev->fb_mem + pFbdev->fb_mem_offset + offset,color,4);
|
||||
}
|
||||
|
||||
//画横线
|
||||
void draw_h_line(PFBDEV pFbdev,POINT minX,POINT maxX,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
int m;
|
||||
|
||||
int length = maxX.x - minX.x;
|
||||
for(m = 0;m < length;m++){
|
||||
POINT tp;
|
||||
tp.x = minX.x + m;
|
||||
tp.y = minX.y;
|
||||
|
||||
draw_dot(pFbdev,tp,r,g,b);
|
||||
}
|
||||
}
|
||||
|
||||
void draw_h_line_with_trans(PFBDEV pFbdev,POINT minX,POINT maxX,uint8_t r,uint8_t g,uint8_t b,uint8_t t){
|
||||
int m;
|
||||
|
||||
int length = maxX.x - minX.x;
|
||||
for(m = 0;m < length;m++){
|
||||
POINT tp;
|
||||
tp.x = minX.x + m;
|
||||
tp.y = minX.y;
|
||||
|
||||
draw_dot_with_trans(pFbdev,tp,r,g,b,t);
|
||||
}
|
||||
}
|
||||
|
||||
//画竖线
|
||||
void draw_v_line(PFBDEV pFbdev,POINT minY,POINT maxY,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
int m;
|
||||
|
||||
int length = maxY.y - minY.y;
|
||||
for(m = 0;m < length;m++){
|
||||
POINT tp;
|
||||
tp.x = minY.x;
|
||||
tp.y = minY.y + m;
|
||||
|
||||
draw_dot(pFbdev,tp,r,g,b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//画一个矩形框
|
||||
void draw_rec(PFBDEV pFbdev,POINT lu,POINT ld,POINT ru,POINT rd,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
draw_h_line(pFbdev,lu,ru,r,g,b);
|
||||
draw_h_line(pFbdev,ld,rd,r,g,b);
|
||||
draw_v_line(pFbdev,lu,ld,r,g,b);
|
||||
draw_v_line(pFbdev,ru,rd,r,g,b);
|
||||
}
|
||||
|
||||
//填充一个矩形框
|
||||
void fill_rec(PFBDEV pFbdev,POINT lu,POINT ld,POINT ru,POINT rd,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
int xlen = ru.x - lu.x;
|
||||
int ylen = ld.y - lu.y;
|
||||
|
||||
int m,n;
|
||||
|
||||
for(m = 0;m < ylen;m++){
|
||||
for(n = 0;n < xlen;n++){
|
||||
POINT p;
|
||||
p.x = lu.x + n;
|
||||
p.y = lu.y + m;
|
||||
|
||||
draw_dot(pFbdev,p,r,g,b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//画点
|
||||
void draw_x_y_dot(PFBDEV pFbdev,int x,int y,uint8_t r,uint8_t g,uint8_t b)
|
||||
{
|
||||
POINT p;
|
||||
p.x = x;
|
||||
p.y = y;
|
||||
|
||||
draw_dot(pFbdev,p,r,g,b);
|
||||
}
|
||||
|
||||
//画点
|
||||
void draw_x_y_dot_with_trans(PFBDEV pFbdev,int x,int y,uint8_t r,uint8_t g,uint8_t b,uint8_t t)
|
||||
{
|
||||
POINT p;
|
||||
p.x = x;
|
||||
p.y = y;
|
||||
|
||||
draw_dot_with_trans(pFbdev,p,r,g,b,t);
|
||||
}
|
||||
|
||||
//画点
|
||||
void draw_x_y_color_dot(PFBDEV pFbdev,int x,int y,RGBT c)
|
||||
{
|
||||
draw_x_y_dot(pFbdev,x,y,c.r,c.g,c.b);
|
||||
}
|
||||
|
||||
//画点
|
||||
void draw_x_y_color_dot_with_trans(PFBDEV pFbdev,int x,int y,RGBT c)
|
||||
{
|
||||
draw_x_y_dot_with_trans(pFbdev,x,y,c.r,c.g,c.b,c.t);
|
||||
}
|
||||
|
||||
RGBT getRGBT(const char *temp){
|
||||
RGBT rgbt;
|
||||
|
||||
char *c_tmp;
|
||||
c_tmp = (char *)malloc(4 * sizeof(int));
|
||||
|
||||
c_tmp[0] = '0';
|
||||
c_tmp[1] = 'x';
|
||||
int r,g,b,t;
|
||||
|
||||
//RGBT值的计算
|
||||
c_tmp[2] = temp[0];
|
||||
c_tmp[3] = temp[1];
|
||||
|
||||
r = strtol(c_tmp,NULL,16);
|
||||
|
||||
c_tmp[2] = temp[2];
|
||||
c_tmp[3] = temp[3];
|
||||
|
||||
g = strtol(c_tmp,NULL,16);
|
||||
|
||||
c_tmp[2] = temp[4];
|
||||
c_tmp[3] = temp[5];
|
||||
|
||||
b = strtol(c_tmp,NULL,16);
|
||||
|
||||
c_tmp[2] = temp[6];
|
||||
c_tmp[3] = temp[7];
|
||||
|
||||
t = strtol(c_tmp,NULL,16);
|
||||
|
||||
rgbt.r = r;
|
||||
rgbt.g = g;
|
||||
rgbt.b = b;
|
||||
rgbt.t = t;
|
||||
|
||||
return rgbt;
|
||||
}
|
||||
|
||||
//画点 color8位,分别代表RGBT
|
||||
void draw_x_y_color_dot_with_string(PFBDEV pFbdev,int x,int y,const char *temp)
|
||||
{
|
||||
RGBT rgbt = getRGBT(temp);
|
||||
|
||||
draw_x_y_dot_with_trans(pFbdev,x,y,rgbt.r,rgbt.g,rgbt.b,rgbt.t);
|
||||
}
|
||||
|
||||
//划横线
|
||||
void draw_h_line_with_string(PFBDEV pFbdev,POINT minX,POINT maxX,const char *color)
|
||||
{
|
||||
RGBT rgbt = getRGBT(color);
|
||||
|
||||
draw_h_line_with_trans(pFbdev,minX,maxX,rgbt.r,rgbt.g,rgbt.b,rgbt.t);
|
||||
}
|
||||
|
||||
//画圆
|
||||
void draw_circle(PFBDEV pFbdev,int x,int y,int radius,const char *color)
|
||||
{
|
||||
double i;
|
||||
|
||||
int tmp;
|
||||
|
||||
for(i = x - radius; i < x + radius;i+=0.01){
|
||||
tmp = sqrt(radius * radius - (i - x) * (i - x));
|
||||
|
||||
draw_x_y_color_dot_with_string(pFbdev,i,(tmp + y),color);
|
||||
draw_x_y_color_dot_with_string(pFbdev,i,(-tmp + y),color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
326
fb6/fbtool.h~
326
fb6/fbtool.h~
|
@ -1,326 +0,0 @@
|
|||
#ifndef __FBTOOL_H_
|
||||
#define __FBTOOL_H_
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include "page.h"
|
||||
#include "color.h"
|
||||
|
||||
/**
|
||||
* 该结构体主要是定义了一组保存frame buffer的属性
|
||||
* @property fb frame buffer打开后的唯一标识符
|
||||
* @property fb_fix frame buffer的固定属性就保存在这个结构体中
|
||||
* @property fb_var frame buffer的可变属性保存在这个结构体中
|
||||
* @property fb_mem_offset frame buffer所占内存的偏移量
|
||||
* @property fb_mem frame buffer的映射到进程内存空间的起始地址
|
||||
*/
|
||||
typedef struct fbdev{
|
||||
int fb;
|
||||
struct fb_fix_screeninfo fb_fix;
|
||||
struct fb_var_screeninfo fb_var;
|
||||
/* 新增 */
|
||||
unsigned long fb_mem_offset;
|
||||
unsigned long fb_mem;
|
||||
|
||||
char dev[20];
|
||||
}FBDEV,*PFBDEV;
|
||||
|
||||
/**
|
||||
* 该结构体用于定位点的位置,包括横坐标,纵坐标,深坐标
|
||||
* @property x 横坐标
|
||||
* @property y 纵坐标
|
||||
* @property z 深坐标(这个用于3D)
|
||||
*/
|
||||
typedef struct point{
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
}POINT,*PPOINT;
|
||||
|
||||
/*
|
||||
* 该函数用于打开frame buffer
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return 0 - 打开失败
|
||||
* 1 - 打开成功
|
||||
*/
|
||||
int fb_open(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 该函数用于关闭frame buffer设备
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return 0 - 关闭成功
|
||||
* >0 - 关闭失败
|
||||
*/
|
||||
int fb_close(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 该函数用于打印frame buffer 所占内存的开始地址
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return void
|
||||
*/
|
||||
void pmem_start(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 该函数用于打印FB_TYPE
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return void
|
||||
*/
|
||||
void p_type(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 该函数用于打印可见清晰度
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return void
|
||||
*/
|
||||
void p_visible_res(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 该函数用于打印虚拟分辨率
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return void
|
||||
*/
|
||||
void p_virt_res(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 该函数用于打印虚拟到可见的偏移量
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return void
|
||||
*/
|
||||
void p_offset(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 该函数用于打印每个像素的位数
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return void
|
||||
*/
|
||||
void p_bpp(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 该函数用于打印R,G,B和透明度
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return void
|
||||
*/
|
||||
void p_rgbt(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 该函数用于打印在内存中的高度和宽度
|
||||
* @param pFbdev 参照结构体 fbdev
|
||||
* @return void
|
||||
*/
|
||||
void p_hw(PFBDEV pFbdev);
|
||||
|
||||
/*
|
||||
* 将addr开始的len个字符用n替换
|
||||
* @param addr 开始的地址
|
||||
* @param n 替换后的字符
|
||||
* @param len 要替换的字符的个数
|
||||
* @return void
|
||||
*/
|
||||
void clear_con(void *addr,int n,size_t len);
|
||||
|
||||
/*
|
||||
* 该函数将逻辑地址空间的数据映射到内存当中
|
||||
* @param addr 内存空间的地址
|
||||
* @param color 颜色值
|
||||
* @param len 需要映射的长度
|
||||
* @return void
|
||||
*/
|
||||
void fb_memcpy(void *addr,void *color,size_t len);
|
||||
|
||||
/*
|
||||
* 该函数用于在命令行中画点
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param p 点的坐标
|
||||
* @param r 颜色对应的R值
|
||||
* @param g 颜色对应的G值
|
||||
* @param b 颜色对应的B值
|
||||
* @return void
|
||||
*/
|
||||
void draw_dot(PFBDEV pFbdev,POINT p,uint8_t r,uint8_t g,uint8_t b);
|
||||
|
||||
/*
|
||||
* 该函数用于实现画点,不过在这个函数中需要设定透明度参数
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param p 点的坐标
|
||||
* @param r 颜色对应的R值
|
||||
* @param g 颜色对应的G值
|
||||
* @param b 颜色对应的B值
|
||||
* @param t 颜色对应的透明度值
|
||||
* @return void
|
||||
*/
|
||||
void draw_dot_with_trans(PFBDEV pFbdev,POINT p,uint8_t r,uint8_t g,uint8_t b,uint8_t t);
|
||||
|
||||
/*
|
||||
* 该函数用于指定点的横坐标,纵坐标的值来画点
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param x 点的坐标对应的横坐标的值
|
||||
* @param y 点的坐标对应的纵坐标的值
|
||||
* @param r 颜色对应的R值
|
||||
* @param g 颜色对应的G值
|
||||
* @param b 颜色对应的B值
|
||||
*/
|
||||
void draw_x_y_dot(PFBDEV pFbdev,int x,int y,uint8_t r,uint8_t g,uint8_t b);
|
||||
|
||||
/*
|
||||
* 该函数用于指定点的横坐标,纵坐标的值,并且必须指明透明度来画点
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param x 点的坐标对应的横坐标的值
|
||||
* @param y 点的坐标对应的纵坐标的值
|
||||
* @param r 颜色对应的R值
|
||||
* @param g 颜色对应的G值
|
||||
* @param b 颜色对应的B值
|
||||
* @param t 颜色对应的透明度值
|
||||
*/
|
||||
void draw_x_y_dot_with_trans(PFBDEV pFbdev,int x,int y,uint8_t r,uint8_t g,uint8_t b,uint8_t t);
|
||||
|
||||
/*
|
||||
* 该函数指定点的横纵坐标,然后使用结构体rgbt来代替颜色来画点
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param x 点的坐标对应的横坐标的值
|
||||
* @param y 点的坐标对应的纵坐标的值
|
||||
* @param c 用来代表颜色的结构体
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
void draw_x_y_color_dot(PFBDEV pFbdev,int x,int y,RGBT c);
|
||||
|
||||
/*
|
||||
* 该函数指定点的横纵坐标,然后使用结构体rgbt来代替颜色来画点,不过在这里指明透明度是有效果
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param x 点的坐标对应的横坐标的值
|
||||
* @param y 点的坐标对应的纵坐标的值
|
||||
* @param c 用来代表颜色的结构体
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
void draw_x_y_color_dot_with_trans(PFBDEV pFbdev,int x,int y,RGBT c);
|
||||
|
||||
/*
|
||||
* 该函数指定点的横纵坐标,然后使用八位的字符串来指明颜色来画点
|
||||
* 注意:这里的字符串里面都是16进制的数值,例如,"ffff0000"
|
||||
*
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param x 点的坐标对应的横坐标的值
|
||||
* @param y 点的坐标对应的纵坐标的值
|
||||
* @param c 用来代表颜色的结构体
|
||||
* @param color 用来指明颜色的字符串
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
void draw_x_y_color_dot_with_string(PFBDEV pFbdev,int x,int y,const char *color);
|
||||
|
||||
/*
|
||||
* 指定x值较小的点和x值较大的点,并指定颜色的rgb值画一条横线
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param minX x较小的点
|
||||
* @param maxX x较大的点
|
||||
* @param r 颜色对应的R值
|
||||
* @param g 颜色对应的G值
|
||||
* @param b 颜色对应的B值
|
||||
* @return void
|
||||
*/
|
||||
void draw_h_line(PFBDEV pFbdev,POINT minX,POINT maxX,uint8_t r,uint8_t g,uint8_t b);
|
||||
|
||||
/*
|
||||
* 指定x值较小的点和x值较大的点,并指定颜色的rgb值和透明度画一条横线
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param minX x较小的点
|
||||
* @param maxX x较大的点
|
||||
* @param r 颜色对应的R值
|
||||
* @param g 颜色对应的G值
|
||||
* @param b 颜色对应的B值
|
||||
* @param t 颜色对应的透明度
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
void draw_h_line_with_trans(PFBDEV pFbdev,POINT minX,POINT maxX,uint8_t r,uint8_t g,uint8_t b,uint8_t t);
|
||||
|
||||
/*
|
||||
* 使用字符串作为颜色的表示来画一条横线
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param minX x较小的点
|
||||
* @param maxX x较大的点
|
||||
* @param color 颜色所对应的字符串
|
||||
* @return void
|
||||
*/
|
||||
void draw_h_line_with_string(PFBDEV pFbdev,POINT minX,POINT maxX,const char *color);
|
||||
|
||||
/*
|
||||
* 指明y最小的一个点和一个y较大的点,并指明RGB值画一条竖线
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param minY y较小的点
|
||||
* @param maxY y较大的点
|
||||
* @param r 颜色对应的R值
|
||||
* @param g 颜色对应的G值
|
||||
* @param b 颜色对应的B值
|
||||
*/
|
||||
void draw_v_line(PFBDEV pFbdev,POINT minY,POINT maxY,uint8_t r,uint8_t g,uint8_t b);
|
||||
|
||||
/*
|
||||
* 画一个矩形框
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param lu 矩形框左上角的点
|
||||
* @param ld 矩形框左下角的点
|
||||
* @param ru 矩形框右上角的点
|
||||
* @param rd 矩形框右下角的点
|
||||
* @param r 颜色对应的R值
|
||||
* @param g 颜色对应的G值
|
||||
* @param b 颜色对应的B值
|
||||
* @return void
|
||||
*/
|
||||
void draw_rec(PFBDEV pFbdev,POINT lu,POINT ld,POINT ru,POINT rd,uint8_t r,uint8_t g,uint8_t b);
|
||||
|
||||
/*
|
||||
* 填充一个矩形框
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param lu 矩形框左上角的点
|
||||
* @param ld 矩形框左下角的点
|
||||
* @param ru 矩形框右上角的点
|
||||
* @param rd 矩形框右下角的点
|
||||
* @param r 颜色对应的R值
|
||||
* @param g 颜色对应的G值
|
||||
* @param b 颜色对应的B值
|
||||
* @return void
|
||||
*/
|
||||
void fill_rec(PFBDEV pFbdev,POINT lu,POINT ld,POINT ru,POINT rd,uint8_t r,uint8_t g,uint8_t b);
|
||||
|
||||
/*
|
||||
* 根据字符串获得相应的RGBT
|
||||
* @param color 颜色对应的字符串
|
||||
* @return 返回代表颜色的结构体 RGBT
|
||||
*/
|
||||
RGBT getRGBT(const char *color);
|
||||
|
||||
/*
|
||||
* 画一个圆
|
||||
* @param pFbdev 参考结构体 fbdev
|
||||
* @param x 圆的圆心所在的点的x值
|
||||
* @param y 圆的圆心所在的点的y值
|
||||
* @param radius 圆的半径的长度
|
||||
* @color 代表颜色的字符串
|
||||
* @return void
|
||||
*/
|
||||
void draw_circle(PFBDEV pFbdev,int x,int y,int radius,const char *color);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
125
fb6/test.c~
125
fb6/test.c~
|
@ -1,125 +0,0 @@
|
|||
#include "fbtool.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
FBDEV fbdev;
|
||||
|
||||
memset(&fbdev,0,sizeof(FBDEV));
|
||||
strcpy(fbdev.dev,"/dev/fb0");
|
||||
|
||||
if(0 == fb_open(&fbdev)){
|
||||
printf("Open fail!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
//打印frame buffer 所占内存的开始地址
|
||||
pmem_start(&fbdev);
|
||||
//打印FB_TYPE
|
||||
p_type(&fbdev);
|
||||
//打印可见清晰度
|
||||
p_visible_res(&fbdev);
|
||||
//打印虚拟分辨率
|
||||
p_virt_res(&fbdev);
|
||||
//打印虚拟到可见的偏移量
|
||||
p_offset(&fbdev);
|
||||
//打印每个像素的位数
|
||||
p_bpp(&fbdev);
|
||||
//打印R,G,B和透明度
|
||||
p_rgbt(&fbdev);
|
||||
//打印在内存中的高度和宽度
|
||||
p_hw(&fbdev);
|
||||
//打印fb的RGB和透明度的位域
|
||||
p_rgbt(&fbdev);
|
||||
|
||||
getchar();
|
||||
|
||||
//清屏
|
||||
clear_con(fbdev.fb_mem + fbdev.fb_mem_offset,-1,fbdev.fb_fix.smem_len); */
|
||||
|
||||
|
||||
POINT p;
|
||||
p.x = 100;
|
||||
p.y = 100;
|
||||
//画点
|
||||
draw_x_y_dot(&fbdev,100,100,0x0,0xff,0x0);
|
||||
/*
|
||||
RGBT c;
|
||||
c.r = 0xff;
|
||||
c.g = 0xff;
|
||||
c.b = 0xff;
|
||||
c.t = 0x00;
|
||||
//draw_x_y_color_dot_with_trans(&fbdev,100,100,RED);
|
||||
draw_x_y_color_dot_with_string(&fbdev,100,100,YELLOW);
|
||||
|
||||
//划横线
|
||||
//画横线
|
||||
POINT p21;
|
||||
p21.x = 120;
|
||||
p21.y = 100;
|
||||
POINT p2;
|
||||
p2.x = 160;
|
||||
p2.y = 160;
|
||||
//draw_h_line(&fbdev,p21,p2,0x0,0xff,0x0);
|
||||
draw_h_line_with_string(&fbdev,p21,p2,RED);
|
||||
|
||||
//画竖线
|
||||
POINT p31;
|
||||
p31.x = 100;
|
||||
p31.y = 120;
|
||||
POINT p3;
|
||||
p3.x = 100;
|
||||
p3.y = 160;
|
||||
draw_v_line(&fbdev,p31,p3,0x0,0xff,0x0);
|
||||
|
||||
POINT p40;
|
||||
p40.x = 120;
|
||||
p40.y = 120;
|
||||
POINT p41;
|
||||
p41.x = 160;
|
||||
p41.y = 120;
|
||||
POINT p42;
|
||||
p42.x = 120;
|
||||
p42.y = 160;
|
||||
POINT p43;
|
||||
p43.x = 160;
|
||||
p43.y = 160;
|
||||
//画矩形
|
||||
draw_rec(&fbdev,p40,p42,p41,p43,0x0,0xff,0x0);
|
||||
|
||||
POINT p50;
|
||||
p50.x = 100;
|
||||
p50.y = 180;
|
||||
POINT p51;
|
||||
p51.x = 160;
|
||||
p51.y = 180;
|
||||
POINT p52;
|
||||
p52.x = 100;
|
||||
p52.y = 220;
|
||||
POINT p53;
|
||||
p53.x = 160;
|
||||
p53.y = 220;
|
||||
//填充矩形
|
||||
fill_rec(&fbdev,p50,p52,p51,p53,0x0,0xff,0x0);*/
|
||||
|
||||
draw_circle(&fbdev,500,400,100,RED);
|
||||
|
||||
fb_close(&fbdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue