使用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. Python学习(6)循环语句

    目录 Python循环语句 - while循环语句 -- 无线循环 -- 循环使用else语句 -- 简单语句组 - for循环语句 -- 通过序列索引迭代 -- 循环使用else语句 - 循环嵌套 ...

  2. maven的仓库、生命周期与插件

    一.仓库 统一存储所有Maven项目共享的构建的位置就是仓库. 仓库分为本地仓库和远程仓库.远程仓库又分为中央仓库(中央仓库是Maven核心自带的远程仓库),伺服(另一种特殊的远程仓库,为节省宽带和时 ...

  3. JavaWeb学习总结(十四)--Apache的DBUtils

    一.commons-dbutils简介 commons-dbutils 是 Apache 组织提供的一个开源 JDBC工具类库,它是对JDBC的简单封装,学习成本极低,并且使用dbutils能极大简化 ...

  4. supervisord

    [简介] supervisord的官网:http://supervisord.org.看懂英文的可以不用看我的博客,直接看文档就行了,文档写得非常好.点个赞!! Supervisor是一个客户/服务器 ...

  5. 淘宝封装的一款ui 非常不错

    好用的淘宝ui http://m.sui.taobao.org/demos/  手机端访问地址

  6. javascript js中的typeof使用

    typeof运算符介 绍:typeof 是一个一元运算,放在一个运算数之前,运算数可以是任意类型.它返回值是一个字符串,该字符串说明运算数的类型. 你 知道下面typeof运算的结果吗? typeof ...

  7. redhat 6.4 yum 本地配置简记

    准备工作 ----------------------------------------------------------------------------- 1. 加载光驱  将iso镜像文件 ...

  8. Yum常用命令及Yum中文手册

    转自:http://blog.csdn.net/huangbiao86/article/details/6646471 Yum配置文件位于/etc/yum.conf和/etc/yum.repos.d/ ...

  9. features recreate的含义

    就是从数据库里导出这个features的代码块.

  10. js解码

    如代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...