void x_rect(int xz, int yz, int xk, int yk)
{
 // draw empty rectangle
#ifndef TXTDEBUG
#ifdef GGI
 ggiDrawLine(ggiVis,xz,yz,xk,yz);
 ggiDrawLine(ggiVis,xk,yz,xk,yk);
 ggiDrawLine(ggiVis,xz,yk,xk,yk);
 ggiDrawLine(ggiVis,xz,yz,xz,yk);
#else
 vga_drawline(xz,yz,xk,yz);
 vga_drawline(xk,yz,xk,yk);
 vga_drawline(xz,yk,xk,yk);
 vga_drawline(xz,yz,xz,yk);
#endif
#endif
}
Beispiel #2
0
int GGI_svga_drawhline_nc(ggi_visual *vis, int x, int y, int w)
{
	vga_setcolor(LIBGGI_GC_FGCOLOR(vis));
	y += vis->w_frame_num * LIBGGI_VIRTY(vis);
	vga_drawline(x,y,x+w-1,y);

	return 0;
}
Beispiel #3
0
static void
SVGA_drawvline(PSD psd,COORD x, COORD y1, COORD y2, PIXELVAL c)
{
	if(gr_mode == MODE_SET) {
		vga_setegacolor(c);
		vga_drawline(x, y1, x, y2);
	}

	/* slower version required for XOR drawing support*/
	while(y1 <= y2)
		SVGA_drawpixel(psd, x, y1++, c);
}
void x_line(int x1, int y1, int x2, int y2 )
{
// draw line
#ifndef TXTDEBUG
#ifdef	GGI
 ggiSetGCForeground (ggiVis, ggi_getcolor (xg_color));
 ggiDrawLine (ggiVis, x1, y1, x2, y2);
#else
 vga_drawline(x1,y1,x2,y2);
#endif
#endif
}
Beispiel #5
0
	int main(int argc, char *argv[])
	{
		
		int i;
		int oldmode;
		int mode = G320x200x256;
		int width, height, colors;

		//获得当前的模式
		oldmode = vga_getcurrentmode();

		//初始化
		vga_init();

		//判断是否支持该模式
		if(vga_hasmode(mode)) 
			vga_setmode(mode);
		else {
			printf("No such mode\n");
			exit(1);
		}
		//取得信息
		width = vga_getxdim();
		height = vga_getydim();
		colors = vga_getcolors();

		//绘图
		for(i=0; i<colors; i++){
			vga_setcolor(i);
			vga_drawline(0, i, width-1, i);
		}
			

		vga_setcolor(3);
		for(i=0; i<50; i++) vga_drawpixel(i*4, 20);

		vga_setcolor(4);
		vga_drawline(100, 100, 300, 200);

		vga_setcolor(5);
		vga_drawline(0, 0, width-1, 0);
		vga_drawline(0, height-1, width-1, height-1);
		vga_drawline(0, 0, 0, height-1);
		vga_drawline(width-1, 0, width-1, height-1);

		//等待按键
		while(!vga_getkey());

		//恢复原来的模式 
		vga_setmode(oldmode);

		return 0;
	}
Beispiel #6
0
/* before call this function, must lock the console */
void
refresh_input_method_area (void)
{
  char str[25];

  int tTopY;
  int tLeftX;
  int ii, jj;

  tTopY = 458;
  tLeftX = 540;

  NEWRootEmpty ();
//NEWDispRootArea();
  input_clear_line (2, INPUT_BGCOLOR);
  gInputCount = 0;
  ClrSelArea ();
  gSelectingMode_flag = 0;


  input_clear_area (INPUT_BGCOLOR);

  if (use_fb) {
    fb_setfgcolor (15);
    fb_drawline (0, INPUT_AREAY - 7, 639, INPUT_AREAY - 7);
    fb_drawline (0, INPUT_AREAY - 4, 639, INPUT_AREAY - 4);
    for (ii = 0; ii < 100; ii++)
      fb_setfgcolor (12);
  } else {

  #ifdef VGALIB
    gl_hline(0, INPUT_AREAY - 7, WIDTH-1, GRAY);
    gl_hline(0, INPUT_AREAY - 4, WIDTH-1, GRAY);
  #endif

#ifdef VGA__
    vga_setcolor (15);
    vga_drawline (0, INPUT_AREAY - 7, 639, INPUT_AREAY - 7);
    vga_drawline (0, INPUT_AREAY - 4, 639, INPUT_AREAY - 4);
    for (ii = 0; ii < 100; ii++)
      vga_setcolor (12);
#endif
  }


  if (!IsHanziInput) {
    if (gEncode == BIG5) {
      input_print_string (POS_OF_VERSIONSTRING, 0, VERSION_STRING,
			  INPUT_FGCOLOR, INPUT_BGCOLOR);
      input_print_string (POS_OF_INPUTNAME, 0, "【英數】", INPUT_FGCOLOR,
			  INPUT_BGCOLOR);
    }
    if (gEncode == GB) {
      input_print_string (POS_OF_VERSIONSTRING, 0,
			  string_BIG5toGB (VERSION_STRING), INPUT_FGCOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_INPUTNAME, 0, string_BIG5toGB ("【英數】"),
			  INPUT_FGCOLOR, INPUT_BGCOLOR);
    }
  } else {

    if ((gsCurrent_input_table->IsExtInpMethod) == 1) {
      if (gEncode == BIG5) {
	input_print_string (POS_OF_INPUTNAME, 0,
			    gsInput_table_array[gsCurrent_method]->cname,
			    INPUT_FGCOLOR, INPUT_BGCOLOR);
      }
      if (gEncode == GB) {
	input_print_string (POS_OF_INPUTNAME, 0,
			    gsInput_table_array[gsCurrent_method]->cname,
			    INPUT_FGCOLOR, INPUT_BGCOLOR);
      }
    } else {
      fprintf (stderr, "%c", 0x7);
      if (gEncode == BIG5) {
        #ifdef NEW_CHEWING
        if (gsCurrent_method == 7) 
	  input_print_string (POS_OF_INPUTNAME, 0, "酷音", INPUT_FGCOLOR, INPUT_BGCOLOR);
        #else
	input_print_string (POS_OF_INPUTNAME, 0, "!無輸入法!", INPUT_FGCOLOR,
			    INPUT_BGCOLOR);
        #endif
      }
      if (gEncode == GB) {
	input_print_string (POS_OF_INPUTNAME, 0,
			    string_BIG5toGB ("!無輸入法!"), INPUT_FGCOLOR,
			    INPUT_BGCOLOR);
      }
    }
  }


  if (gsCurrent_input_table) {
    if (gsCurrent_input_table->CaseTransPolicy == 0) {
      input_print_string (POS_OF_CASEHINT, 0, "A", HINT_CASEHICOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 1, 0, " ", INPUT_FGCOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 2, 0, "a", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
    }
    if (gsCurrent_input_table->CaseTransPolicy == 1) {
      input_print_string (POS_OF_CASEHINT, 0, "a", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 1, 0, "=", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 2, 0, "A", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
    }
    if (gsCurrent_input_table->CaseTransPolicy == 2) {
      input_print_string (POS_OF_CASEHINT, 0, "A", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 1, 0, "=", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
      input_print_string (POS_OF_CASEHINT + 2, 0, "a", HINT_CASECOLOR,
			  INPUT_BGCOLOR);
    }
  }


  if (gEncode == BIG5) {
    input_print_string (POS_OF_FULLHALF, 0, half_full_strBIG5[IsFullChar],
			INPUT_FGCOLOR, INPUT_BGCOLOR);
    input_print_string (POS_OF_HISTORYMODE, 0,
			history_normal_strBIG5[console_mode], INPUT_FGCOLOR,
			INPUT_BGCOLOR);
    sprintf (str, "【視窗%1d】", hztty_list->index);
  }
  if (gEncode == GB) {
    input_print_string (POS_OF_FULLHALF, 0, half_full_strGB[IsFullChar],
			INPUT_FGCOLOR, INPUT_BGCOLOR);
    input_print_string (POS_OF_HISTORYMODE, 0,
			history_normal_strGB[console_mode], INPUT_FGCOLOR,
			INPUT_BGCOLOR);
    sprintf (str, "▽敦諳%1d▼", hztty_list->index);
  }
  input_print_string (POS_OF_WINDOWNO, 0, str, INPUT_FGCOLOR, INPUT_BGCOLOR);
  if (IsHanziInput > 0 && gsCurrent_method == 7)
#ifdef CHEWING
    ChewReDrawText ();		/* Chewing */
#else
    ;
#endif
  input_print_string (76, 1, encode_name, RED, INPUT_BGCOLOR); 

}
Beispiel #7
0
static void testmode(int mode)
{
    int xmax, ymax, i, x, y, yw, ys, c;
    vga_modeinfo *modeinfo;

    vga_setmode(mode);

    modeinfo = vga_getmodeinfo(mode);

    printf("Width: %d  Height: %d  Colors: %d\n",
           modeinfo->width,
           modeinfo->height,
           modeinfo->colors);
    printf("DisplayStartRange: %xh  Maxpixels: %d  Blit: %s\n",
           modeinfo->startaddressrange,
           modeinfo->maxpixels,
           modeinfo->haveblit ? "YES" : "NO");

#ifdef TEST_MODEX
    if (modeinfo->colors == 256)
        printf("Switching to ModeX ... %s\n",
               (vga_setmodeX()? "done" : "failed"));
#endif

    vga_screenoff();

    xmax = vga_getxdim() - 1;
    ymax = vga_getydim() - 1;

    vga_setcolor(vga_white());
    vga_drawline(0, 0, xmax, 0);
    vga_drawline(xmax, 0, xmax, ymax);
    vga_drawline(xmax, ymax, 0, ymax);
    vga_drawline(0, ymax, 0, 0);

    /* Draw crosses */
    for (i = 0; i <= 15; i++) {
        vga_setegacolor(i);
        vga_drawline(10 + i * 5, 10, 89 + i * 5, 89);
    }
    for (i = 0; i <= 15; i++) {
        vga_setegacolor(i);
        vga_drawline(89 + i * 5, 10, 10 + i * 5, 89);
    }

    vga_screenon();

    ys = 100;
    yw = (ymax - 100) / 4;
    switch (vga_getcolors()) {
    case 256:
        /* Draw horizontal color bands using palette */
        for (i = 0; i < 60; ++i) {
            c = (i * 64) / 60;
            vga_setpalette(i + 16, c, c, c);
            vga_setpalette(i + 16 + 60, c, 0, 0);
            vga_setpalette(i + 16 + (2 * 60), 0, c, 0);
            vga_setpalette(i + 16 + (3 * 60), 0, 0, c);
        }
        line[0] = line[xmax] = 15;
        line[1] = line[xmax - 1] = 0;
        for (x = 2; x < xmax - 1; ++x)
            line[x] = (((x - 2) * 60) / (xmax - 3)) + 16;
        for (y = ys; y < ys + yw; ++y)	/* gray */
            vga_drawscanline(y, line);
        for (x = 2; x < xmax - 1; ++x)
            line[x] += 60;
        ys += yw;
        for (y = ys; y < ys + yw; ++y)	/* red */
            vga_drawscanline(y, line);
        for (x = 2; x < xmax - 1; ++x)
            line[x] += 60;
        ys += yw;
        for (y = ys; y < ys + yw; ++y)	/* green */
            vga_drawscanline(y, line);
        for (x = 2; x < xmax - 1; ++x)
            line[x] += 60;
        ys += yw;
        for (y = ys; y < ys + yw; ++y)	/* blue */
            vga_drawscanline(y, line);
        break;

    case 1 << 15:
    case 1 << 16:
    case 1 << 24:
        /* Draw horizontal color bands in RGB */
        for (x = 2; x < xmax - 1; ++x) {
            c = ((x - 2) * 255) / (xmax - 4);
            y = ys;
            vga_setrgbcolor(c, c, c);
            vga_drawline(x, y, x, y + yw - 1);
            y += yw;
            vga_setrgbcolor(c, 0, 0);
            vga_drawline(x, y, x, y + yw - 1);
            y += yw;
            vga_setrgbcolor(0, c, 0);
            vga_drawline(x, y, x, y + yw - 1);
            y += yw;
            vga_setrgbcolor(0, 0, c);
            vga_drawline(x, y, x, y + yw - 1);
        }
        drawSquares(xmax, ymax);
        break;
    default:
        /* Draw vertical color bars */
        if (vga_getcolors() == 16) {
            for (i = 0; i < xmax - 1; i++)
                line[i] = (i + 2) % 16;
            line[0] = line[xmax] = 15;
            line[1] = line[xmax - 1] = 0;
        }
        if (vga_getcolors() == 2) {
            for (i = 0; i <= xmax; i++)
                line[i] = 0x11;
            line[0] = 0x91;
        }
        for (i = 100; i < ymax - 1; i++)
            vga_drawscanline(i, line);
        break;

    }

    if (getchar() == 'd')
        vga_dumpregs();

}