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