亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? simple_graphics.c

?? VGA核的verilog實現
?? C
?? 第 1 頁 / 共 3 頁
字號:
      *(line + i) = (unsigned char)color;
      *(line + i + 1) = (unsigned char)(color >> 8);
    }
  }
  else if(frame_buffer->color_depth == 24)
  { 
    for (i = 0; i < bytes_per_line; i+=3) 
    {
      *(line + i) = (unsigned char)color;
      *(line + i + 1) = (unsigned char)(color >> 8);
      *(line + i + 2) = (unsigned char)(color >> 16);
    }
  }
  else if(frame_buffer->color_depth == 32)
  { 
    for (i = 0; i < bytes_per_line; i+=4) 
    {
      // Does the right hand side of this assignment determine the size?
      *(int*)(line + i) = (unsigned int)color;
    }
  }
  
  /* Initial Address */
  addr = (int)(frame_buffer->frame1) + ((Vstart * (frame_buffer->width * bytes_per_pixel)) + (Hstart * bytes_per_pixel));
  
  for (i = Vstart; i < Vend; i++)
  {
    memcpy( (void*)addr, line, bytes_per_line );
    addr += (frame_buffer->width * bytes_per_pixel);
  }
  free (line);
}


/******************************************************************
*  Function: vid_draw_horiz_line
*
*  Purpose: Draws a horizontal line on the screen quickly.
*           Good for filling stuff.
*
******************************************************************/
void vid_draw_horiz_line (short Hstart, short Hend, int V, int color, display_frame_buffer_struct* frame_buffer)
{

  int i;
  int addr;
  int bytes_per_line;

  char *fast_buffer = malloc(1024 * 3);

  if( Hstart > Hend )
  {
    short temp = Hstart;
    Hstart = Hend;
    Hend = temp;
  }
  
  if(frame_buffer->color_depth == 32)
  { 
    addr = (int)(frame_buffer->frame1) + ((V * (frame_buffer->width * 4)) + (Hstart * 4));
    bytes_per_line = ((Hend - Hstart) * 4);
    for (i = 0; i < bytes_per_line; i+=4) 
    {
      // Does the right hand side of this assignment determine the size?
      *(int*)(fast_buffer + i) = (unsigned int)color;
    }
    memcpy( (void*)addr, fast_buffer, bytes_per_line );
  }
  if(frame_buffer->color_depth == 24)
  { 
    addr = (int)(frame_buffer->frame1) + ((V * (frame_buffer->width * 3)) + (Hstart * 3));
    bytes_per_line = ((Hend - Hstart) * 3);
    for (i = 0; i < bytes_per_line; i+=3) 
    {
      *(fast_buffer + i) = (unsigned char)color;
      *(fast_buffer + i + 1) = (unsigned char)(color >> 8);
      *(fast_buffer + i + 2) = (unsigned char)(color >> 16);
    }
    memcpy( (void*)addr, fast_buffer, bytes_per_line );
  }
  else if(frame_buffer->color_depth == 16)
  {
    addr = (int)(frame_buffer->frame1) + ((V * (frame_buffer->width * 2)) + (Hstart * 2));
    bytes_per_line = ((Hend - Hstart) * 2);
    for (i = 0; i < bytes_per_line; i+=2) 
    {
      *(fast_buffer + i) = (unsigned char)color;
      *(fast_buffer + i + 1) = (unsigned char)(color >> 8);
    }
    memcpy( (void*)addr, fast_buffer, bytes_per_line );
  }
  free(fast_buffer);
}



/******************************************************************
*  Function: vid_merge_colors
*
*  Purpose: Takes 5-bit color values for each red, green, and blue
*           and merges them into one 16-bit color value.
*
******************************************************************/
int vid_merge_colors(int red, int green, int blue)
{
  // Green actually has 6-bits, but we'll make it's LSB 1 to be consistent.
  return ((blue) | (((green << 1) | 0x1) << 5) | (red << 11));
}

/******************************************************************
*  Function: vid_color_convert24_16
*
*  Purpose: Takes a pointer to a 24-bit (3-byte) 24-bit RGB color 
*           sample and converts it to 16-bits, displayable by the 
*           VGA controller in 16-bit mode
*
******************************************************************/
unsigned short vid_color_convert24_16(char* color24)
{
	unsigned char red, green, blue;
	unsigned short output;
	
	red = *(color24 + 0) & 0xF8;
	green = *(color24 + 1) & 0xFC; // green is actualy 6 bits
	blue = *(color24 + 2) & 0xF8;

	output = ((blue >> 3) | (green << 3) | (red << 8));  
	return output;
}


/******************************************************************
*  Function: vid_color_convert24_16
*
*  Purpose: Takes a pointer to a 24-bit (3-byte) 24-bit RGB color 
*           sample and converts it to 16-bits, displayable by the 
*           VGA controller in 16-bit mode
*
******************************************************************/
int vid_color_convert16_24(unsigned short color16, char* color24)
{
	*(color24 + 0) = color16 >> 11;
	*(color24 + 1) = ((color16 & 0x3E) >> 5);
	*(color24 + 2) = (color16 & 0x1F);
	
	return (0);
}

/******************************************************************
*  Function: vid_copy_line_to_frame_buffer
*
*  Purpose: Copies a scanline from memory to the frame buffer at
*           the specified coordinates.  Converts color depth if
*           necessary.
*
******************************************************************/
int vid_copy_line_to_frame_buffer( int x, int y, char* buffer, int num_pixels, int source_color_depth, display_frame_buffer_struct* frame_buffer )
{
  unsigned short* temp_line;
  int index_24 = 0;
  int index_16 = 0;
  unsigned int dest_addr;
  unsigned int bytes_in_line;
  
  dest_addr = (int)(frame_buffer->frame1) + 
    ((y * (frame_buffer->width * (frame_buffer->bytes_per_pixel))) + 
    (x * (frame_buffer->bytes_per_pixel)));
  
  bytes_in_line = num_pixels * frame_buffer->bytes_per_pixel;
  
  if(source_color_depth == 24)
  {
    if(frame_buffer->color_depth == 16)
    {
      temp_line = malloc(bytes_in_line);
      while(index_24 < bytes_in_line)
      {
        *(temp_line + index_16) = vid_color_convert24_16_m((char*)(buffer + index_24));
        index_16++;
        index_24+=3;
      }
      memcpy( (void*)dest_addr, (void*)temp_line, bytes_in_line );
      free(temp_line);
    }
    else if(frame_buffer->color_depth == 24)
    {
      memcpy( (void*)dest_addr, (void*)buffer, bytes_in_line );
    }
  }
  else if(source_color_depth == 16)
  {
    if(frame_buffer->color_depth == 24)
    {
      temp_line = malloc(bytes_in_line);
      while(index_16 < num_pixels )
      {
        vid_color_convert16_24((short)*(buffer + index_16), (char*)(temp_line + index_24));
        index_16++;
        index_24+=3;
      }
      memcpy( (void*)dest_addr, (void*)temp_line, bytes_in_line );
      free(temp_line);
      
    }
    else if(frame_buffer->color_depth == 16)
    {
      memcpy( (void*)dest_addr, (void*)buffer, bytes_in_line );
    }
  }
  return(0);
}

/******************************************************************
*  Function: vid_draw_sloped_line
*
*  Purpose: Draws a line between two end points using
*           Bresenham's line drawing algorithm.
*           width parameter is not used.  
*           It is reserved for future use.
*
******************************************************************/
void vid_draw_sloped_line( unsigned short horiz_start, 
                           unsigned short vert_start, 
                           unsigned short horiz_end, 
                           unsigned short vert_end, 
                           unsigned short width, 
                           int color, 
                           display_frame_buffer_struct* frame_buffer)
{
  // Find the vertical and horizontal distance between the two points
  int horiz_delta = abs(horiz_end-horiz_start);
  int vert_delta = abs(vert_end-vert_start);

  // Find out what direction we are going
  int horiz_incr, vert_incr;
  if (horiz_start > horiz_end) { horiz_incr=-1; } else { horiz_incr=1; }
  if (vert_start > vert_end) { vert_incr=-1; } else { vert_incr=1; }

  // Find out which axis is always incremented when drawing the line
  // If it's the horizontal axis
  if (horiz_delta >= vert_delta) {
    int dPr   = vert_delta<<1;
    int dPru  = dPr - (horiz_delta<<1);
    int P     = dPr - horiz_delta;

    // Process the line, one horizontal point at at time
    for (; horiz_delta >= 0; horiz_delta--) {
      // plot the pixel
      vid_set_pixel(horiz_start, vert_start, color, frame_buffer);
      // If we're moving both up and right
      if (P > 0) {
        horiz_start+=horiz_incr;
        vert_start+=vert_incr;
        P+=dPru;
      } else {
        horiz_start+=horiz_incr;
        P+=dPr;
      }
    }
  // If it's the vertical axis
  } else {
    int dPr   = horiz_delta<<1;
    int dPru  = dPr - (vert_delta<<1);
    int P     = dPr - vert_delta;

    // Process the line, one vertical point at at time
    for (; vert_delta>=0; vert_delta--) {
      // plot the pixel
      vid_set_pixel(horiz_start, vert_start, color, frame_buffer);
      // If we're moving both up and right
      if (P > 0) {
        horiz_start+=horiz_incr;
        vert_start+=vert_incr;
        P+=dPru;
      } else {
        vert_start+=vert_incr;
        P+=dPr;
      }
    }
  }
}



/******************************************************************
*  Function: vid_draw_circle
*
*  Purpose: Draws a circle on the screen with the specified center
*  and radius.  Draws symetric circles only.  The fill parameter
*  tells the function whether or not to fill in the box.  1 = fill,
*  0 = do not fill.
*
******************************************************************/
int vid_draw_circle(int Hcenter, int Vcenter, int radius, int color, char fill, display_frame_buffer_struct* frame_buffer)
{
  int x = 0;
  int y = radius;
  int p = (5 - radius*4)/4;

  // Start the circle with the top, bottom, left, and right pixels.
  vid_circle_points(Hcenter, Vcenter, x, y, color, fill, frame_buffer);

  // Now start moving out from those points until the lines meet
  while (x < y) {
    x++;
    if (p < 0) {
      p += 2*x+1;
    } else {
      y--;
      p += 2*(x-y)+1;
    }
    vid_circle_points(Hcenter, Vcenter, x, y, color, fill, frame_buffer);
  }
  return (0);
}

/******************************************************************
*  Function: vid_circle_points
*
*  Purpose: Called by vid_draw_circle() to plot the actual points
*  of the circle.  Draws horizontal lines to fill.
*
******************************************************************/

void vid_circle_points(int cx, int cy, int x, int y, int color, char fill, display_frame_buffer_struct* frame_buffer)
{

    // If we're directly above, below, left and right of center (0 degrees), plot those 4 pixels
    if (x == 0) {
        vid_set_pixel(cx, cy + y, color, frame_buffer);
        vid_set_pixel(cx, cy - y, color, frame_buffer);
        if(fill) {
          vid_draw_line(cx - y, cy, cx + y, cy, 1, color, frame_buffer);
          
        } else {
          vid_set_pixel(cx + y, cy, color, frame_buffer);
          vid_set_pixel(cx - y, cy, color, frame_buffer);
        }

    } else
    // If we've reached the 45 degree points (x=y), plot those 4 pixels
    if (x == y) {
      if(fill) {
        vid_draw_line(cx - x, cy + y, cx + x, cy + y, 1, color, frame_buffer);
        vid_draw_line(cx - x, cy - y, cx + x, cy - y, 1, color, frame_buffer);
        
      } else {
        vid_set_pixel(cx + x, cy + y, color, frame_buffer);
        vid_set_pixel(cx - x, cy + y, color, frame_buffer);
        vid_set_pixel(cx + x, cy - y, color, frame_buffer);
        vid_set_pixel(cx - x, cy - y, color, frame_buffer);
      }
    } else
    // If we're between 0 and 45 degrees plot 8 pixels.
    if (x < y) {
        if(fill) {
          vid_draw_line(cx - x, cy + y, cx + x, cy + y, 1, color, frame_buffer);
          vid_draw_line(cx - y, cy + x, cx + y, cy + x, 1, color, frame_buffer);
          vid_draw_line(cx - y, cy - x, cx + y, cy - x, 1, color, frame_buffer);
          vid_draw_line(cx - x, cy - y, cx + x, cy - y, 1, color, frame_buffer);
        } else {
          vid_set_pixel(cx + x, cy + y, color, frame_buffer);
          vid_set_pixel(cx - x, cy + y, color, frame_buffer);
          vid_set_pixel(cx + x, cy - y, color, frame_buffer);
          vid_set_pixel(cx - x, cy - y, color, frame_buffer);
          vid_set_pixel(cx + y, cy + x, color, frame_buffer);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一二三区精品福利视频| 欧美色综合天天久久综合精品| 国产精品久久久一区麻豆最新章节| 欧美日韩一二区| 大桥未久av一区二区三区中文| 男女激情视频一区| 日韩高清中文字幕一区| 三级欧美在线一区| 亚洲高清免费观看| 亚洲一区免费在线观看| 亚洲一区二区在线免费看| 一区二区三区中文字幕| 综合激情成人伊人| 一区二区三区四区乱视频| 亚洲天堂成人在线观看| 亚洲老妇xxxxxx| 亚洲成人免费电影| 日一区二区三区| 久久国产精品第一页| 久久成人av少妇免费| 激情综合网av| 不卡av免费在线观看| 色综合久久九月婷婷色综合| 欧美亚一区二区| 欧美一区二区三区色| 日韩欧美成人午夜| 亚洲国产精品黑人久久久| 亚洲色欲色欲www| 亚洲天堂成人在线观看| 亚洲18色成人| 国产专区综合网| 色乱码一区二区三区88| 91精品国产色综合久久ai换脸| 精品久久五月天| 成人欧美一区二区三区小说| 亚洲成年人网站在线观看| 久久99精品网久久| 97成人超碰视| 精品久久久久久久久久久久久久久久久 | 亚洲国产裸拍裸体视频在线观看乱了| 亚洲黄色小视频| 精品夜夜嗨av一区二区三区| 99r国产精品| 精品国产91乱码一区二区三区| 亚洲国产精品激情在线观看| 日韩中文字幕av电影| 成人av先锋影音| 91麻豆精品国产91久久久 | 久久久蜜臀国产一区二区| 中文天堂在线一区| 午夜亚洲福利老司机| 风间由美性色一区二区三区| 欧美日韩高清影院| 中文字幕成人网| 美女一区二区三区在线观看| av电影在线观看一区| 欧美理论电影在线| 亚洲欧洲日产国产综合网| 秋霞av亚洲一区二区三| eeuss影院一区二区三区 | 蜜桃av噜噜一区| 波多野结衣精品在线| 精品久久久久久久久久久院品网 | 日韩一区二区三区免费看 | 欧美性xxxxx极品少妇| 久久久久久亚洲综合| 男男视频亚洲欧美| 欧洲国内综合视频| 18欧美乱大交hd1984| 高清不卡在线观看av| 欧美精品一区二区高清在线观看| 日韩综合在线视频| 欧美图片一区二区三区| 亚洲免费看黄网站| 91网址在线看| 亚洲美女在线一区| 99re在线精品| 中文子幕无线码一区tr| 久久精品国内一区二区三区| 9191久久久久久久久久久| 亚洲一区二区视频| 色婷婷精品大在线视频| 亚洲人成网站色在线观看| 99久久夜色精品国产网站| 国产精品久久久久久久岛一牛影视| 丁香亚洲综合激情啪啪综合| 国产精品久久三| 91老司机福利 在线| 亚洲精品日韩专区silk| 欧美性猛交xxxx黑人交| 午夜私人影院久久久久| 717成人午夜免费福利电影| 日韩精品国产欧美| 欧美v亚洲v综合ⅴ国产v| 国产一区二区三区最好精华液| 国产偷国产偷精品高清尤物| 成人一级视频在线观看| 亚洲视频电影在线| 欧美影院精品一区| 青青草97国产精品免费观看 | 3d成人动漫网站| 美女网站色91| 欧美精品一区二区三区蜜桃| 国产成人免费视频网站| 亚洲婷婷综合久久一本伊一区| 欧美三级在线视频| 麻豆精品在线播放| 国产精品久久久久久久久免费桃花| 色婷婷av一区二区三区软件| 日韩一区欧美二区| 久久久噜噜噜久噜久久综合| 91色婷婷久久久久合中文| 视频在线观看91| 国产精品国产三级国产aⅴ原创 | 日韩精品免费专区| 国产偷国产偷精品高清尤物| 欧美性色黄大片手机版| 久久99精品国产麻豆不卡| 中文字幕在线观看一区| 欧美日韩亚洲综合一区二区三区| 久久99蜜桃精品| 亚洲女女做受ⅹxx高潮| 日韩免费高清视频| 一本色道久久综合亚洲精品按摩| 久久国产精品99久久人人澡| 亚洲欧美日韩成人高清在线一区| 精品三级av在线| 欧美在线一区二区| 国产成人精品亚洲777人妖| 亚洲一级在线观看| 国产精品麻豆视频| 精品噜噜噜噜久久久久久久久试看| 欧美怡红院视频| aaa国产一区| 国产在线视频一区二区| 日韩综合在线视频| 伊人夜夜躁av伊人久久| 国产性色一区二区| 精品国产一区二区三区不卡 | 国产iv一区二区三区| 天堂蜜桃一区二区三区| 亚洲蜜桃精久久久久久久| 国产视频一区二区在线| 日韩一二三四区| 欧美三级三级三级| 91国偷自产一区二区开放时间| 成人教育av在线| 国产精品白丝jk白祙喷水网站| 日本不卡视频在线| 婷婷六月综合网| 亚洲mv大片欧洲mv大片精品| 亚洲综合免费观看高清完整版在线 | 91女人视频在线观看| 国产经典欧美精品| 国内精品伊人久久久久av影院| 麻豆国产精品777777在线| 天天亚洲美女在线视频| 亚洲高清免费视频| 日韩精品一卡二卡三卡四卡无卡| 石原莉奈一区二区三区在线观看| 亚洲成人动漫在线观看| 亚洲电影在线播放| 亚洲高清三级视频| 日韩精品免费专区| 男女男精品视频| 国产一区二区精品久久99| 极品少妇xxxx偷拍精品少妇| 国产精品亚洲成人| 国产成人综合在线| 国产精品系列在线播放| 成人免费视频免费观看| 99国产精品久| 欧美日韩和欧美的一区二区| 6080国产精品一区二区| 91精品国产欧美一区二区| 日韩视频不卡中文| 久久久久久久久久久99999| 国产欧美一区二区精品性色超碰 | 亚洲精品久久久蜜桃| 亚洲欧美电影院| 香蕉久久夜色精品国产使用方法| 亚洲夂夂婷婷色拍ww47| 亚洲精品乱码久久久久久黑人 | 欧美变态口味重另类| 久久婷婷久久一区二区三区| 中文字幕中文在线不卡住| 亚洲激情在线播放| 蜜桃av一区二区| 色综合视频在线观看| 欧美精品vⅰdeose4hd| 久久久不卡影院| 亚洲国产成人porn| 麻豆高清免费国产一区| 国产三级精品视频| 欧美国产亚洲另类动漫| 亚洲一区二区四区蜜桃| 韩国女主播成人在线| 在线一区二区三区做爰视频网站| 日韩视频一区二区三区| 亚洲三级视频在线观看|