showjpg.c
来自「SMDK2410开发板LINUX下的JPEG图片显示程序。」· C语言 代码 · 共 35 行
C
35 行
#include <stdio.h>#include <fcntl.h>intmain (void){ int fp; int x; int width, height; unsigned char *image; char buf = 0x00; fp = open ("/dev/fb/0", O_RDWR); if (fp < 0) { printf ("Error : Can not open framebuffer device\n"); exit (1); } read_jpeg("pic.jpg", &width, &height, &image); if ((width != 240) || (height != 320)) { printf("Error: not a 240*320 picture\n"); exit(1); } for (x = 0; x < 240 * 320 * 3; x+=3) { write (fp, &image[x+2], 1); write (fp, &image[x+1], 1); write (fp, &image[x], 1); write (fp, &buf, 1); } close (fp);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?