使用svgalib

下载地址:
https://launchpad.net/ubuntu/+source/svgalib/1:1.4.3-30
svgalib_1.4.3.orig.tar.gz
svgalib_1.4.3-30.debian.tar.gz
svgalib_1.4.3-30.dsc

打补丁
tar xzf svgalib_1.4.3.orig.tar.gz
tar xzf svgalib_1.4.3-30.debian.tar.gz
cd svgalib-1.4.3.orig/
for file in ../debian/patches/*.patch; do patch -p1 < $file; done
执行for循环对于上层目录里的debian/patches/*.patch所有文件 执行 patch -p1 < $file命令

编译安装:
sudo make install   // 编译出错,需要安装libx86
再 sudo make install

下载地址
http://packages.ubuntu.com/lucid/libx86-1

tar xzf libx86_1.1+ds1.orig.tar.gz
gunzip libx86_1.1+ds1-6.diff.gz
cd libx86-1.1/
patch -p1 < ../libx86_1.1+ds1-6.diff
make // 出错,修改lrmi.c,添加宏, 参考561491.patch
make
sudo make install

ctrl+alt+shift+f1

#include <stdlib.h>
#include <vga.h>
#include <vgagl.h> /* gcc -o svgatest svgatest.c -lvga -lvgagl */ int main(void)
{
int x, y; vga_init();
vga_setmode(G320x200x256);
vga_setcolor(); for (x = ; x < ; x++)
for (y = ; y < ; y++)
vga_drawpixel(x, y); sleep();
vga_setmode(TEXT); return EXIT_SUCCESS;
}

sudo ./svgatest

如果缺少动态链接库

http://www.cnblogs.com/CZM-/p/5342427.html

使用调色板

#include <vgagl.h>

 gl_setpalettecolor(, 0xE7>>, 0xDB>>, 0xB5>>);   /* 0xE7DBB5  */ /* ·º»ÆµÄÖ½ */

gcc -o svgatest svgatest.c  -lvga -lvgagl

开始写pc电子书显示程序

修改Makefile

不用交叉编译

CROSSCOMPILE :=

添加库

all: $(OBJS)
        $(CC) $(LDFLAGS) -o show_file $^ -lvga -lvgagl

指定头文件目录

CFLAGS  += -I$(PWD)/include -I /usr/include/freetype2/

display/crt.o                  \

#include <config.h>
#include <disp_manager.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/fb.h>
#include <string.h> #include <stdlib.h>
#include <vga.h>
#include <vgagl.h> static int CRTDeviceInit(void);
static int CRTShowPixel(int iX, int iY, unsigned int dwColor);
static int CRTCleanScreen(unsigned int dwBackColor);
static int CRTDeviceExit(void); static T_DispOpr g_tCRTOpr = {
/* ÏÔʾÆÁĬÈÏÃû×Ö "crt*/
.name = "crt",
.DeviceInit = CRTDeviceInit,
.DeviceExit = CRTDeviceExit,
.ShowPixel = CRTShowPixel,
.CleanScreen = CRTCleanScreen,
}; static int CRTDeviceInit(void)
{
vga_init();
vga_setmode(G320x200x256);
g_tCRTOpr.iXres = ;
g_tCRTOpr.iYres = ;
g_tCRTOpr.iBpp = ;
return ;
} static int CRTDeviceExit(void)
{
vga_setmode(TEXT); return EXIT_SUCCESS;
} static int CRTShowPixel(int iX, int iY, unsigned int dwColor)
{
int iRed,iGreen,iBlue; iRed = (dwColor >> ) & (0xff);
iGreen = (dwColor >> ) & (0xff);
iBlue = (dwColor >> ) & (0xff); gl_setpalettecolor(, iRed>>, iGreen>>, iBlue>>); /* 0xE7DBB5 */ /* ·º»ÆµÄÖ½ */
vga_setcolor(); vga_drawpixel(iX, iY);
return ;
} static int CRTCleanScreen(unsigned int dwBackColor)
{
int iX;
int iY;
int iRed,iGreen,iBlue; iRed = (dwBackColor >> ) & (0xff);
iGreen = (dwBackColor >> ) & (0xff);
iBlue = (dwBackColor >> ) & (0xff); gl_setpalettecolor(, iRed>>, iGreen>>, iBlue>>); /* 0xE7DBB5 */ /* ·º»ÆµÄÖ½ */
vga_setcolor(); for (iX = ; iX < ; iX++)
for (iY = ; iY < ; iY++)
vga_drawpixel(iX, iY);
return ;
} int CRTInit(void)
{
return RegisterDispOpr(&g_tCRTOpr);
}

./show_file -s 16  -d crt -h HZK16   -f ./MSYH.TTF daomubiji.txt

最新文章

  1. iOS开发 点击某处横屏竖屏切换
  2. extjs的一些简单动画1
  3. Java NIO 开篇
  4. journal
  5. 物联网传输协议MQTT
  6. PHP常用类型判断函数总结
  7. BZOJ 1192 鬼谷子的钱袋 (二进制思想)
  8. iOS经常使用类别
  9. imageview无法显示图片:java.lang.RuntimeException: Canvas: trying to draw too large(281520000bytes) bitmap
  10. BZOJ_3173_[Tjoi2013]最长上升子序列_splay
  11. Makefile有三个非常有用的变量。分别是$@,$^,$
  12. dmp文件的导入导出
  13. 标准C语言实现基于TCP/IP协议的文件传输
  14. 微信小程序——wxParse使用方法
  15. Abp中SwaggerUI的接口文档添加上传文件参数类型
  16. MVC扩展DataAnnotationsModelMetadataProvider给model属性对应的页面元素添加任意属性和值
  17. JSP的页面连接和提交方式(web基础学习笔记六)
  18. openerp修改logo和title
  19. (转)Linux安装SwfTools-0.9.2安装事,在执行make install时报错
  20. JS操作时间 - UNIX时间戳简单介绍

热门文章

  1. hdu 1142 用优先队列实现Dijkstra
  2. D3.js 饼状图的制作
  3. 深入理解JVM虚拟机-2自动内存管理机制
  4. Linux 命令速查
  5. bottomNavigationBar 底部导航tab MD
  6. webpages框架使用@razor语法向js代码传递Json字符串
  7. X-UniTMX:导入大型Tiled地图文件(*.tmx)到Unity3d中比较好的插件
  8. VBA对象模型(1)
  9. JavaWeb基础: 会话技术简介
  10. (21)odoo中的QWeb模板引擎