#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <getopt.h>
#include <sys/vt.h>
#include <png.h>
#include <zlib.h>
#include <linux/fb.h>
static int Blue = 0;
static int Green = 1;
static int Red = 2;
static int Alpha = 3;
int main(int argc, char**argv)
{
struct fb_var_screeninfo fb_varinfo;
int fd;
int bitdepth, height, width;
size_t buf_size;
size_t buf_size1;
unsigned char *inbuffer;
unsigned char *outbuffer;
/*fb_fix_screeninfo信息的设置*/
memset(&fb_varinfo, 0, sizeof(struct fb_var_screeninfo));
/*打开fb0设备节点*/
fd = open("/dev/fb0",O_RDWR);
if( fd == -1)
{
printf("open dev fb0 error\n");
return -1;
}
ioctl(fd,FBIOGET_VSCREENINFO, &fb_varinfo);
printf("xres = %u yres = %u\n",fb_varinfo.xres,fb_varinfo.yres);
bitdepth = (int)fb_var
嵌入式系统平台,读取framebuffer保存为png图片
最新推荐文章于 2022-07-20 17:08:32 发布