Ejemplo n.º 1
0
int GGI_svga_drawhline_nc(struct 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;
}
Ejemplo n.º 2
0
void gfx_vline(int y1, int y2, int x, int color, int flags)
{
    int y;
    
    if (flags & GFX_XOR_PIXEL)
    {
        for (y = y1; y < y2; y++)
        {
            vga_setcolor(color ^ vga_getpixel(x, y));
            vga_drawpixel(x, y);
        }
    }
    else
    {
        vga_setcolor(color);
        for (y = y1; y < y2; y++)
            vga_drawpixel(x, y);
    }
}
Ejemplo n.º 3
0
/*
 * Basic graphics routines.
 */
void gfx_hline(int x1, int x2, int y, int color, int flags)
{
    int x;
    
    if (flags & GFX_XOR_PIXEL)
    {
        for (x = x1; x < x2; x++)
        {
            vga_setcolor(color ^ vga_getpixel(x, y));
            vga_drawpixel(x, y);
        }
    }
    else
    {
        vga_setcolor(color);
        for (x = x1; x < x2; x++)
            vga_drawpixel(x, y);
    }
}
Ejemplo n.º 4
0
void init(void) 
{
   exceptions_init();
   hide_cursor();
   vga_setcolor(0x07);
   pic_init();
   idt_write_table();
   kb_init();         //Init keyboard driver
   floppy_init();
   lex_init();
   printf("\nSystem booted.\n\n");
}
Ejemplo n.º 5
0
void gfx_puttextimage(char *textimage, int base, char * text2color, int xpar, int width, int height, int xdst, int ydst)
{
    int x, y, color;
    int xlate[256];

    for (x = 0; text2color[x]; x++)
        xlate[(int)text2color[x]] = x + base;
    for (y = 0; y < height; y++)
        for (x = 0; x < width; x++)
        {
            color = xlate[(int)*textimage++];
            if (color != xpar)
            {
                vga_setcolor(color);
                vga_drawpixel(x, y);
            }
        }
}
Ejemplo n.º 6
0
void gfx_putimage(unsigned char *image, int xpar, int xsrc, int ysrc, int width, int height, int pitch, int xdst, int ydst)
{
    int x, y;

    image += ysrc * pitch + xsrc;
    for (y = 0; y < height; y++)
    {
        if (xpar >= 0)
        {
            for (x = 0; x < width; x++)
                if (image[x] != xpar)
                {
                    vga_setcolor(image[x]);
                    vga_drawpixel(x, y);
                }
        }
        else
            vga_drawscansegment(image, xdst, ydst + y, width);
        image += pitch;
    }
}
Ejemplo n.º 7
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); 

}
Ejemplo n.º 8
0
void PutPixel(unsigned int x, unsigned int y, unsigned char color) {
  vga_setcolor(color);
  vga_drawpixel(x, y);
}
Ejemplo n.º 9
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();

}
Ejemplo n.º 10
0
int vga_clear(void)
{
    vga_screenoff();
#ifdef BACKGROUND
    __svgalib_dont_switch_vt_yet();
#endif
    if (MODEX)
	goto modeX;
    switch (CM) {
    case G320x200x256:
    case G320x240x256:
    case G320x400x256:
    case G360x480x256:
      modeX:
#ifdef BACKGROUND
        if (vga_oktowrite())
	    {
#endif
        
	/* write to all planes */
	port_out(0x02, SEQ_I);
	port_out(0x0F, SEQ_D);

	/* clear video memory */
	memset(GM, 0, 65536);
#ifdef BACKGROUND
	    }
	  else
	    {
	     int i;
	     
	     for (i = 0; i < 4; i++) {
	        /* save plane i */
	        __svgalib_fast_setpage(i);
	        memset(GM, 0, GRAPH_SIZE);
               }
	    }
#endif
	break;

    default:
	switch (CI.colors) {
	case 2:
	case 16:
	    vga_setcolor(0);

#ifdef BACKGROUND
        if (vga_oktowrite())
	    {
#endif
	    /* write to all bits */
	    port_out(0x08, GRA_I);
	    port_out(0xFF, GRA_D);
#ifdef BACKGROUND
	    }
#endif

	default:
	    {
		int i;
		int pages = (CI.ydim * CI.xbytes + 65535) >> 16;
#if defined(CONFIG_ALPHA_JENSEN)
		int j;
#endif
#ifdef BACKGROUND
                if (!vga_oktowrite())
	              {
		       switch (CI.colors) {
	                case 2:
	                case 16:
			pages*=4;
                       }
		      }
#endif

		for (i = 0; i < pages; ++i) {
		    vga_setpage(i);

#if defined(CONFIG_ALPHA_JENSEN)
		    for (j = 0; j < 65536; j += 2)
			gr_writew(0, j);
#else
		    /* clear video memory */
		    memset(GM, 0, 65536);
#endif
		}
	    }
	    break;
	}
	break;
    }

    vga_setcolor(15);
#ifdef BACKGROUND
    __svgalib_is_vt_switching_needed();
#endif
    vga_screenon();

    return 0;
}