Exemple #1
0
/* Basic unantialiased Bresenham line algorithm */
static void bresenham_line(Uint32 x1, Uint32 y1, Uint32 x2, Uint32 y2,
	       Uint32 color)
{
  int lg_delta, sh_delta, cycle, lg_step, sh_step;

  lg_delta = x2 - x1;
  sh_delta = y2 - y1;
  lg_step = SGN(lg_delta);
  lg_delta = ABS(lg_delta);
  sh_step = SGN(sh_delta);
  sh_delta = ABS(sh_delta);
  if (sh_delta < lg_delta) {
    cycle = lg_delta >> 1;
    while (x1 != x2) {
      Draw_pixel(x1, y1, color);
      cycle += sh_delta;
      if (cycle > lg_delta) {
    cycle -= lg_delta;
    y1 += sh_step;
      }
      x1 += lg_step;
    }
    Draw_pixel(x1, y1, color);
  }
Exemple #2
0
static void send_glyph_byte(uint8_t bajt, uint8_t width) {
	uint8_t i;
	for(i=0; i<width; i++ ) {


		if(bajt&0x80) Draw_pixel();
		else Draw_bk_pixel();





		bajt<<=1;
	}
}