📄 logo.c
字号:
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "linux_logo.h"
#define height 80
#define width 80
static int allwidth=640, allheight=480, bpp=16;
#define FBDEV "/dev/fb/0"
#define FBSIZE (allwidth*allheight*bpp/8)
int main()
{
int row,col,background,count;
int fb;
unsigned char* fb_mem;
// unsigned short int *p=(unsigned short int*)fb_mem;
unsigned short int *p;
fb = open (FBDEV, O_RDWR);
if(fb<0){
printf("device %s open failed\n", FBDEV);
return -1;
}
fb_mem = mmap (NULL, FBSIZE, PROT_READ|PROT_WRITE,MAP_SHARED,fb,0);
if(fb_mem==NULL){
printf("mmap failed\n");
close(fb);
return -1;
}
memset (fb_mem, 0x0, FBSIZE);
p=(unsigned short int*)fb_mem;
for(row=1;row<=allheight;row++)
{
for(col=1;col<=allwidth;col++)
{
if((col<=width) && (row<=height)){
count=linux_logo[(row-1)*80+col-1]-0x20;
// background = ((background << 8)/8) | ((background << 8)/4) | ((background << 8)/8);
background=((linux_logo_red[count]>>3)<<11) | ((linux_logo_green[count]>>2)<<5) | (linux_logo_blue[count]>>3);
}
else background=0x0;
*p=background;
p++;
// printf("%d",background);
// getchar();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -