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

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

?? gui_fillpolygon.c

?? 這套代碼已經(jīng)成功一直到S3C44B0X開發(fā)板上
?? C
字號:
/*
*********************************************************************************************************
*                                                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 = 0;
  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;
}

/*********************************************************************
*
*       Public 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);
  }  
}

/*********************************************************************
*
*       GUI_FillPolygon
*/
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();
}

/*************************** End of file ****************************/

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品欧美一区二区三区精品久久| 91精品福利在线| 久久久另类综合| 国产精品亚洲视频| 国产精品视频看| av午夜精品一区二区三区| 一区二区三区小说| 欧美日韩黄色影视| 韩国av一区二区三区四区| 中文字幕国产精品一区二区| 99精品视频在线观看| 一区二区欧美视频| 欧美一级理论性理论a| 国内精品自线一区二区三区视频| 国产欧美日韩精品在线| 91麻豆文化传媒在线观看| 亚洲成人tv网| 久久人人97超碰com| 91麻豆国产自产在线观看| 午夜成人免费视频| 国产日韩欧美在线一区| 欧洲视频一区二区| 精品一区二区精品| 亚洲精品国久久99热| 日韩精品中文字幕一区二区三区| 国产成人av一区二区三区在线观看| 自拍视频在线观看一区二区| 日韩一区二区三区视频在线| 波多野结衣中文字幕一区二区三区| 五月综合激情网| 亚洲欧洲99久久| 日韩精品一区在线| 91极品美女在线| 顶级嫩模精品视频在线看| 亚洲国产精品久久久男人的天堂| 久久精品一区二区三区不卡| 欧美三级电影网| 99国产一区二区三精品乱码| 日韩中文字幕av电影| 亚洲欧美一区二区在线观看| 日韩欧美中文字幕一区| 色婷婷亚洲一区二区三区| 九九精品一区二区| 日韩国产精品久久久久久亚洲| 亚洲欧洲日韩综合一区二区| 欧美精品一区二区三区一线天视频| 91在线视频观看| 国产成人综合在线观看| 麻豆成人久久精品二区三区红 | 亚洲人成在线播放网站岛国| 日韩一级黄色片| 欧美日韩久久久久久| 99久久亚洲一区二区三区青草| 裸体一区二区三区| 亚洲成国产人片在线观看| 国产精品久99| 欧美激情自拍偷拍| 久久久亚洲午夜电影| 日韩美一区二区三区| 欧美剧情片在线观看| 欧美影院一区二区| 91色视频在线| 91小宝寻花一区二区三区| 高清国产午夜精品久久久久久| 韩日精品视频一区| 久久99国产乱子伦精品免费| 美女免费视频一区二区| 日韩av一级电影| 丝袜美腿亚洲一区二区图片| 亚洲成a人片在线观看中文| 亚洲欧美激情插 | 另类小说色综合网站| 丝袜亚洲另类欧美| 日韩精品一区第一页| 亚洲福利视频导航| 午夜激情综合网| 日韩av一级电影| 老司机一区二区| 国产精品一二三区| 成人av网在线| 日韩一级片网址| 中文字幕一区二区三区蜜月| 久久亚洲春色中文字幕久久久| 精品日韩一区二区三区免费视频| 欧美α欧美αv大片| 91久久奴性调教| 99免费精品视频| 91色在线porny| 欧美伊人精品成人久久综合97| 91久久精品网| 91精品中文字幕一区二区三区| 欧美丰满一区二区免费视频 | 亚洲一区日韩精品中文字幕| 亚洲老司机在线| 婷婷丁香久久五月婷婷| 捆绑调教美女网站视频一区| 国产精品原创巨作av| 成人动漫在线一区| 欧美视频在线一区| 日韩欧美黄色影院| 国产欧美一区视频| 亚洲乱码中文字幕| 日本网站在线观看一区二区三区 | 欧美日本乱大交xxxxx| 91精品久久久久久久91蜜桃| 久久欧美中文字幕| 亚洲免费观看在线视频| 水蜜桃久久夜色精品一区的特点| 免费成人av资源网| 99久久久国产精品| 91精品国产免费| 欧美激情在线一区二区| 亚洲一区二区三区在线看| 久久国内精品自在自线400部| 成人免费高清在线观看| 欧美巨大另类极品videosbest| 2024国产精品视频| 亚洲夂夂婷婷色拍ww47| 国产资源在线一区| 欧美少妇xxx| 国产欧美精品一区aⅴ影院| 亚洲一区二区高清| 国产成人亚洲综合色影视| 欧美日韩三级视频| 国产精品久久久久久久久免费桃花 | 精品久久久久久亚洲综合网| 中文字幕一区二区三| 美国精品在线观看| 日本韩国欧美在线| 国产丝袜欧美中文另类| 午夜一区二区三区视频| 波多野结衣中文字幕一区| 日韩美一区二区三区| 亚洲国产精品精华液网站| 成人毛片视频在线观看| 欧美成人高清电影在线| 午夜影视日本亚洲欧洲精品| 成人av综合在线| 久久精品亚洲精品国产欧美kt∨ | 久久精品无码一区二区三区| 婷婷综合五月天| 色婷婷av一区二区| 中文字幕成人av| 国产乱妇无码大片在线观看| 91精品国产色综合久久ai换脸| 一区二区三区小说| 91麻豆6部合集magnet| 中文字幕第一区| 国产成人欧美日韩在线电影| 欧美大黄免费观看| 六月丁香婷婷久久| 欧美一级一区二区| 日韩精品乱码免费| 欧美精品高清视频| 亚洲成年人影院| 欧美日韩精品三区| 亚洲va韩国va欧美va| 欧美在线不卡视频| 亚洲一区二区美女| 在线观看亚洲一区| 亚洲国产精品欧美一二99| 在线观看国产91| 午夜精品久久久久影视| 欧美日韩精品一区二区天天拍小说 | 欧美日韩国产成人在线91| 亚洲永久免费视频| 欧美日韩国产欧美日美国产精品| 亚洲愉拍自拍另类高清精品| 欧美专区日韩专区| 午夜视黄欧洲亚洲| 日韩丝袜美女视频| 九一九一国产精品| 国产欧美视频在线观看| 成人听书哪个软件好| 国产精品国产三级国产aⅴ入口 | 成人影视亚洲图片在线| 国产精品天天看| 91色|porny| 亚洲香肠在线观看| 777午夜精品免费视频| 久久er99精品| 国产日韩成人精品| 色哟哟欧美精品| 日本不卡视频在线| 国产亚洲精品超碰| 91网站视频在线观看| 亚洲第四色夜色| 精品国产亚洲在线| zzijzzij亚洲日本少妇熟睡| 亚洲欧美另类久久久精品2019| 欧美日韩欧美一区二区| 免费高清成人在线| 国产精品美女久久福利网站| 色视频欧美一区二区三区| 日韩中文欧美在线| 国产精品网站导航| 91精品久久久久久久99蜜桃 | 精品999久久久| 99re免费视频精品全部| 日韩精品一二三四|