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

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

?? gui_fillpolygon.c

?? 這是我移植到GBA游戲機(jī)上的uCGUI3.24 可以通過模擬器仿真
?? C
字號(hào):
/*
*********************************************************************************************************
*                                                uC/GUI
*                        Universal graphic software for embedded applications
*
*                       (c) Copyright 2002, Micrium Inc., Weston, FL
*                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
*
*              礐/GUI is protected by international copyright laws. Knowledge of the
*              source code may not be used to write a similar product. This file may
*              only be used in accordance with a license and should not be redistributed
*              in any way. We appreciate your understanding and fairness.
*
----------------------------------------------------------------------
File        : GUI_FillPolygon.C
Purpose     : Fill polygon routine
---------------------------END-OF-HEADER------------------------------
*/


#include <stddef.h>           /* needed for definition of NULL */
#include "GUI_Protected.h"
#include "GUIDebug.h"



/********************************************************
*
*       defines, Configs
*
*********************************************************
*/

#define GUI_FP_MAXCOUNT 12

/********************************************************
*
*        static data
*
*********************************************************
*/
static int GL_FP_Cnt;
static I16 _aX[GUI_FP_MAXCOUNT];


/********************************************************
*
*        static code
*
*********************************************************
*/

/********************************************************
*
*        _DrawHLine
*/
static void _DrawHLine(int x0, int y, int x1) {
  if (x0 < x1) {
    LCD_HL_DrawHLine(x0, y, x1);
  } else {
    LCD_HL_DrawHLine(x1, y, x0);
  }
}


/********************************************************
*
*        _CheckYInterSect

  This function returns the x-coordinate of the intersection
  of the given line at the given y-coordinate.
  If there is no intersection, GUI_XMAX is returned.
  This routine does not work for horizontal lines, as there
  would be more than a single point as intersection. This situation
  needs to be checked prior to calling the routine.
  Returns:
    0 if no intersection
    1 if we have an intersection
*/
static int _CheckYInterSect(int y, int* px, const GUI_POINT*paPoint0, const GUI_POINT*paPoint1) {
  int x0, y0, x1, y1;
  if (paPoint0->y <= (paPoint1)->y) {
    y0 = paPoint0->y;
    if (y0 > y)      /* Check if there is an intersection ... (early out) */
      return 0;
    y1 = paPoint1->y;
    if (y1 < y)      /* Check if there is an intersection ... (early out) */
      return 0;
    x0 = paPoint0->x;
    x1 = paPoint1->x;
  } else {
    y0 = paPoint1->y;
    if (y0 > y)      /* Check if there is an intersection ... (early out) */
      return 0;
    y1 = paPoint0->y;
    if (y1 < y)      /* Check if there is an intersection ... (early out) */
      return 0;
    x0 = paPoint1->x;
    x1 = paPoint0->x;
  }
/* Calculate intersection */
  {
    I32 Mul = (I32)(x1 - x0) * (I32)(y - y0);
    if (Mul > 0) {
      Mul += (y1 - y0) >> 1;	          /* for proper rounding */
    } else {
      Mul -= ((y1 - y0) >> 1) - 1;	    /* for proper rounding */
    }
    x0 += Mul / (y1 - y0);
  }
  *px = x0;
  return 1;
} 


/********************************************************
*
*        _Add

  This function adds a point into the sorted array
*/
static void _Add(int x) {
  if (GL_FP_Cnt < GUI_FP_MAXCOUNT) {
    int i;
    /* Move all entries to the right (bigger x-value) */
    for (i=GL_FP_Cnt; i ; i--) {
      if (_aX[i-1] < x)
        break;
      _aX[i] = _aX[i-1];
    }
    /* Insert new entry */
    _aX[i]    = x;
    GL_FP_Cnt++;
  }
}


/********************************************************
*
*        _Init

  This function initialise the sorted array
*/
static void _Init(void) {
  GL_FP_Cnt = 0;
}


/********************************************************
*
*        _Flush

  This function draw lines between points in the array
*/
static void _Flush(int x0, int y) {
  int i, x;
  char On=0;
  for (i=0; i<GL_FP_Cnt; i++) {
    int xNew = _aX[i];
    if (On) {
      LCD_HL_DrawHLine(x0 + x, y, x0 + xNew);
    }
    On ^= 1;
    x = xNew;
  }
}


/********************************************************
*
*        _AddPoint

  This function decides either if there a V-point or a
  X-point. An X-point is added to the array, a V-point
  is drawn.
*/
static void _AddPoint(int x, int y, int y0, int y1, int xOff, int yOff) {
  if ((y0 ^ y1) >= 0) {
    x += xOff;
    LCD_HL_DrawHLine(x, y + yOff, x);    // V-point, not crossing the polygon
  } else {
    _Add(x);
  }
}


/********************************************************
*
*        _GetPrevPointDiffy

  Find previous point which is not on the same height
*/
static int _GetPrevPointDiffy(const GUI_POINT* paPoint, int i,
                              const int NumPoints, const int y0) {
  int j, y1;
  for (j = 0; j < (NumPoints - 1) ; j++) {
    i = (i != 0) ? i - 1 : NumPoints - 1;
    y1 = (paPoint + i)->y;
    if (y1 != y0) {
      return y1;
    }
  }
  return y0;
}


/********************************************************
*
*        code
*
*********************************************************
*/

/********************************************************
*
*        GL_FillPolygon

  This function calculates the polygon
*/
void GL_FillPolygon  (const GUI_POINT*paPoint, int NumPoints, int xOff, int yOff) {
  int i, y;
  int yMin = GUI_YMAX;
  int yMax = GUI_YMIN;
/* First step : find uppermost and lowermost coordinates */
  for (i=0; i<NumPoints; i++) {
    y = (paPoint + i)->y;
    if (y < yMin)
      yMin = y;
    if (y > yMax)
      yMax = y;
  }
/* Use Clipping rect to reduce calculation (if possible) */
  if (GUI_Context.pClipRect_HL) {
    if (yMax > (GUI_Context.pClipRect_HL->y1 - yOff))
      yMax = (GUI_Context.pClipRect_HL->y1 - yOff);
    if (yMin < (GUI_Context.pClipRect_HL->y0 - yOff))
      yMin = (GUI_Context.pClipRect_HL->y0 - yOff);
  }
/* Second step: Calculate and draw horizontal lines */
  for (y=yMin; y<=yMax; y++) {
    _Init();
    /* find next intersection and count lines*/
    for (i=0; i<NumPoints; i++) {
      int i1 = (i < (NumPoints - 1)) ? i + 1 : 0;
      int y0 = (paPoint + i )->y;
      int y1 = (paPoint + i1)->y;
      /* Check if starting point is on line */
      if (y0 == y) {
        if (y1 == y) {  /* Add the entire line */
          _DrawHLine((paPoint + i )->x + xOff , y + yOff, (paPoint + i1)->x + xOff);
        } else {        /* Add only one point */
          int yPrev = _GetPrevPointDiffy(paPoint, i, NumPoints, y);
          if (yPrev != y) {
            _AddPoint((paPoint + i)->x, y, yPrev - y, y1 - y, xOff, yOff);
          } 
        }
      } else if (y1 != y) {  /* Ignore if end-point is on the line */
        if (((y1 >= y) && (y0 <= y)) || ((y0 >= y) && (y1 <= y))) {
          int xIntersect;
          if (_CheckYInterSect(y, &xIntersect, paPoint + i, paPoint + i1)) {
            _Add(xIntersect);
          }
        }
      }
    }
    _Flush(xOff, y + yOff);
  }  
}

void GUI_FillPolygon  (const GUI_POINT* pPoints, int NumPoints, int x0, int y0) {
  GUI_LOCK();
  #if (GUI_WINSUPPORT)
    WM_ADDORG(x0,y0);
    WM_ITERATE_START(NULL); {
  #endif
  GL_FillPolygon (pPoints, NumPoints, x0, y0);
  #if (GUI_WINSUPPORT)
    } WM_ITERATE_END();
  #endif
  GUI_UNLOCK();
}


?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品福利视频网站| 成人欧美一区二区三区在线播放| 99视频一区二区| 国产精品1024久久| 国产成人在线电影| 成人午夜电影久久影院| 丁香婷婷综合激情五月色| 国产91精品一区二区麻豆网站| 极品尤物av久久免费看| 国产精品影视在线观看| 国产成人免费视频网站高清观看视频 | 欧美特级限制片免费在线观看| 91亚洲精华国产精华精华液| 91美女在线看| 欧美在线影院一区二区| 666欧美在线视频| 91精品欧美一区二区三区综合在| 日韩一区二区三区精品视频| 精品国产一区二区三区忘忧草 | 一本大道综合伊人精品热热| 色老头久久综合| 这里是久久伊人| 国产亚洲综合色| 日韩理论电影院| 蜜臀久久99精品久久久久宅男| 精品制服美女丁香| 不卡电影免费在线播放一区| 一本色道**综合亚洲精品蜜桃冫| 欧美日免费三级在线| 精品乱人伦小说| 国产精品久久毛片a| 亚洲一区二区三区中文字幕 | 日本高清不卡一区| 欧美一区二区黄| 国产精品视频线看| 免费精品视频最新在线| 成人做爰69片免费看网站| 欧美视频第二页| 国产日韩av一区| 日韩高清不卡一区| 99久久伊人久久99| 久久亚洲综合色一区二区三区| 亚洲免费伊人电影| 国产激情一区二区三区| 欧美日韩国产a| 国产欧美一区二区精品性色| 日韩激情中文字幕| 在线精品视频免费播放| 国产清纯白嫩初高生在线观看91 | 丁香一区二区三区| 91精品在线观看入口| 亚洲免费在线看| 懂色av中文一区二区三区| 日韩一区二区电影在线| 亚洲激情自拍偷拍| 成人性生交大片| 精品av综合导航| 日本成人在线看| 欧美三级电影网| 亚洲精品免费视频| 国产电影精品久久禁18| 欧美mv日韩mv国产网站app| 亚洲一区二区三区视频在线播放| 成人小视频免费在线观看| 欧美zozo另类异族| 久久国内精品自在自线400部| 欧美三级乱人伦电影| 亚洲尤物在线视频观看| 色综合一区二区三区| 国产精品卡一卡二卡三| 精品一二三四区| 欧美成人video| 青青草97国产精品免费观看无弹窗版| 91极品美女在线| 亚洲第一av色| 欧美卡1卡2卡| 男女男精品视频| 精品伦理精品一区| 国产精品影视天天线| 国产亚洲美州欧州综合国| 国产盗摄视频一区二区三区| 国产亚洲自拍一区| 丁香一区二区三区| 亚洲人成小说网站色在线| 一本一道久久a久久精品| 亚洲人一二三区| 欧美日本韩国一区| 老司机精品视频在线| 国产网站一区二区三区| 成人黄色国产精品网站大全在线免费观看| 中文字幕乱码日本亚洲一区二区| 国产成人超碰人人澡人人澡| 国产精品拍天天在线| 在线观看一区二区精品视频| 日本中文在线一区| 久久久三级国产网站| 北条麻妃一区二区三区| 一区二区在线电影| 欧美成人官网二区| 成人自拍视频在线观看| 亚洲午夜精品久久久久久久久| 欧美疯狂性受xxxxx喷水图片| 美女网站视频久久| 成人欧美一区二区三区视频网页| 欧美日韩中文字幕一区二区| 久久99精品久久只有精品| 国产婷婷色一区二区三区在线| 91视频.com| 青椒成人免费视频| 亚洲视频一区二区在线观看| 69堂成人精品免费视频| 懂色av中文一区二区三区| 亚洲成人黄色小说| 中文字幕精品在线不卡| 欧美自拍丝袜亚洲| 国产精品99精品久久免费| 午夜在线成人av| 国产欧美一区二区精品久导航| 在线免费观看成人短视频| 国内精品第一页| 亚洲一区二区三区四区在线观看| xf在线a精品一区二区视频网站| 在线欧美日韩精品| 国产成人精品亚洲777人妖| 亚洲成a人v欧美综合天堂| 中文字幕一区二区三区色视频| 欧美一级二级在线观看| 色哟哟国产精品| 国产99久久久国产精品潘金| 日本在线播放一区二区三区| 成人欧美一区二区三区视频网页| 欧美精品一区二区三区一线天视频 | 欧美日韩另类国产亚洲欧美一级| 国产精品亚洲专一区二区三区| 五月激情六月综合| 亚洲小说春色综合另类电影| 日韩理论电影院| 国产精品私人影院| 国产偷国产偷亚洲高清人白洁 | 欧美天堂一区二区三区| 91视频在线观看| 99久久国产综合精品色伊| 国产风韵犹存在线视精品| 国产一区不卡精品| 麻豆精品视频在线观看视频| 亚洲777理论| 婷婷综合在线观看| 五月天中文字幕一区二区| 亚洲国产成人va在线观看天堂| 亚洲日本一区二区三区| 国产精品毛片无遮挡高清| 国产精品久久久久永久免费观看 | 91精品国产免费| 欧美人与性动xxxx| 7777精品伊人久久久大香线蕉超级流畅| 欧美在线视频不卡| 欧美日韩电影在线播放| 欧美一级生活片| 日韩欧美亚洲一区二区| 久久久亚洲精品一区二区三区| 久久久另类综合| 国产精品高潮呻吟久久| 亚洲日本va午夜在线影院| 亚洲综合网站在线观看| 五月天精品一区二区三区| 蜜桃视频免费观看一区| 国模大尺度一区二区三区| 国产+成+人+亚洲欧洲自线| 99精品视频中文字幕| 欧美性猛交xxxxxx富婆| 91精品国产免费久久综合| 2021久久国产精品不只是精品| 亚洲国产精品激情在线观看| 亚洲精品免费看| 麻豆精品国产91久久久久久| 国产精品一区免费在线观看| 91丨九色丨国产丨porny| 在线看一区二区| 久久先锋影音av鲁色资源网| 中文字幕在线观看一区| 亚洲一区二区三区四区五区中文| 蜜桃久久久久久| 97久久超碰国产精品电影| 91麻豆精品国产91久久久更新时间 | 在线视频国产一区| 日韩精品一区二区三区中文不卡| 日本一区二区视频在线观看| 亚洲伊人色欲综合网| 精品亚洲国产成人av制服丝袜 | 亚洲va欧美va国产va天堂影院| 久久国产精品99精品国产| 成人av网址在线| 欧美精品 国产精品| 国产精品色婷婷久久58| 日本视频一区二区| 99久久综合国产精品| 欧美一级艳片视频免费观看| 亚洲色图色小说| 国产精品一区免费在线观看| 欧美人妇做爰xxxⅹ性高电影|