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

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

?? gui_fillpolygon.c

?? UC_GUI開發(fā)源代碼,里面含有范例,源文件
?? C
字號:
/*
*********************************************************************************************************
*                                             uC/GUI V3.98
*                        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一区二区三区免费野_久草精品视频
成人精品鲁一区一区二区| 国产乱码精品一区二区三| 成人午夜电影小说| 欧美xxx久久| 捆绑调教美女网站视频一区| 99视频热这里只有精品免费| 久久综合狠狠综合久久综合88| 日本特黄久久久高潮| 欧美精品一二三| 男人的天堂久久精品| 欧美色欧美亚洲另类二区| 亚洲在线一区二区三区| 在线观看免费一区| 国产偷v国产偷v亚洲高清| 国产乱码精品1区2区3区| 欧美mv日韩mv亚洲| 国模少妇一区二区三区| 久久综合给合久久狠狠狠97色69| 日本在线播放一区二区三区| 欧美一区二区在线免费观看| 美女视频黄 久久| 欧美精品一区二| 日韩一二三区不卡| 色综合中文综合网| 日韩一级视频免费观看在线| 五月婷婷欧美视频| 日韩三级免费观看| 国产另类ts人妖一区二区| 欧美变态tickling挠脚心| 韩国女主播成人在线观看| 国产欧美日韩三级| 91视视频在线直接观看在线看网页在线看| 日韩伦理免费电影| 欧美亚一区二区| 亚洲一区二区三区四区的| 91.com视频| 中文字幕中文字幕一区二区| 成熟亚洲日本毛茸茸凸凹| 制服丝袜中文字幕一区| 激情六月婷婷综合| 中文字幕欧美国产| 色偷偷成人一区二区三区91| 亚洲成人在线免费| 精品嫩草影院久久| 成人一级视频在线观看| 一区二区三区精品| 在线成人午夜影院| 久久99精品国产麻豆不卡| 日本一区二区三区国色天香| 欧美揉bbbbb揉bbbbb| 国产另类ts人妖一区二区| 一区二区欧美视频| 精品国产伦理网| 在线观看区一区二| 国产一区视频导航| 一区2区3区在线看| 欧美蜜桃一区二区三区| 国产91富婆露脸刺激对白| 91麻豆自制传媒国产之光| 亚洲精品网站在线观看| 欧美成人欧美edvon| 一本色道久久综合亚洲aⅴ蜜桃| 免费看日韩a级影片| 亚洲欧美色图小说| 精品久久国产97色综合| 国产成人福利片| 夜夜精品视频一区二区| 国产校园另类小说区| 在线不卡免费av| 欧美一a一片一级一片| 国产精品99久久久久久久vr | 久久色中文字幕| 26uuu亚洲| 欧美中文字幕久久| 成人h版在线观看| 国产中文一区二区三区| 亚洲va韩国va欧美va| 中文字幕一区二区三区不卡在线 | 午夜精品福利一区二区三区av| 精品国产乱码久久久久久夜甘婷婷| 欧美日韩国产系列| 91在线小视频| av中文字幕不卡| 丁香激情综合国产| 黑人巨大精品欧美一区| 男女激情视频一区| 亚洲永久精品大片| 亚洲欧美日本韩国| 中文字幕亚洲电影| 中文字幕国产精品一区二区| 久久久青草青青国产亚洲免观| 欧美一区二区三区四区久久| 欧美三级电影网站| 欧美日韩国产a| voyeur盗摄精品| 国产最新精品免费| 极品销魂美女一区二区三区| 久久国产三级精品| 日产精品久久久久久久性色| 免费在线一区观看| 日韩国产欧美在线播放| 日韩精品久久久久久| 亚洲sss视频在线视频| 亚洲大型综合色站| 日日摸夜夜添夜夜添国产精品 | 日韩经典一区二区| 性久久久久久久| 免费的国产精品| 久久91精品国产91久久小草| 国产精品一区二区91| 国产精品影音先锋| 国产精品亚洲专一区二区三区| 丁香另类激情小说| 99精品国产一区二区三区不卡| 91影视在线播放| 欧洲激情一区二区| 91精品在线观看入口| 精品国产乱码久久久久久夜甘婷婷| 国产亚洲1区2区3区| 久久精品人人做人人综合| 亚洲欧洲www| 亚洲小少妇裸体bbw| 美女在线一区二区| 国产不卡视频一区| 91女人视频在线观看| 91网站视频在线观看| 欧美日韩国产综合久久| 日韩精品一区二区三区三区免费| 国产亚洲欧美日韩日本| 亚洲日穴在线视频| 日本不卡高清视频| 粉嫩av一区二区三区粉嫩| 91麻豆高清视频| 欧美一级久久久| 国产精品久久久久久亚洲伦| 五月婷婷欧美视频| 国产精品一区二区在线看| 91麻豆蜜桃一区二区三区| 日韩一区二区在线播放| 国产精品欧美久久久久一区二区| 国产一区二区三区精品视频| 欧美在线观看视频一区二区 | 中文字幕佐山爱一区二区免费| 亚洲1区2区3区4区| 91丝袜国产在线播放| 2021国产精品久久精品| 日韩精品亚洲专区| 在线观看网站黄不卡| 亚洲欧美一区二区视频| 国产精品456| 日韩写真欧美这视频| 亚洲一区二区三区美女| 91在线免费视频观看| 日本一区二区免费在线观看视频 | 国产91精品露脸国语对白| 91精品在线观看入口| 亚洲韩国一区二区三区| 9色porny自拍视频一区二区| 中日韩av电影| 成人免费视频app| 欧美激情一区不卡| 国产在线不卡一区| 日韩欧美国产小视频| 蜜桃视频免费观看一区| 91精品国产乱| 亚洲精品视频自拍| 欧美在线三级电影| 一区二区三区日韩欧美| 日本大香伊一区二区三区| 亚洲免费大片在线观看| 色婷婷精品久久二区二区蜜臀av | 国产麻豆一精品一av一免费 | 欧美大片日本大片免费观看| 日韩av成人高清| 欧美一级高清片在线观看| 奇米影视一区二区三区| 日韩欧美色综合| 国产精品综合av一区二区国产馆| 久久亚洲欧美国产精品乐播| 国产成人8x视频一区二区| 亚洲国产激情av| 91黄视频在线| 日韩不卡一区二区三区| 精品久久久网站| 国产伦精品一区二区三区免费迷| 久久久夜色精品亚洲| 国产91在线观看| 亚洲丝袜美腿综合| 欧美日韩你懂得| 激情成人午夜视频| 中文字幕的久久| 色噜噜狠狠成人中文综合| 亚洲成a天堂v人片| 日韩午夜精品电影| 国产成人精品影视| 亚洲美女视频在线观看| 日韩一区二区麻豆国产| 国模少妇一区二区三区| 亚洲欧美韩国综合色| 欧美伦理视频网站|