标题: Linux程序设计入门(7) - SVGALIB
无双
荣誉斑竹
Rank: 14Rank: 14Rank: 14Rank: 14
天才猪



UID 4
精华 84
积分 5863
帖子 11390
活跃指数 0
LU金币 4248 个
LU金条 0 个
阅读权限 200
注册 2003-9-16
来自 杭州
 
发表于 2003-9-18 16:08  资料  个人空间  主页 短消息  加为好友 
SvgaLib是Linux Console下的VGA驱动函数库。虽然它的品质还是有点低,支援

的萤幕卡种类不算太多,但是有许多的游戏及程序都是用它来做开发,可以算

是非官方的标准了。如果您准备要在Console下撰写图形功能的程序,目前来说

SVGALIB是您唯一的选择。目前使用SVGALIB的程序有许多,中文终端机使用

SVGALIB的就有a4c.tty/yact/bcs16。


这里我只讲一些简单的使用方法,如启动vga及mouse的使用。要有效地、高阶

的运用,技巧复杂很多,例如a4c.tty就另外往上架一层Star Window

Manager,来管理一个小型视窗系统。



vga




vgamouse






int vga_setmode(int mode);

int vga_hasmode(int mode);

int vga_setpalette(int index, int red, int green, int blue);

int vga_getpalette(int index, int *red, int *green, int *blue);

int vga_setcolor(int color);

int vga_drawpixel(int x, int y);

int vga_drawline(int x1, int y1, int x2, int y2);

int vga_getpixel(int x, int y);

vga_modeinfo *vga_getmodeinfo(int mode);


unsigned char *graph_mem;

unsigned char *vga_getgraphmem(void);


void vga_setpage(int p);

void vga_setreadpage(int p);

void vga_setreadpage(int p);

void vga_setwritepage(int p);

void vga_setdisplaystart(int a);

void vga_waitretrace(void);

int vga_init(void);

int vga_setrgbcolor(int r, int g, int cool.gif;








#define TEXT 0 /* Compatible with VGAlib v1.2 */

#define G320x200x16 1

#define G640x200x16 2

#define G640x350x16 3

#define G640x480x16 4

#define G320x200x256 5

#define G320x240x256 6

#define G320x400x256 7

#define G360x480x256 8

#define G640x480x2 9


#define G640x480x256 10

#define G800x600x256 11

#define G1024x768x256 12


#define G1280x1024x256 13 /* Additional modes. */


#define G320x200x32K 14

#define G320x200x64K 15

#define G320x200x16M 16

#define G640x480x32K 17

#define G640x480x64K 18

#define G640x480x16M 19

#define G800x600x32K 20

#define G800x600x64K 21

#define G800x600x16M 22

#define G1024x768x32K 23

#define G1024x768x64K 24

#define G1024x768x16M 25

#define G1280x1024x32K 26

#define G1280x1024x64K 27

#define G1280x1024x16M 28


#define G800x600x16 29

#define G1024x768x16 30

#define G1280x1024x16 31


#define G720x348x2 32 /* Hercules emulation mode */


#define G320x200x16M32 33 /* 32-bit per pixel modes. */

#define G640x480x16M32 34

#define G800x600x16M32 35

#define G1024x768x16M32 36

#define G1280x1024x16M32 37


/* additional resolutions */

#define G1152x864x16 38

#define G1152x864x256 39

#define G1152x864x32K 40

#define G1152x864x64K 41

#define G1152x864x16M 42

#define G1152x864x16M32 43


#define G1600x1200x16 44

#define G1600x1200x256 45

#define G1600x1200x32K 46

#define G1600x1200x64K 47

#define G1600x1200x16M 48

#define G1600x1200x16M32 49


typedef struct {

int width;

int height;

int bytesperpixel;

int colors;

int linewidth; /* scanline width in bytes */

int maxlogicalwidth; /* maximum logical scanline width */

int startaddressrange; /* changeable bits set */

int maxpixels; /* video memory / bytesperpixel */

int haveblit; /* mask of blit functions available */

int flags; /* other flags */



/* Extended fields: */



int chiptype; /* Chiptype detected */

int memory; /* videomemory in KB */

int linewidth_unit; /* Use only a multiple of this as

parameter for set_displaystart */

char *linear_aperture; /* points to mmap secondary mem aperture

of car

int aperture_size; /* size of aperture in KB if

size>=videomemory.

void (*set_aperture_page) (int page);

/* if aperture_size<videomemory select a memory page */

void *extensions; /* points to copy of eeprom for mach32 */

/* depends from actual driver/chiptype.. etc. */

} vga_modeinfo;




OK STATION, Webmaster, Brian Lin





不要问我结果 我只研究过程与思路
无双客栈
顶部
流氓无产者
LU天使
Rank: 4



UID 46
精华 1
积分 976
帖子 1947
活跃指数 0
LU金币 2012 个
LU金条 0 个
阅读权限 80
注册 2003-9-18
 
发表于 2003-9-23 09:02  资料  个人空间  短消息  加为好友 
无双发水贴
这种文章不看也罢 laugh.gif





没得玩了
顶部
无双
荣誉斑竹
Rank: 14Rank: 14Rank: 14Rank: 14
天才猪



UID 4
精华 84
积分 5863
帖子 11390
活跃指数 0
LU金币 4248 个
LU金条 0 个
阅读权限 200
注册 2003-9-16
来自 杭州
 
发表于 2003-9-23 12:20  资料  个人空间  主页 短消息  加为好友 
那是你看不懂smile.gif





不要问我结果 我只研究过程与思路
无双客栈
顶部
流氓无产者
LU天使
Rank: 4



UID 46
精华 1
积分 976
帖子 1947
活跃指数 0
LU金币 2012 个
LU金条 0 个
阅读权限 80
注册 2003-9-18
 
发表于 2003-9-23 12:56  资料  个人空间  短消息  加为好友 
给个快点的例子先,懒得研究函数 tongue.gif





没得玩了
顶部
无双
荣誉斑竹
Rank: 14Rank: 14Rank: 14Rank: 14
天才猪



UID 4
精华 84
积分 5863
帖子 11390
活跃指数 0
LU金币 4248 个
LU金条 0 个
阅读权限 200
注册 2003-9-16
来自 杭州
 
发表于 2003-9-23 13:07  资料  个人空间  主页 短消息  加为好友 
那还不容易

initscr
show

close

ncurses自己带的就有例子
在usr/share/doc/ncurses-devel目录下





不要问我结果 我只研究过程与思路
无双客栈
顶部
无双
荣誉斑竹
Rank: 14Rank: 14Rank: 14Rank: 14
天才猪



UID 4
精华 84
积分 5863
帖子 11390
活跃指数 0
LU金币 4248 个
LU金条 0 个
阅读权限 200
注册 2003-9-16
来自 杭州
 
发表于 2003-9-23 13:08  资料  个人空间  主页 短消息  加为好友 
写错了

不是ncurses-devel

SVGALIB好像要停止开发了
以后使用framebuffer

所以还是学习那个吧流邙DD





不要问我结果 我只研究过程与思路
无双客栈
顶部
[广告] 记录自己的思想火花,留住每日的技术积累,尽在拥有属于自己独立域名的博客。
 



当前时区 GMT+8, 现在时间是 2008-12-4 13:50
乐悠LoveUnix论坛-京ICP备05005823号

Thanks to Discuz!  © 2001-2007    Power by LoveUnix.net
Processed in 0.054112 second(s), 6 queries , Gzip enabled

清除 Cookies - 联系我们 - 乐悠LoveUnix - Archiver