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

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

?? simple_graphics.c

?? VGA核的verilog實現
?? C
?? 第 1 頁 / 共 3 頁
字號:
/***********************************************************************
 *                                                                     *
 * File:     simple_graphics.c                                         *
 *                                                                     *
 * Purpose:  Contains some useful graphics routines                    *
 *                                                                     *
 * Author:   N. Knight                                                 *
 *           Altera Corporation                                        *
 *           Apr 2006                                                  *
 **********************************************************************/

#include <string.h>

#include "simple_graphics.h"
#include "io.h"
#include "sys/alt_alarm.h"
#include "sys/alt_cache.h"
#include "system.h"


/******************************************************************
*  Function: vid_draw_line
*
*  Purpose: Draws a line between two end points. First checks
*           to see if the line is horizontal.  If it is, it calls
*           vid_draw_horiz_line(), which is much faster than 
*           vid_draw_sloped_line.
*
******************************************************************/
__inline__ void vid_draw_line(int horiz_start, int vert_start, int horiz_end, int vert_end, int width, int color, display_frame_buffer_struct* frame_buffer)
{
 
  if( vert_start == vert_end )
  {
//    c2h_draw_horiz_line( (unsigned short)horiz_start, 
//                         (unsigned short)horiz_end,  
//                         (unsigned short)vert_start,
//                         color,
//                         frame_buffer->frame1);

    vid_draw_horiz_line( (unsigned short)horiz_start, 
                         (unsigned short)horiz_end, 
                         (unsigned short)vert_start,
                         color,
                         frame_buffer );
  }
  else
  {
    vid_draw_sloped_line( (unsigned short)horiz_start, 
                          (unsigned short)vert_start, 
                          (unsigned short)horiz_end, 
                          (unsigned short)vert_end, 
                          (unsigned short)width, 
                          color,
                          frame_buffer );
  }
}



void vid_scroll_string_quit(vid_text_scroll_struct* scroll)
{
  free(scroll->string);
  free(scroll);
}

vid_text_scroll_struct* vid_scroll_string_init(int hbegin, int vbegin, int hend, int f_color, int b_color, char* font, int ms_delay, char *string)
{
  vid_text_scroll_struct* scroll;
  scroll = malloc(sizeof (vid_text_scroll_struct));
  
  scroll->hbegin = hbegin;
  scroll->vbegin = vbegin;
  scroll->hend = hend;
  scroll->f_color = f_color;
  scroll->b_color = b_color;
  scroll->string = malloc(strlen(string)+2);
  strcpy(scroll->string, string);
  scroll->font = font;
  scroll->ms_delay = ms_delay;
  scroll->ticks_at_last_move = alt_nticks();
  scroll->text_scroll_index = 0;
  scroll->text_scroll_started = 0;
  scroll->window_width = scroll->hend - scroll->hbegin;
  scroll->length_of_string = strlen(string);
  scroll->string_points = scroll->length_of_string * 8;
  scroll->scroll_points = (scroll->window_width + scroll->string_points);
 
  return(scroll);
  
}


int vid_scroll_string(vid_text_scroll_struct* scroll, display_frame_buffer_struct* frame_buffer)
{

  int x_start, x_end, x_index, string_x_index, string_char_index, char_row, char_column;
  char character, column_mask;
  char* font_char_ptr;
  char pixels_to_move_by = 1;

  // If it's time to move the scroll..
  if (alt_nticks() >= (scroll->ticks_at_last_move + ((alt_ticks_per_second() * (scroll->ms_delay)) / 1000))) {
    scroll->ticks_at_last_move = alt_nticks();
    
    // Track where we are in the scroll.
    if(scroll->text_scroll_started == 0) {
      scroll->text_scroll_index = 0;
      scroll->text_scroll_started = 1;
    } else if(scroll->text_scroll_index >= scroll->scroll_points)  {
      scroll->text_scroll_started = 0;
    } else {
      scroll->text_scroll_index += pixels_to_move_by;
    }
    
    //Find out where we start
    if (scroll->text_scroll_index < scroll->window_width) {
      x_start = scroll->hbegin + scroll->window_width - scroll->text_scroll_index;
    } else {
      x_start = scroll->hbegin;
    }
    //Find out where we end
    if (scroll->string_points > scroll->text_scroll_index) {
      x_end = scroll->hend;
    } else {
      x_end = (scroll->hend - scroll->text_scroll_index + scroll->string_points);
    }

    // Write the string segment a column (x) at a time
    for(x_index = x_start; x_index < x_end; x_index++) {
      // Find the x index we're at within the string
      // If first part of string hasnt yet reached left side of scroll window
      if (scroll->text_scroll_index < scroll->window_width) {
        string_x_index = (x_index - x_start);
      } else {
        string_x_index = scroll->text_scroll_index - scroll->window_width + x_index - x_start;
      }
      //Find the character we're supposed to be writing
      string_char_index = (string_x_index / 8);
      character = scroll->string[string_char_index];
      char_column = (string_x_index % 8);
      column_mask = (((unsigned int)0x80) >> char_column);
      font_char_ptr = (scroll->font + ((character - 0x20) * FONT_10PT_ROW));
      //We have all the data now, so let's write a column
      for(char_row = 0; char_row < 11; char_row++) {
        // If the font table says this pixel is on, then set it to the foreground color
        if (*(font_char_ptr + char_row) & column_mask) {
          vid_set_pixel(x_index, scroll->vbegin + char_row, scroll->f_color, frame_buffer); 
        // Otherwise, set it to the background color.
        } else {
          vid_set_pixel(x_index, scroll->vbegin + char_row, scroll->b_color, frame_buffer); //background color
        }
      }
    }
    // Erase the leftover column (x) of the last string we wrote.
    vid_draw_line(x_end, scroll->vbegin, x_end, scroll->vbegin + 10, 1, scroll->b_color, frame_buffer);
    // Log what time we moved the scroll.
  }
  return(0);
}


/******************************************************************
*  Function: vid_move_block
*
*  Purpose: Moves a block around the screen, backfilling with 
*           the backfill_color parameter.
*
******************************************************************/

int vid_move_block(int xbegin, int ybegin, int xend, int yend, int x_distance, int y_distance, int backfill_color, display_frame_buffer_struct* frame_buffer)
{
  int read_x, read_y, write_x, write_y;
  short temp_pixel;
  
  if(x_distance <= 0 && y_distance <= 0) {  
    //Move by rows because they are contiguous in memory (could help speed if in SDRAM)
    for (read_y = ybegin; read_y < yend; read_y++) {
      write_y = read_y + y_distance;
      for(read_x = xbegin; read_x < xend; read_x++) {
        write_x = read_x + x_distance;
        temp_pixel = vid_get_pixel(read_x, read_y, frame_buffer);
        vid_set_pixel(write_x, write_y, temp_pixel, frame_buffer);
        if(read_x >= xend + x_distance || read_y >= yend + y_distance) 
        {
	        vid_set_pixel(read_x, read_y, backfill_color, frame_buffer);
        }
      }
    }
  }
  return (0);
}

/******************************************************************
*  Function: vid_print_string
*
*  Purpose: Prints a string to the specified location of the screen
*           using the specified font and color.
*           Calls vid_print_char
*
******************************************************************/
int vid_print_string(int horiz_offset, int vert_offset, int color, char *font, display_frame_buffer_struct* frame_buffer, char string[])
{
  int i = 0;
  int original_horiz_offset;

  original_horiz_offset = horiz_offset;

  // Print until we hit the '\0' char.
  while (string[i]) {
    //Handle newline char here.
    if (string[i] == '\n') {
      horiz_offset = original_horiz_offset;
      vert_offset += 12;
      i++;
      continue;
    }
    // Lay down that character and increment our offsets.
    vid_print_char (horiz_offset, vert_offset, color, string[i], font, frame_buffer);
    i++;
    horiz_offset += 8;
  }
  return (0);
}

/******************************************************************
*  Function: vid_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 vid_draw_box (int horiz_start, int vert_start, int horiz_end, int vert_end, int color, int fill, display_frame_buffer_struct* frame_buffer)
{

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

  return (0);
}


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

int vid_print_char (int horiz_offset, int vert_offset, int color, char character, char *font, display_frame_buffer_struct* 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)) {
        vid_set_pixel((horiz_offset + j), (vert_offset + i), color, frame_buffer); // plot the pixel
      }
    }
  }
  return(0);
}


/******************************************************************
*  Function: vid_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 vid_set_pixel(int horiz, int vert, unsigned int color, display_frame_buffer_struct* frame_buffer)
{
  int addr;
  
  if( frame_buffer->color_depth == 32 )
  {
  	addr = ( ( (int)(frame_buffer->frame1) )+ (vert * (frame_buffer->width * 4)) + horiz * 4);
		IOWR_32DIRECT( addr, 0, (unsigned int)(color));
  }
  
  else if( frame_buffer->color_depth == 24 )
  {
  	addr = ( ( (int)(frame_buffer->frame1) )+ (vert * (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( frame_buffer->color_depth == 16 )
  {
  	addr = ( ( (int)(frame_buffer->frame1) )+ (vert * (frame_buffer->width * 2)) + horiz * 2);
  	IOWR_16DIRECT( addr, 0, (int)(color));
	}


}

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

short vid_get_pixel(int horiz, int vert, display_frame_buffer_struct* frame_buffer)
{
  int addr;
  
  addr = ( ( (int)(frame_buffer->frame1) )+ (vert * (frame_buffer->width * 2)) + horiz * 2);
  return(IORD_16DIRECT(addr, 0));

}


/******************************************************************
*  Function: vid_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 vid_draw_solid_box() for
*           areas with odd-numbered corner points.
*           The color parameter must contain two pixel's worth
*           (32 bits).
*
******************************************************************/
void vid_paint_block (int Hstart,int Vstart, int Hend, int Vend, int color, display_frame_buffer_struct* frame_buffer)
{

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

  line = malloc(bytes_per_line + 12);

	if(frame_buffer->color_depth == 16)
	{
    for (i = 0; i < bytes_per_line; i+=2) 
    {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩在线一区二区三区| 色八戒一区二区三区| 色综合久久久久| 欧美大胆人体bbbb| 亚洲一二三四在线观看| 国内精品国产成人国产三级粉色| 日本电影欧美片| 国产欧美va欧美不卡在线| 毛片av一区二区| 欧美手机在线视频| 亚洲欧洲制服丝袜| 成人av影视在线观看| 欧美精品一区二区精品网| 一区二区三区欧美| 成人av手机在线观看| 久久久欧美精品sm网站| 久久99精品国产.久久久久久| 欧美群妇大交群中文字幕| 综合久久国产九一剧情麻豆| 成人在线视频一区| 中文av一区特黄| 成人午夜看片网址| 国产欧美综合在线观看第十页| 理论电影国产精品| 日韩一区二区在线观看视频 | 亚洲一级电影视频| 91麻豆swag| 成人免费在线视频| 91原创在线视频| 玉米视频成人免费看| 91麻豆国产福利精品| 亚洲人xxxx| 欧美亚洲综合网| 午夜精品国产更新| 7777精品伊人久久久大香线蕉最新版| 亚洲国产毛片aaaaa无费看| 欧美主播一区二区三区| 午夜电影网亚洲视频| 欧美精品久久99久久在免费线 | 精品一区二区三区在线观看国产| 日韩欧美一区二区免费| 国内精品免费**视频| 日本一区二区三级电影在线观看| 成人aa视频在线观看| 亚洲靠逼com| 欧美日韩高清不卡| 另类小说欧美激情| 国产精品三级久久久久三级| 99re视频精品| 舔着乳尖日韩一区| 久久精品无码一区二区三区| 不卡一二三区首页| 午夜激情久久久| 久久综合给合久久狠狠狠97色69| 成人免费va视频| 亚洲国产欧美在线人成| 2024国产精品| 91猫先生在线| 久久国产视频网| 亚洲六月丁香色婷婷综合久久| 欧美老肥妇做.爰bbww| 国产精品一二三四区| 在线成人高清不卡| 豆国产96在线|亚洲| 亚洲一区二区欧美| 国产三级精品视频| 欧美精品在线观看播放| 国产宾馆实践打屁股91| 日韩有码一区二区三区| 中文字幕精品三区| 538在线一区二区精品国产| 高清不卡在线观看| 奇米影视一区二区三区| 亚洲美女淫视频| 精品国产第一区二区三区观看体验| 99国产一区二区三精品乱码| 久久国产生活片100| 亚洲综合偷拍欧美一区色| 国产日韩欧美精品综合| 91精品国产综合久久香蕉的特点| 成人精品国产一区二区4080| 日本成人在线看| 亚洲国产婷婷综合在线精品| 中文字幕不卡在线| 亚洲精品一区二区三区香蕉| 欧美日韩一二三区| 91在线码无精品| 国产不卡视频在线观看| 久久不见久久见中文字幕免费| 一区二区三区四区在线播放 | 粉嫩高潮美女一区二区三区| 免费成人你懂的| 天堂一区二区在线免费观看| 亚洲精品福利视频网站| 国产亚洲精品bt天堂精选| 日韩视频一区二区在线观看| 欧美日韩激情一区| 欧美网站大全在线观看| 97精品久久久久中文字幕| 粉嫩av一区二区三区粉嫩| 国产伦精品一区二区三区免费迷| 日韩精品电影一区亚洲| 午夜精品一区二区三区三上悠亚| 亚洲欧美色一区| 成人免费小视频| 亚洲欧洲美洲综合色网| 国产精品激情偷乱一区二区∴| 久久综合色婷婷| 国产午夜精品久久久久久久| 国产亚洲一区二区三区| 久久久久久久久蜜桃| 久久久久久久免费视频了| 精品成人佐山爱一区二区| 精品少妇一区二区三区| 久久午夜色播影院免费高清| 久久这里只有精品6| 久久久精品tv| 国产精品毛片高清在线完整版| 国产无人区一区二区三区| 久久精品人人做| 国产精品福利一区| 亚洲精品成人天堂一二三| 亚洲一级二级三级在线免费观看| 亚洲高清不卡在线| 美女视频黄a大片欧美| 国产毛片精品视频| av电影在线观看一区| 欧美亚洲国产一区二区三区va| 在线观看视频一区二区欧美日韩| 欧美日本不卡视频| 2021久久国产精品不只是精品| 国产午夜精品一区二区三区嫩草| 国产精品久久毛片av大全日韩| 成人免费小视频| 视频一区视频二区中文字幕| 韩国欧美国产一区| 91丨porny丨国产| 91精品国产色综合久久不卡蜜臀 | 8v天堂国产在线一区二区| 精品国产区一区| 中文字幕亚洲成人| 午夜久久电影网| 国产一区二区三区精品视频| 99久久99久久精品国产片果冻| 欧洲日韩一区二区三区| 精品美女一区二区| 亚洲摸摸操操av| 蜜桃一区二区三区在线| 99re热视频精品| 欧美一区二区三区啪啪| 国产精品久久久久影视| 亚洲国产aⅴ成人精品无吗| 国产在线不卡一卡二卡三卡四卡| 91色|porny| 久久久久久久综合狠狠综合| 亚洲主播在线观看| 国产大陆精品国产| 欧美日韩一区不卡| 国产精品久久久久久久久久久免费看 | 老色鬼精品视频在线观看播放| 成人av在线一区二区三区| 日韩一区二区三区观看| 亚洲色图在线播放| 国产一区二区中文字幕| 欧美日韩美少妇| 18欧美乱大交hd1984| 久久se精品一区二区| 欧美日韩在线播放一区| 国产精品色在线| 狠狠v欧美v日韩v亚洲ⅴ| 欧美午夜精品一区| 中文字幕日韩一区| 国产成人在线视频网址| 欧美成人aa大片| 日韩激情视频在线观看| 99国产精品久久久| 国产三级三级三级精品8ⅰ区| 婷婷开心激情综合| 欧美三级在线视频| 亚洲女人****多毛耸耸8| 高清国产一区二区| 国产日韩欧美不卡| 国内精品自线一区二区三区视频| 欧美精品久久久久久久多人混战 | 狠狠久久亚洲欧美| 日韩一级精品视频在线观看| 香港成人在线视频| 欧美色网站导航| 亚洲国产日韩a在线播放性色| 色综合久久天天综合网| 亚洲男人的天堂一区二区| 99久久精品国产导航| 中文字幕在线不卡一区| 从欧美一区二区三区| 欧美激情综合五月色丁香| 国产宾馆实践打屁股91| 亚洲国产精品av| 91免费在线看| 亚洲图片一区二区| 欧美狂野另类xxxxoooo|