欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
framebuffer編程顯示真彩圖片
/*自己寫(xiě)的framebuffer 可以在yc的2440板子上顯示真彩圖片*/

#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>

#include "image.h"
#include "image0.h"
#include "image1.h"


#define FB_NAME "/dev/fb0"
#define TRUE 1
struct FB_MSG
{
        int fb;
        struct fb_var_screeninfo vinfo;
        struct fb_fix_screeninfo finfo;
        long screensize;
        char *fbp;
};

typedef struct FB_MSG FB;


void open_fb(FB *fb_msg)
{
        int fb;
        fb=open(FB_NAME,O_RDWR);
        if (fb<0)
        {
                printf("Error: Can not open framebuffer device \n");
                exit(1);
        }
         fb_msg->fb=fb;
}
int get_fb_msg(FB *fb_msg)
{
        if (ioctl(fb_msg->fb,FBIOGET_FSCREENINFO,&fb_msg->finfo))
        {
                printf("Error: Reading fixed information \n");
                exit(2);
        }
        if (ioctl(fb_msg->fb,FBIOGET_VSCREENINFO,&fb_msg->vinfo))
        {
                printf("Error: Reading variable information \n");
                exit(3);
        }

        return TRUE;
}

int fb_mmap(FB *fb_msg)
{
        fb_msg->screensize=fb_msg->vinfo.xres * fb_msg->vinfo.yres * fb_msg->vinfo.bits_per_pixel / 8;
        fb_msg->fbp=(char *)mmap(0,fb_msg->screensize,PROT_READ | PROT_WRITE, MAP_SHARED,fb_msg->fb,0);
        if ((int)fb_msg->fbp == -1)
        {
                printf("Error : failed to map framebuffer device to memory. \n");
                exit(4);
        }
        return TRUE;
}

int fb_ummap(FB *fb_msg)
{
        munmap(fb_msg->fbp,fb_msg->screensize);
        close(fb_msg->fb);
}
void draw_picture(const unsigned int *image,FB *fb_msg)
{
        int x,y,count=0;
        long location=0;
        for(x=0;x<fb_msg->vinfo.xres;x++)
                for(y=fb_msg->vinfo.yres-1;y>=0;y--)
                {
                        location = x*(fb_msg->vinfo.bits_per_pixel / 8) + y* fb_msg->finfo.line_length;
                        *(fb_msg->fbp+location)=image[count];
                        *(fb_msg->fbp+location+1)=image[count+1];
                        count=count+2;
                }
}

void clear_screen(int color,FB *fb_msg)
{
        int x,y;
        long location=0;
        for(x=0;x<fb_msg->vinfo.xres;x++)
                for(y=fb_msg->vinfo.yres-1;y>=0;y--)
                {
                        location = x*(fb_msg->vinfo.bits_per_pixel / 8) + y* fb_msg->finfo.line_length;
                        *(fb_msg->fbp+location)=color;
                        *(fb_msg->fbp+location+1)=color;
                }

}
main()
{
        FB *fb;
        fb=(FB *)malloc(sizeof(FB));
        open_fb(fb);
        get_fb_msg(fb);
        fb_mmap(fb);
        clear_screen(0xff,fb);
//      draw_picture(image0,fb);
        draw_picture(image1,fb);
//      draw_picture(image,fb);
        fb_ummap(fb);
}
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
framebuffer應用程序編寫(xiě)
FrameBuffer編程二(簡(jiǎn)單程序下)
對FrameBuffer的一夜hack。。。
framebuffer 和skia 結合搭建GUI
fb在啟動(dòng)后默認是TEXT模式,如何讓fb啟動(dòng)默認為圖形模式
直接寫(xiě)framebuffer
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久