Advertisement

文件IO处理BMP和JPG图片文件I/O操作

阅读量:

一、BMP图的实现

练习1:
再实现一张BMP图

复制代码
  //打开lcd

    
 	int lcd = open("/dev/fb0",O_RDWR);
    
 	if(lcd < 0)
    
 	{
    
 		perror("open error!\n");
    
 		return -1;
    
 	}
    
 	
    
 	//lcd映射
    
 	//指针指向一个像素点
    
 	int *p = mmap(NULL,800*480*4,PROT_READ|PROT_WRITE,MAP_SHARED,lcd,0);
    
 	if(p == NULL)
    
 	{
    
 		perror("mmap fail!\n");
    
 		return -1;
    
 	}	
    
 	//打开bmp图片
    
 	int lcd_bmp = open("1.bmp",O_RDWR);
    
 	if(lcd_bmp < 0)
    
 	{
    
 		printf("open bmp fa

全部评论 (0)

还没有任何评论哟~