使用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. mysql 求时间段平均值

    考虑下面的需求,在一段时间内,间隔一段时间,取一个平均值,把所有的平均值取出来,怎么办?思路:在存储过程中,拼接sql语句.根据起始时间和结束时间,while循环每次加一段时间.DROP PROCED ...

  2. 数位dp——统计'1'的个数

    今天去牛客网看了看 包含一 这道题,一开始没看清,以为它要统计 1~n 所有数中数字 '1' 出现的总次数,也就是说,若 n == 11,则 ans = 4:而按照题目的原意 ans 应该为 3.看错 ...

  3. iOS开发者帐号流程

    http://ask.dcloud.net.cn/article/152 iOS证书(.p12)和描述文件(.mobileprovision)申请 5+App开发 Apple证书 iOS证书 iOS有 ...

  4. mysql 建立索引场合及索引使用

    索引建立场合: ① where后边字段 适合建立索引 ② order by 排序字段适合建立索引 ③ 索引覆盖 即 所要查询的字段本身就是索引 直接在索引中查询数据. 例如 select name,a ...

  5. 转!!!Mybatis实现数据的增删改查(CRUD)

    什么是 MyBatis? MyBatis 是支持普通 SQL 查询,存储过程和高级映射的优秀持久层框架. MyBatis 消除了几乎所有的 JDBC 代码和参数的手工设置以及对结果集的检索.MyBat ...

  6. SlideSwitch

    //SlideSwitch.java package com.example.hellojni; import android.content.Context; import android.cont ...

  7. 利用php的序列化和反序列化来做简单的数据本地存储

    利用php的序列化和反序列化来做简单的数据本地存储 如下程序可以做为一个工具类 /** * 利用php的序列化和反序列化来做简单的数据本地存储 */ class objectdb { private ...

  8. OneProxy读写分离配置操作手册

    1.确保已配置好主备集群 A)配置 可参考MySQL官方文档(https://dev.mysql.com/doc/refman/5.6/en/replication-howto.html) 或者我的博 ...

  9. ARPG游戏技能系统设计

    ARPG游戏的技能的前端表现, 主要指的是人物动作和特效表现, 从普遍意义上讲,大致可以分为三个阶段:起手.飞行.碰撞(爆炸). [特效可见性判断] 1.[attacker & victim] ...

  10. 8.3 ContosoMVCWeb官方案例学习

    1. 分页案例学习 2. 排序搜索案例学习 3.使用Configuration.cs中的Seed方法 在数据库迁移过程中,使用update-database,会运行seed方法.seed方法能够将初始 ...