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

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

?? vga_controller.c

?? altera的ip核
?? C
?? 第 1 頁 / 共 4 頁
字號:
    }
  }
  return(0);
}

/******************************************************************
*  Function: vga_draw_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 vga_draw_line(int horiz_start, int vert_start, int horiz_end, int vert_end, int width, int color, vga_frame_buffer_struct* vga_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
      vga_set_pixel(horiz_start, vert_start, color, vga_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
      vga_set_pixel(horiz_start, vert_start, color, vga_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: vga_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 vga_draw_circle(int Hcenter, int Vcenter, int radius, int color, char fill, vga_frame_buffer_struct* vga_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.
  vga_circle_points(Hcenter, Vcenter, x, y, color, fill, vga_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;
    }
    vga_circle_points(Hcenter, Vcenter, x, y, color, fill, vga_frame_buffer);
  }
  return (0);
}

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

void vga_circle_points(int cx, int cy, int x, int y, int color, char fill, vga_frame_buffer_struct* vga_frame_buffer)
{

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

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

/**************************************************************************
 *  draw_bitmap                                                           *
 *    Draws a bitmap.                                                     *
 **************************************************************************/


void draw_bitmap(bitmap_struct *bmp,int x,int y, vga_frame_buffer_struct* vga_frame_buffer)
{
  int i, j;
  int bitmap_offset = 0;

  for(j=0; j < bmp->biHeight; j++)
  {
    for(i=0; i < bmp->biWidth; i++, bitmap_offset++)
    {
      vga_set_pixel(x+i, y+j, (bmp->data[bitmap_offset]), vga_frame_buffer);
    }
  }
}

/**************************************************************************
 *  draw_transparent_bitmap                                               *
 *    Draws a transparent bitmap.                                         *
 **************************************************************************/

void draw_transparent_bitmap(bitmap_struct *bmp,int x,int y, vga_frame_buffer_struct* vga_frame_buffer)
{
  int i,j;
  short bitmap_offset = 0;
  short data;

  for(j=0; j < bmp->biHeight; j++)
  {
    for(i=0; i < bmp->biWidth; i++, bitmap_offset++)
    {
      data = bmp->data[bitmap_offset];
      if (data != 0x0020) 
      {
        vga_set_pixel(x+i, y+j, data, vga_frame_buffer);
      }
    }
  }
}


/**************************************************************************
 *  fskip                                                                 *
 *     Skips bytes in a file.                                             *
 **************************************************************************/

void fskip(FILE *fp, int num_bytes)
{
   int i;
   for (i=0; i<num_bytes; i++)
      fgetc(fp);
}

/**************************************************************************
 *  load_bmp                                                              *
 *    Loads a bitmap file into memory.                                    *
 **************************************************************************/

void load_bmp(char *file, bitmap_struct *b)
{
  FILE *fp;
  long index;
  int x, byte_count, temp;
  short red, green, blue, color_index, color;

  /* Make sure filename string is termintated */
  file[strlen(file)] = 0x0;

  /* open the file */
  if ((fp = fopen(file, "rb")) == NULL)
  {
    printf("Error opening file %s.\n",file);
    exit(1);
  }

  /* check to see if it is a valid bitmap file */
  if (fgetc(fp)!='B' || fgetc(fp)!='M')
  {
    fclose(fp);
    printf("%s is not a bitmap file.\n",file);
    exit(1);
  }

  /* read in the width and height of the image, and the
     number of colors used; ignore the rest */
  fskip(fp,16);
  fread(&b->biWidth, sizeof(short), 1, fp);
  fskip(fp,2);
  fread(&b->biHeight,sizeof(short), 1, fp);
  fskip(fp,4);
  fread(&b->biBitCount,sizeof(short), 1, fp);
  fskip(fp,24);
  

  /* try to allocate memory for palette data */
  if (b->biBitCount != 24)
  {
    if ((b->bicolor_palatte = (char *) malloc((1 << (b->biBitCount))*3)) == NULL)
    {
      fclose(fp);
      printf("Error allocating memory for file %s.\n",file);
      exit(1);
    }
  }

  /* try to allocate memory for bitmap data */
  if ((b->data = (short *) malloc((b->biWidth * b->biHeight) * 2)) == NULL)
  {
    fclose(fp);
    printf("Error allocating memory for file %s.\n",file);
    exit(1);
  }

  /* read the palette information */
  if (b->biBitCount != 24)
  {
    for(index=0;index<(1 << (b->biBitCount));index++)
    {
      b->bicolor_palatte[(int)(index*3+2)] = fgetc(fp);
      b->bicolor_palatte[(int)(index*3+1)] = fgetc(fp);
      b->bicolor_palatte[(int)(index*3+0)] = fgetc(fp);
      x=fgetc(fp);
    }
  }

  /* read an 8-bit bitmap */
  if (b->biBitCount == 8)
  {
    for(index=(b->biHeight - 1)* b->biWidth; index >= 0; index -= b->biWidth)
      for(x=0;x<b->biWidth;x++)
      {
        color_index = (int)fgetc(fp);
        blue = (short)b->bicolor_palatte[(color_index * 3) + 2];
        green = (short)b->bicolor_palatte[(color_index * 3) + 1];
        red = (short)b->bicolor_palatte[(color_index * 3) + 0];
        color = vga_merge_colors(((unsigned short)red) >> 3, ((unsigned short)green) >> 3, ((unsigned short)blue) >> 3);
        b->data[index+x]=(short)color;
      }
  }

  /* read a 24-bit bitmap */
  if (b->biBitCount == 24)
  {
    for(index=(b->biHeight - 1)* b->biWidth; index >= 0; index -= b->biWidth)
    {
      for(x=0, byte_count=0; x < b->biWidth; x++, byte_count += 3)
      {
        blue  = (short)fgetc(fp);
        green = (short)fgetc(fp);
        red = (short)fgetc(fp);
        color = vga_merge_colors(((unsigned short)red) >> 3, ((unsigned short)green) >> 3, ((unsigned short)blue) >> 3);
        b->data[index+x]=(short)color;
      }
      for(;byte_count%4 != 0;)
      {
        temp = (char)fgetc(fp);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av电影在线不卡| 石原莉奈一区二区三区在线观看| 久久99久久99小草精品免视看| 777精品伊人久久久久大香线蕉| 丝袜美腿高跟呻吟高潮一区| 在线观看91av| 九九精品视频在线看| 欧美不卡视频一区| 国产河南妇女毛片精品久久久| 久久精品一区二区三区不卡牛牛 | 亚洲综合免费观看高清在线观看| 99久久伊人网影院| 亚洲黄色小视频| 欧美日韩一区 二区 三区 久久精品| 亚洲午夜精品网| 欧美一区二区久久久| 久久国产三级精品| 久久久精品中文字幕麻豆发布| 成人激情小说乱人伦| 一区二区三区四区乱视频| 欧美日韩中文字幕一区| 精品制服美女丁香| 亚洲天堂免费看| 91精品欧美福利在线观看| 国产精品一区二区不卡| 亚洲一区在线视频观看| 精品成人一区二区三区四区| 成人免费毛片嘿嘿连载视频| 亚洲国产欧美日韩另类综合| 精品剧情在线观看| 99精品在线观看视频| 日韩国产精品91| 国产亚洲欧美日韩日本| 欧美在线小视频| 国产精品99久久久久久久女警| 亚洲激情av在线| 久久色中文字幕| 欧美色窝79yyyycom| 精品一区二区三区蜜桃| 亚洲乱码精品一二三四区日韩在线| 欧美一区二区三区视频在线| 高清成人在线观看| 日本在线不卡一区| 中文字幕一区日韩精品欧美| 这里是久久伊人| 一本一道久久a久久精品综合蜜臀| 免费看欧美女人艹b| 亚洲黄色性网站| 中文字幕第一页久久| 欧美一区二区三区在线视频| 成人做爰69片免费看网站| 秋霞国产午夜精品免费视频 | 综合激情成人伊人| 91精品国产综合久久久久久漫画 | 视频在线观看一区| 国产精品国产自产拍高清av王其| 欧美一级高清大全免费观看| 色综合天天性综合| 国产成人av一区| 日韩av电影免费观看高清完整版| 中文字幕佐山爱一区二区免费| 精品裸体舞一区二区三区| 欧美精品1区2区3区| 在线观看中文字幕不卡| 成人app网站| 成人中文字幕在线| 韩国成人精品a∨在线观看| 日韩不卡一区二区| 亚洲国产精品麻豆| 亚洲在线视频免费观看| 国产精品不卡在线| 亚洲国产精品ⅴa在线观看| 久久久91精品国产一区二区三区| 在线不卡中文字幕播放| 欧美日韩精品欧美日韩精品一综合| 99久久综合色| 99v久久综合狠狠综合久久| 成人精品视频.| 成人午夜在线视频| 岛国av在线一区| 国产黄色精品网站| 高清不卡一区二区在线| 国产成人午夜高潮毛片| 国产精品99久久久久久有的能看 | 一区二区高清免费观看影视大全| 国产精品青草久久| 亚洲色图欧美偷拍| 一区二区三区四区在线免费观看| 亚洲精品免费在线播放| 亚洲另类春色国产| 亚洲国产美女搞黄色| 天堂久久一区二区三区| 日韩激情中文字幕| 久久99久久久久久久久久久| 麻豆精品一区二区综合av| 精品亚洲成a人在线观看| 精品一区二区三区的国产在线播放| 久久99久久精品| 丁香激情综合五月| 91农村精品一区二区在线| 欧美最猛黑人xxxxx猛交| 欧美日韩精品电影| 精品国产电影一区二区| 欧美国产亚洲另类动漫| 亚洲精品视频在线观看免费| 日韩成人免费在线| 国产精品1区二区.| 99精品视频一区| 欧美电影在线免费观看| 国产日韩精品一区| 亚洲色图在线看| 偷拍一区二区三区四区| 国产中文字幕一区| 97精品久久久午夜一区二区三区| 欧美美女视频在线观看| 欧美sm美女调教| 一区二区中文字幕在线| 天天影视涩香欲综合网| 国产麻豆精品在线| 欧美午夜一区二区三区| xnxx国产精品| 1024国产精品| 青青草原综合久久大伊人精品| 成人午夜伦理影院| 欧美年轻男男videosbes| 久久久99精品免费观看不卡| 亚洲成人三级小说| 国产乱子伦视频一区二区三区 | 国内精品久久久久影院薰衣草 | 欧美白人最猛性xxxxx69交| 亚洲国产精品成人综合| 午夜精品久久久久久久 | www.色精品| 欧美一区二区日韩| 1000精品久久久久久久久| 日本一不卡视频| 不卡av电影在线播放| 91精品国产丝袜白色高跟鞋| 国产精品久久久久久久久免费相片 | 欧美日韩国产片| 国产精品久久二区二区| 日韩av午夜在线观看| 一本色道久久综合狠狠躁的推荐| 久久综合成人精品亚洲另类欧美| 亚洲高清免费视频| 不卡高清视频专区| 欧美精品一区二区三区很污很色的| 一区二区三区精密机械公司| 国产成人精品亚洲777人妖| 欧美一级一区二区| 亚洲午夜国产一区99re久久| 成人黄色免费短视频| 精品国产91洋老外米糕| 亚洲成人黄色影院| 91福利国产精品| 亚洲欧洲日产国码二区| 国内精品免费**视频| 日韩美女主播在线视频一区二区三区| 亚洲另类春色国产| 91在线播放网址| 国产精品久久福利| 成人精品在线视频观看| 精品国产乱码久久久久久夜甘婷婷| 亚洲国产日韩综合久久精品| 91麻豆视频网站| 日韩一区日韩二区| 99久久久久免费精品国产| 国产欧美日韩三级| 国产一区视频导航| 欧美大片在线观看| 激情综合网最新| 日韩精品在线一区| 久久www免费人成看片高清| 欧美一区二区三区小说| 日韩高清一区在线| 欧美一区二区免费视频| 麻豆精品视频在线观看视频| 欧美一区午夜视频在线观看| 蜜芽一区二区三区| 日韩视频免费观看高清完整版在线观看 | 免费视频一区二区| 欧美一激情一区二区三区| 日韩av不卡在线观看| 欧美一区二区视频在线观看 | 日本特黄久久久高潮| 欧美嫩在线观看| 麻豆精品国产91久久久久久| 日韩精品影音先锋| 国产成人高清在线| 中文字幕人成不卡一区| 91国偷自产一区二区三区成为亚洲经典 | 欧美在线免费观看视频| 亚洲国产日日夜夜| 日韩欧美一级在线播放| 精品无人区卡一卡二卡三乱码免费卡 | 久久久国产一区二区三区四区小说 | 欧美日韩另类一区| 日本怡春院一区二区| 久久久久久久久久久久久久久99 | 91国产丝袜在线播放|