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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? vga_controller.c

?? altera的ip核
?? C
?? 第 1 頁 / 共 4 頁
字號:
*  Function: vga_draw_box
*
*  Purpose: Draws a box on the screen with the specified corner
*  points.  The fill parameter tells the function whether or not
*  to fill in the box.  1 = fill, 0 = do not fill.
*
******************************************************************/
int vga_draw_box (int horiz_start, int vert_start, int horiz_end, int vert_end, int color, int fill, vga_frame_buffer_struct* vga_frame_buffer)
{

  // If we want to fill in our box
  if (fill) {
     vga_paint_block (horiz_start, vert_start, horiz_end, vert_end, color, vga_frame_buffer);
  // If we're not filling in the box, just draw four lines.
  } else {
    vga_draw_line(horiz_start, vert_start, horiz_start, vert_end-1, 1, color, vga_frame_buffer);
    vga_draw_line(horiz_end-1, vert_start, horiz_end-1, vert_end-1, 1, color, vga_frame_buffer);
    vga_draw_horiz_line(horiz_start, horiz_end-1, vert_start, color, vga_frame_buffer);
    vga_draw_horiz_line(horiz_start, horiz_end-1, vert_end-1, color, vga_frame_buffer);
  }

  return (0);
}


/******************************************************************
*  Function: vga_print_char
*
*  Purpose: Prints a character to the specified location of the
*           screen using the specified font and color.
*
******************************************************************/

int vga_print_char (int horiz_offset, int vert_offset, int color, char character, char *font, vga_frame_buffer_struct* vga_frame_buffer)
{

  int i, j;
  
  char temp_char, char_row;

  // Convert the ASCII value to an array offset
  temp_char = (character - 0x20);

  //Each character is 8 pixels wide and 11 tall.
  for(i = 0; i < 11; i++) {
      char_row = *(font + (temp_char * FONT_10PT_ROW) + i);
    for (j = 0; j < 8; j++) {
      //If the font table says the pixel in this location is on for this character, then set it.
      if (char_row & (((unsigned char)0x80) >> j)) {
        vga_set_pixel((horiz_offset + j), (vert_offset + i), color, vga_frame_buffer); // plot the pixel
      }
    }
  }
  return(0);
}


/******************************************************************
*  Function: vga_set_pixel
*
*  Purpose: Sets the specified pixel to the specified color.
*           Sets one pixel although frame buffer consists of
*           two-pixel words.  Therefore this function is not
*           efficient when painting large areas of the screen.
*
******************************************************************/

void vga_set_pixel(int horiz, int vert, unsigned int color, vga_frame_buffer_struct* vga_frame_buffer)
{
  int addr;
  
  if( vga_frame_buffer->color_depth == 24 )
  {
  	addr = ( ( (int)(vga_frame_buffer->vga_frame1) )+ (vert * (vga_frame_buffer->width * 3)) + horiz * 3);
		IOWR_8DIRECT( addr, 0, (unsigned char)(color));
 		IOWR_8DIRECT( addr+1, 0, (unsigned char)(color >> 8));
    IOWR_8DIRECT( addr+2, 0, (unsigned char)(color >> 16));
  }
  
  else if( vga_frame_buffer->color_depth == 16 )
  {
  	addr = ( ( (int)(vga_frame_buffer->vga_frame1) )+ (vert * (vga_frame_buffer->width * 2)) + horiz * 2);
  	IOWR_16DIRECT( addr, 0, (int)(color));
	}
}


/******************************************************************
*  Function: vga_get_pixel
*
*  Purpose: Reads the color of the pixel at the given coordinates
*
******************************************************************/

short vga_get_pixel(int horiz, int vert, vga_frame_buffer_struct* vga_frame_buffer)
{
  int addr;
  
  addr = ( ( (int)(vga_frame_buffer->vga_frame1) )+ (vert * (vga_frame_buffer->width * 2)) + horiz * 2);
  return(IORD_16DIRECT(addr, 0));

}

/******************************************************************
*  Function: vga_clear_screen
*
*  Purpose: Uses the fast memset routine to clear the entire frame
*           buffer.  User can specify black(0x00) or white(0xFF).
*
******************************************************************/
inline void vga_clear_screen (vga_frame_buffer_struct* vga_frame_buffer, char color)
{
	memset( (void*)(vga_frame_buffer->vga_frame1), color, vga_frame_buffer->bytes_per_frame );
}
/******************************************************************
*  Function: vga_paint_block
*
*  Purpose: Paints a block of the screen the specified color.
*           Note: works with two pixels at a time to maintain high
*           bandwidth.  Therefore, corner points must be even
*           numbered coordinates.  Use vga_draw_solid_box() for
*           areas with odd-numbered corner points.
*           The color parameter must contain two pixel's worth
*           (32 bits).
*
******************************************************************/
void vga_paint_block (int Hstart,int Vstart, int Hend, int Vend, int color, vga_frame_buffer_struct* vga_frame_buffer)
{

  int i;
  int addr;
  int bytes_per_line, bytes_per_pixel;
  char* line;
  
  bytes_per_pixel = (vga_frame_buffer->color_depth / 8);
  bytes_per_line = ((Hend - Hstart) * bytes_per_pixel);

  line = malloc(bytes_per_line + 12);

	if(vga_frame_buffer->color_depth == 16)
	{
    for (i = 0; i < bytes_per_line; i+=2) 
    {
      *(line + i) = (unsigned char)color;
      *(line + i + 1) = (unsigned char)(color >> 8);
    }
  }
  else if(vga_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);
    }
  }
  
  /* Initial Address */
  addr = (int)(vga_frame_buffer->vga_frame1) + ((Vstart * (vga_frame_buffer->width * bytes_per_pixel)) + (Hstart * bytes_per_pixel));
  
  for (i = Vstart; i < Vend; i++)
  {
    memcpy( (void*)addr, line, bytes_per_line );
    addr += (vga_frame_buffer->width * bytes_per_pixel);
  }
  free (line);
}


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

  int i;
  int addr;
  int bytes_per_line;

//  line = malloc(bytes_per_line + 12);

  if(vga_frame_buffer->color_depth == 24)
  { 
    addr = (int)(vga_frame_buffer->vga_frame1) + ((V * (vga_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(vga_frame_buffer->color_depth == 16)
  {
    addr = (int)(vga_frame_buffer->vga_frame1) + ((V * (vga_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 );
  }
}



/******************************************************************
*  Function: vga_merge_colors
*
*  Purpose: Takes 5-bit color values for each red, green, and blue
*           and merges them into one 16-bit color value.
*
******************************************************************/
int vga_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: vga_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 vga_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: vga_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 vga_color_convert16_24(unsigned short color16, char* color24)
{
	*(color24 + 0) = color16 >> 11;
	*(color24 + 1) = ((color16 & 0x3E) >> 5);
	*(color24 + 2) = (color16 & 0x1F);
	
	return (0);
}

/******************************************************************
*  Function: vga_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 vga_copy_line_to_frame_buffer( int x, int y, char* buffer, int num_pixels, int source_color_depth, vga_frame_buffer_struct* vga_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)(vga_frame_buffer->vga_frame1) + 
    ((y * (vga_frame_buffer->width * (vga_frame_buffer->bytes_per_pixel))) + 
    (x * (vga_frame_buffer->bytes_per_pixel)));
  
  bytes_in_line = num_pixels * vga_frame_buffer->bytes_per_pixel;
  
  if(source_color_depth == 24)
  {
    if(vga_frame_buffer->color_depth == 16)
    {
      temp_line = malloc(bytes_in_line);
      while(index_24 < bytes_in_line)
      {
        *(temp_line + index_16) = vga_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(vga_frame_buffer->color_depth == 24)
    {
      memcpy( (void*)dest_addr, (void*)buffer, bytes_in_line );
    }
  }
  else if(source_color_depth == 16)
  {
    if(vga_frame_buffer->color_depth == 24)
    {
      temp_line = malloc(bytes_in_line);
      while(index_16 < num_pixels )
      {
        vga_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(vga_frame_buffer->color_depth == 16)
    {
      memcpy( (void*)dest_addr, (void*)buffer, bytes_in_line );

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲视频一二区| av电影一区二区| 欧美综合久久久| 久久久久久久久久电影| 亚洲乱码一区二区三区在线观看| 日韩电影在线一区二区三区| 99久久99久久精品国产片果冻 | 成人免费视频免费观看| 91欧美一区二区| 欧美精品在欧美一区二区少妇| 日韩一二三四区| 奇米777欧美一区二区| 欧美性猛交xxxxxxxx| 一区二区三区 在线观看视频| www.爱久久.com| 日本一区二区成人在线| 国产高清视频一区| 欧美成人r级一区二区三区| 日本欧美一区二区| 欧美电影一区二区| 午夜国产精品一区| 欧美电影一区二区三区| 成年人国产精品| 日韩理论片网站| 亚欧色一区w666天堂| 欧美日韩一区久久| 亚洲v日本v欧美v久久精品| 色视频一区二区| 国产精品视频一二| 成人高清视频在线观看| 国产日韩在线不卡| 欧美午夜一区二区| 国产精品一区二区三区网站| 久久久久9999亚洲精品| 91色婷婷久久久久合中文| 一卡二卡欧美日韩| 久久亚洲春色中文字幕久久久| 99精品黄色片免费大全| 亚洲成a人v欧美综合天堂| 欧美精品久久久久久久多人混战| 免费不卡在线观看| 夜夜亚洲天天久久| 91精品国产色综合久久不卡电影 | 久久综合久色欧美综合狠狠| 成人精品在线视频观看| 亚洲小说春色综合另类电影| 欧美mv和日韩mv国产网站| 色综合天天性综合| 国产成人av一区二区三区在线观看| 日韩理论片网站| 久久久蜜桃精品| 精品欧美一区二区在线观看 | 欧美高清在线视频| 精品第一国产综合精品aⅴ| 欧美日韩极品在线观看一区| 97久久精品人人做人人爽| 精品一区二区三区欧美| 另类成人小视频在线| 亚洲精品国产一区二区精华液 | 97se亚洲国产综合自在线不卡| 国产在线精品一区二区| 亚洲一二三区视频在线观看| 日韩美女视频19| 亚洲欧洲韩国日本视频| 国产精品私人自拍| 久久久影院官网| 国产日韩欧美精品在线| 欧美一区二区久久| 91免费版pro下载短视频| 成人aa视频在线观看| 色综合 综合色| 亚洲视频免费看| 精品国产一区久久| 精品精品国产高清a毛片牛牛| 欧美美女网站色| 久久综合久久鬼色中文字| 成人欧美一区二区三区黑人麻豆 | 夫妻av一区二区| 欧美伊人久久久久久久久影院 | 久久精品人人做人人综合| 国产亚洲成aⅴ人片在线观看| 一区二区三区欧美视频| 极品美女销魂一区二区三区免费| gogogo免费视频观看亚洲一| 日韩一级片在线观看| 亚洲已满18点击进入久久| 国产一区不卡精品| 欧美日韩视频在线观看一区二区三区| 久久久久久夜精品精品免费| 艳妇臀荡乳欲伦亚洲一区| 不卡一二三区首页| 久久这里只有精品6| 日韩高清在线一区| 欧美精品日日鲁夜夜添| 亚洲最大成人综合| 99久久婷婷国产| 一色桃子久久精品亚洲| 国产成人av一区二区三区在线| 欧美一区二区三区人| 天堂久久一区二区三区| 欧美丝袜丝交足nylons图片| 一区二区三区在线播| 欧美主播一区二区三区美女| 亚洲色图20p| 成人性色生活片| 在线观看一区二区精品视频| 亚洲欧美aⅴ...| 欧美精品日韩精品| 精品亚洲国产成人av制服丝袜| 欧美成人艳星乳罩| 国产高清精品在线| 亚洲人成影院在线观看| 日本福利一区二区| 蜜臀av性久久久久蜜臀aⅴ四虎| 精品视频在线免费观看| 久久福利视频一区二区| 国产色91在线| 色综合视频在线观看| 日本成人超碰在线观看| 精品久久久久久综合日本欧美| 激情综合网激情| 亚洲欧美日韩久久| 日韩欧美国产系列| gogogo免费视频观看亚洲一| 性感美女久久精品| 中文字幕成人av| 欧美丰满美乳xxx高潮www| 高潮精品一区videoshd| 天天色综合成人网| 综合在线观看色| 2023国产精品| 在线成人午夜影院| 91麻豆精品视频| 国产一区三区三区| 日本美女一区二区三区| 亚洲色图视频网| 国产精品青草综合久久久久99| 欧美久久久久久蜜桃| 91视频在线看| 国产成人免费av在线| 久久99国产精品久久99果冻传媒| 亚洲综合图片区| 亚洲欧洲成人自拍| 国产精品无圣光一区二区| www久久精品| 国产性天天综合网| 久久免费偷拍视频| 日韩女优制服丝袜电影| 欧美一区二区三区在线视频| 91在线视频18| 狠狠色狠狠色综合| 国产精品影视天天线| 国产一区二区三区在线看麻豆| 国产中文一区二区三区| 国产一区在线视频| 99在线精品免费| 欧美特级限制片免费在线观看| 一本色道a无线码一区v| 欧洲精品视频在线观看| 在线观看国产91| 精品奇米国产一区二区三区| 精品国产露脸精彩对白| 国产精品成人一区二区三区夜夜夜| 国产精品无人区| 亚洲成人一二三| 极品少妇xxxx精品少妇偷拍| 国产精品自拍一区| 91亚洲精品一区二区乱码| 在线日韩一区二区| 欧美一区二区三区免费大片 | 99视频热这里只有精品免费| 色琪琪一区二区三区亚洲区| 日韩一区二区精品葵司在线 | 精品理论电影在线| 亚洲欧美自拍偷拍色图| 久久99热99| 色香蕉久久蜜桃| 欧美videossexotv100| 亚洲精品写真福利| 激情伊人五月天久久综合| 色欧美日韩亚洲| 欧美激情艳妇裸体舞| 久久精品国产一区二区三| 一本一本大道香蕉久在线精品 | 日韩欧美国产不卡| 一个色在线综合| 99国产一区二区三精品乱码| 精品久久久久久最新网址| 丝袜脚交一区二区| 欧美日韩一区二区不卡| 亚洲精品中文在线观看| 国产aⅴ综合色| 欧美激情在线一区二区| 黄色资源网久久资源365| 337p亚洲精品色噜噜狠狠| 中文字幕一区二区三区视频| 成人综合在线网站| 欧美韩国一区二区| av激情综合网| 亚洲欧美一区二区三区极速播放|