使用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

3.5电子书pc显示的更多相关文章

  1. 手机pc显示不同的内容

    <script type="text/javascript"> // var txt = $('#sjyincang').html(); // alert(txt); ...

  2. pc显示,手机隐藏

    <div class="none"><img src="https://www.foresthouse.cn/bigpic.jpg"/> ...

  3. html页面pc显示正常,在手机端适配也可以看整个页面

    <meta name="viewport" content="width=1250,initial-scale=0,maximum-scale=2"/&g ...

  4. 解密电子书之四:MCU(freescale)

    谈完国产的君正,让我们再看看呛了君正财路的freescale iMX51. 这是freescale近期的主打产品,用的是ARM Cortex A8架构,主频在消费电子领域最高可达800MHz,在工业领 ...

  5. ARM MOV PC加8

    缘由 今天在分析ARM伪指令ADR,书上说ADR通常会被一条ADD或SUB指令替代实现相同功能.我反汇编了一下确实如此会基于PC相对偏移的地址量读取到寄存器中,可是计算却发现对不上 如上图所示,ADR ...

  6. 京东阅读(web)体验优化

    京东有电子书可以购买,可以多端阅读.比如PC客户端,移动端,以及本文提到的PC网站端. 先换个镜头,读书要记笔记(电子版本), 方便以后查阅. 镜头换回来,但是,我们为了方便肯定是想复制,下载啊,分享 ...

  7. ubuntu 下emacs 配置

    (set-language-environment 'Chinese-GB) (set-keyboard-coding-system 'utf-8) (set-clipboard-coding-sys ...

  8. Kindle 推送教程:教你用电子邮箱推送电子书(Kindle伴侣)

    Kindle 推送是什么意思?如何通过电子邮件附件推送?或许刚刚接触 Kindle 的朋友对这个概念不是很清楚,其实所谓 Kindle 推送是指亚马逊提供的一个"Kindle 个人文档服务& ...

  9. 【CSS3】CSS3 滤镜实现

    作者:^_^肥仔John      来源:CSS3魔法堂:CSS3滤镜及Canvas.SVG和IE滤镜替代方案详解 IE特有的滤镜常常作为CSS3各种新特性的降级处理补充,而Adobe转向HTML5后 ...

随机推荐

  1. 发现easyui-accordion一个bug,在ie6、ie7不兼容性问题

    当设置全局css文件单元格样式为下面时 td{ word-break: break-all; word-wrap: break-word;} easyui-accordion在ie6.ie7上面会出现 ...

  2. Maven——使用Maven构建多模块项目

    原文:http://www.cnblogs.com/xdp-gacl/p/4242221.html 在平时的Javaweb项目开发中为了便于后期的维护,我们一般会进行分层开发,最常见的就是分为doma ...

  3. 原创: 开题报告中摘要部分快速将一段文字插入到word的表格中

    开题报告的摘要是表格形式,之前需要一个一个字的敲入,十分不方便修改. 所以百度了一下方法.现总结如下: 达到的效果 1 将这段文字复制粘贴到word中,在word文件中的每一个字与字之间插入空格.如何 ...

  4. spring中文乱码问题

    第一:code @RequestMapping(value = "/query/{keyword}", method = RequestMethod.GET, produces = ...

  5. 项目中的五级地址联动效果(js)

    我刚开始是的时候是是写了一个sql语句,但是写了5个函数,来联动地址的.后来请教了前段的师傅,用js来写了一个地址联动的. 我使用的是easyui的框架! 地址联动部分html代码! <tr&g ...

  6. hdu_2089 不要62

    数位动态规划     数位动态规划是求解一个大区间[L, R]中间满足条件Q的所有数字的个数(或者和,或其他)的一种方法.它通过分析每一位上的数字,一般用 dp[len][digit][...] 来表 ...

  7. 如何连接git bash和git hub

    git config --global user.name "Your Real Name" 2 git config --global user.email you@email. ...

  8. samtools常用命令详解(转)

    转自:samtools常用命令详解 samtools的说明文档:http://samtools.sourceforge.net/samtools.shtml samtools是一个用于操作sam和ba ...

  9. sizeof和strlen()的区别

    二者有本质上的区别 从定义可以知道sizeof只是一个operator,而strlen()则是定义一个定义在<string.h>中的函数;所以sizeof(string)是在计算strin ...

  10. 例题:计算运费。c#语言基础,比较简单。看代码输入格式和方法。同样方法可以做一个 出租车打车的程序

    while (true) { Console.WriteLine("请输入行李重量"); double k = Convert.ToDouble(Console .ReadLine ...