Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101816
  • 博文数量: 20
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 240
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-21 11:18
文章分类

全部博文(20)

文章存档

2011年(1)

2009年(3)

2008年(16)

我的朋友

分类: LINUX

2008-04-11 16:42:41

Linux平台的SVGACC主要移植了DOSSVGACC上的常用绘图函数,并去掉了DOS版的显卡、显存、处理器类型的检测,因为linux平台上的SVGACC是建立在FrameBuffer上,屏蔽了直接与硬件的操作。

 

移植后的SVGACC.H文件如下:(各提供的函数功能与DOSSVGACC功能一致)

#ifndef SVGACC_H

#define SVGACC_H

 

typedef unsigned char byte;

 

typedef struct {

    byte r;

    byte g;

    byte b;

} SRGB;

 

typedef SRGB PaletteData[256];

 

typedef struct {

    byte width;

    byte height;

    byte data[4096];

} Font;

 

typedef enum {

    NO_ACTION = 0,

    SET,

    XOR,

    OR ,

    AND

} PixelMode;

 

typedef struct {

    unsigned short width;

    unsigned short height;

    byte data[1];

} RasterBlock;

 

typedef struct {

    short x;

    short y;

} D2Point;

 

enum COLORS {

    BLACK,          /* dark colors */

    BLUE,

    GREEN,

    CYAN,

    RED,

    MAGENTA,

    BROWN,

    LIGHTGRAY,

    DARKGRAY,       /* light colors */

    LIGHTBLUE,

    LIGHTGREEN,

    LIGHTCYAN,

    LIGHTRED,

    LIGHTMAGENTA,

    YELLOW,

    WHITE

};

 

#ifdef __cplusplus

extern "C" {

#endif

 

/* 'BLocK' methods to manipulate RasterBlocks on and off the screen */

 

extern void blkput (PixelMode mode, short x, short y, RasterBlock *gfxblk);

 

/* 'DRaW' methods for placing text and graphics primitives on screen */

 

extern void drwbox (PixelMode mode, short colr, short x1, short y1, short x2, short y2);

extern void drwcircle (PixelMode mode, short colr, short centerx, short centery, short radius);

extern void drwfillbox (PixelMode mode, short colr, short x1, short y1, short x2, short y2);

extern void drwfillcircle (PixelMode mode, short colr, short centerx, short centery, short radius);

extern void drwline (PixelMode mode, short colr, short x1, short y1, short x2, short y2);

extern void drwpoint (PixelMode mode, short colr, short x, short y);

extern void drwstring (PixelMode mode, short fcolr, short bcolr, const char *strng, short x, short y);

extern void drwstringlt (PixelMode mode, short fcolr, short bcolr, const char *strng, short x, short y);

 

/* 'FILL' methods for filling various regions on screen with a color */

 

extern void fillpoly(short colr, short points, D2Point *inary);

extern void fillscreen (short colr);

extern void fillview (short colr);

 

/* 'FONT' methods for setting the current font */

 

extern void fontset (Font *font);

 

/* 'PAGE' methods to control paging abilities */

 

extern short pageactive (short page);

extern short pagedisplay (short x, short y, short page);

 

/* 'PALette' methods to manipulate and activate palettes */

 

extern void  paldimstep (SRGB *pal, short firstcolr, short lastcolr, short percent);

extern void  palget (SRGB *pal, short firstcolr, short lastcolr);

 

/* 'PCX' methods to read / write PCX files and place images on screen */

 

//extern short  pcxmake (short x1, short y1, short x2, short y2, const char far *name);

extern short  pcxput (PixelMode mode, short xloc, short yloc, const char *name);

 

//extern short  far res320 (void);

extern short  res640 (void);

/*extern short  far res640l (void);

extern short  far res800 (void);

extern short  far res1024 (void);

extern short  far res1280 (void);*/

 

/* 'SET' methods to adjust library internal variables */

 

extern void setview (short x1, short y1, short x2, short y2);

 

/* 'VIDEO' methods to interact with video mode and display */

 

extern short  videomodeget (void);

extern void   videomodeset (short videomode);

 

/* 'XMS' methods to store and retrieve extended memory */

 

extern short  xmsblkget (short x1, short y1, short x2, short y2);

extern short  xmsblkput (PixelMode mode, short x, short y, short xmshandle);

extern short  xmsfree (short xmshandle);

 

#ifdef __cplusplus

}

#endif

 

#endif

/* SVGACC_H */

 

 

附件:

linux版SVGACC类库:

文件: svgacc.rar
大小: 14KB
下载: 下载

(在X86上, 采用FrameBuffer显示器驱动方式)类库测试函数:

文件: svgaccTest.rar
大小: 39KB
下载: 下载

 

阅读(1477) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~