Introduction to Linux programming-SVGALIB

Source: Internet
Author: User
For more information about Linux programming and kernel, see SVGALIB. Introduction to Linux programming-SVGALIB

SvgaLib is the VGA driver function library in the Linux Console. Although its quality is still a little low, it supports

There are not many types of screen cards, but many games and programs use it for development.

This is an unofficial standard. If you want to write a program for the graphic function in the Console

SVGALIB is your only choice. Currently, there are many programs using SVGALIB.

SVGALIB has a4c. tty/yact/bcs16.


Here I will only talk about some simple usage methods, such as enabling vga and mouse. To be effective and advanced

The use of skills is much more complicated, such as a4c. tty, another layer of Star Window will be mounted.

Manager to manage a small windows system.



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 );

Void vga_waitretrace (void );

Int vga_init (void );

Int vga_setrgbcolor (int r, int g, int B );








# 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 g1600x0000x16 44

# Define g1600x0000x256 45

# Define G1600x1200x32K 46

# Define g1600x425x64k 47

# Define g1600x0000x16m 48

# Define g1600x425x16m32 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 BITs 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

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
Void * extensions;/* points to copy of eeprom for mach32 */

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

} Vga_modeinfo;
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.