亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲欧美电影院| 精品国偷自产国产一区| 国产精品你懂的在线欣赏| 国产精品18久久久久久久久| 久久久精品日韩欧美| 国产福利视频一区二区三区| 国产精品免费久久| 91视频com| 石原莉奈在线亚洲三区| 日韩欧美国产一区在线观看| 国内外精品视频| 国产精品久久久久久亚洲伦| 91麻豆精品视频| 婷婷国产在线综合| 日韩免费视频一区| 成人国产在线观看| 亚洲精品国产一区二区精华液 | 色综合视频在线观看| 亚洲精品免费一二三区| 91麻豆精品国产综合久久久久久| 六月丁香综合在线视频| 中文字幕不卡三区| 欧美在线一区二区三区| 奇米影视一区二区三区| 欧美激情在线一区二区三区| 欧美主播一区二区三区美女| 麻豆国产91在线播放| 欧美国产激情一区二区三区蜜月| 欧美亚日韩国产aⅴ精品中极品| 麻豆成人久久精品二区三区红 | 视频在线观看一区二区三区| 久久午夜电影网| 欧美日韩中文字幕一区二区| 极品少妇一区二区三区精品视频| 国产精品久久久久久久久久免费看| 在线一区二区视频| 国产电影一区在线| 亚洲五码中文字幕| 国产精品久久久久久一区二区三区 | 日韩精品专区在线影院观看| 91在线精品一区二区三区| 久久se精品一区精品二区| 亚洲男人的天堂一区二区| 亚洲精品一区二区三区精华液| 91日韩一区二区三区| 国内精品伊人久久久久av一坑| 亚洲一区二区三区中文字幕在线| 国产日韩精品一区| 精品精品国产高清a毛片牛牛| 亚洲一区在线观看免费 | 亚洲精品国产成人久久av盗摄| 欧美成人a在线| 在线免费观看视频一区| 福利一区二区在线观看| 日本aⅴ亚洲精品中文乱码| 亚洲精品v日韩精品| 欧美国产国产综合| ww亚洲ww在线观看国产| 欧美精品黑人性xxxx| 91久久线看在观草草青青| 成人国产一区二区三区精品| 国产精品一区二区无线| 极品瑜伽女神91| 玖玖九九国产精品| 日韩成人免费看| 天天色图综合网| 性欧美大战久久久久久久久| 亚洲一区自拍偷拍| 成人欧美一区二区三区视频网页| 国产欧美日韩中文久久| 久久综合狠狠综合久久综合88| 欧美一级淫片007| 欧美一卡在线观看| 欧美猛男男办公室激情| 欧美高清你懂得| 欧美高清精品3d| 日韩久久久久久| 久久综合久久久久88| 欧美成人a视频| 久久网站最新地址| 欧美极品美女视频| 中文字幕亚洲一区二区av在线 | 在线精品观看国产| 日本道在线观看一区二区| 日本久久精品电影| 欧美视频一区二区三区| 欧美日韩综合一区| 日韩欧美成人激情| 久久久五月婷婷| 中文字幕av一区二区三区| 最新国产成人在线观看| 一区二区三区日本| 亚洲成人第一页| 青青草视频一区| 国产精选一区二区三区| 成人免费av在线| 在线免费亚洲电影| 日韩一区和二区| 欧美激情一区二区| 亚洲综合在线第一页| 日韩黄色在线观看| 国产乱码一区二区三区| 成人av综合一区| 欧美日韩午夜在线| 久久美女艺术照精彩视频福利播放| 亚洲国产精品传媒在线观看| 亚洲综合视频在线观看| 奇米影视在线99精品| 国产成人免费视频一区| 91福利在线观看| 26uuu精品一区二区在线观看| 中文字幕亚洲欧美在线不卡| 日韩综合小视频| 国产成人精品免费网站| 欧美午夜寂寞影院| 久久美女高清视频| 亚洲国产中文字幕在线视频综合| 狠狠色狠狠色合久久伊人| 91网站在线观看视频| 日韩西西人体444www| 一色桃子久久精品亚洲| 蜜臀av在线播放一区二区三区| av在线不卡观看免费观看| 在线播放91灌醉迷j高跟美女| 国产日韩一级二级三级| 亚洲成年人影院| 成人午夜激情在线| 欧美一区二区三区思思人| 亚洲欧洲成人精品av97| 另类人妖一区二区av| 色久优优欧美色久优优| 久久精品一区二区三区av| 日欧美一区二区| 色婷婷久久久综合中文字幕| 精品国产乱码久久久久久浪潮 | 亚洲欧洲www| 久久不见久久见中文字幕免费| 色老汉一区二区三区| 国产欧美日韩在线| 久久99日本精品| 在线播放中文一区| 亚洲欧美一区二区三区孕妇| 国产麻豆视频精品| 欧美一区二区三区婷婷月色| 一区二区久久久久久| 99精品一区二区三区| 久久新电视剧免费观看| 久久成人精品无人区| 欧美一个色资源| 午夜精品视频一区| 色欧美片视频在线观看| 国产精品视频观看| 国产一区二区在线电影| 日韩精品一区二区三区蜜臀| 亚洲bt欧美bt精品777| 欧美优质美女网站| 亚洲欧美日韩系列| 99久久99精品久久久久久| 国产精品久久夜| 成人18精品视频| 中文字幕电影一区| 成人丝袜高跟foot| 久久久久国产精品人| 国产一区二区不卡| 国产亚洲视频系列| 国产成人午夜高潮毛片| 亚洲国产电影在线观看| 国产成人aaaa| 中文字幕一区二区三区在线观看| 成人网男人的天堂| 亚洲欧洲美洲综合色网| 97精品久久久午夜一区二区三区 | 欧美嫩在线观看| 日韩黄色在线观看| 欧美一二三在线| 国产在线播精品第三| 国产欧美一区二区三区鸳鸯浴 | 国产成人精品影视| 国产精品嫩草影院com| 丁香啪啪综合成人亚洲小说| 国产精品成人一区二区三区夜夜夜| 成人高清在线视频| 亚洲精品成人少妇| 欧美午夜精品一区| 久久99深爱久久99精品| 国产色91在线| 91在线你懂得| 视频一区免费在线观看| 久久亚洲二区三区| 97久久人人超碰| 日韩中文字幕区一区有砖一区| 欧美一区二区二区| 黄一区二区三区| 欧美日韩极品在线观看一区| 日日骚欧美日韩| 日本一区二区三区在线不卡 | 欧美一级高清大全免费观看| 国产主播一区二区| 国产精品视频一二三| 成人久久视频在线观看|