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

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

?? gui_fillpolygon.c

?? ucgui源碼3.32
?? 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;
  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();
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本久久电影网| 亚洲一本大道在线| 久久精品国产亚洲高清剧情介绍 | 五月婷婷激情综合| 欧洲一区二区三区在线| 日韩毛片精品高清免费| 国产精品自拍三区| 欧美精品一区二区三区在线播放| 午夜精品久久久久影视| 欧美午夜影院一区| 三级久久三级久久久| 在线看国产日韩| 日韩中文字幕av电影| 精品国产不卡一区二区三区| 国产精品影音先锋| 日本一区二区三区dvd视频在线| 国产a视频精品免费观看| 国产亚洲一区二区三区| 成人av网站免费| 中文字幕综合网| 在线亚洲人成电影网站色www| 一区二区三区蜜桃| 欧美一级高清片在线观看| 久久99精品国产.久久久久| 国产欧美日韩综合精品一区二区| 国产v日产∨综合v精品视频| 日韩亚洲欧美高清| 日韩av中文字幕一区二区 | 91啪九色porn原创视频在线观看| 亚洲视频一区二区在线观看| 日本高清免费不卡视频| 午夜精品免费在线| 欧美经典三级视频一区二区三区| 99精品久久免费看蜜臀剧情介绍| 亚洲精品ww久久久久久p站| 成人国产精品免费观看视频| 国产精品看片你懂得| 欧亚洲嫩模精品一区三区| 蜜臀久久99精品久久久画质超高清| 欧美一区二区私人影院日本| 国产一区二区三区免费播放| 国产精品国产a级| 欧美综合天天夜夜久久| 久久电影网电视剧免费观看| 国产精品天美传媒| 欧美日韩国产首页| 风流少妇一区二区| 一区二区三区在线影院| 日韩视频在线观看一区二区| 波多野结衣中文字幕一区二区三区 | 日韩成人dvd| 中文字幕一区二区5566日韩| 欧美丰满少妇xxxbbb| 成人一区二区视频| 亚洲精品久久嫩草网站秘色| 精品精品欲导航| 91九色02白丝porn| 蜜桃视频在线观看一区二区| 国产精品私房写真福利视频| 日韩一区二区精品葵司在线| 成人网页在线观看| 日韩va亚洲va欧美va久久| 亚洲色图在线看| 久久久欧美精品sm网站| 欧美三区免费完整视频在线观看| 国产剧情一区二区| 日韩电影在线一区| 亚洲欧美电影一区二区| 日韩欧美国产综合| 欧美亚洲国产怡红院影院| 国产精品一二一区| 免费成人深夜小野草| 亚洲午夜电影在线观看| 中文字幕av一区二区三区高 | 日韩精品一级中文字幕精品视频免费观看 | 大白屁股一区二区视频| 麻豆成人av在线| 亚洲国产乱码最新视频 | 国产精品911| 黄色日韩网站视频| 久久国产剧场电影| 亚洲国产精品一区二区久久 | 亚洲精品视频在线| 亚洲国产精品激情在线观看| 欧美xxxx老人做受| 日韩精品综合一本久道在线视频| 欧美亚洲综合久久| 欧美性色黄大片| 色综合天天综合网国产成人综合天 | 一本色道久久综合亚洲91| 粉嫩欧美一区二区三区高清影视| 亚洲妇熟xx妇色黄| 亚洲大片在线观看| 亚洲一区二区三区视频在线播放| 亚洲高清在线精品| 日日夜夜一区二区| 五月天久久比比资源色| 亚洲午夜日本在线观看| 中文字幕一区二区三区蜜月| 国产精品福利电影一区二区三区四区| 久久人人爽人人爽| 日本一区二区电影| 久久久亚洲综合| 国产欧美日韩精品在线| 日韩欧美色综合| 久久综合九色综合97_久久久| 欧美刺激脚交jootjob| 欧美日韩一二三区| 欧美一级精品在线| 久久精品亚洲精品国产欧美| 久久综合狠狠综合久久综合88| 欧美一区二视频| 精品久久久久久久人人人人传媒| 在线观看日韩高清av| 成人黄色小视频在线观看| 成人午夜免费电影| 欧美群妇大交群的观看方式 | 精品国产免费久久| 国产精品久久久久久久久久久免费看| 亚洲一区二区三区国产| 黑人巨大精品欧美黑白配亚洲| 99精品视频一区| 91精品国产免费久久综合| 国产精品久久久久久久久久久免费看| 偷窥国产亚洲免费视频| 不卡高清视频专区| 精品美女一区二区三区| 一区二区在线电影| 国产福利一区二区三区| 欧美乱妇15p| 中文字幕亚洲一区二区va在线| 日韩成人一级大片| 一本到不卡精品视频在线观看| 精品久久久网站| 一区二区三区四区在线播放 | 精品一区二区三区在线播放视频| 91免费视频观看| 亚洲精品一区二区三区在线观看| 一区二区三区美女| 99免费精品在线| 久久久久久久网| 日日摸夜夜添夜夜添精品视频 | 北岛玲一区二区三区四区| 日韩欧美中文一区| 香蕉影视欧美成人| 99视频一区二区| 亚洲国产成人一区二区三区| 看电影不卡的网站| 51久久夜色精品国产麻豆| 日韩码欧中文字| 高清成人在线观看| 精品久久久网站| 美腿丝袜亚洲色图| 欧美日韩视频在线一区二区| 成人免费小视频| 成人aaaa免费全部观看| 久久影视一区二区| 激情综合色丁香一区二区| 欧美二区在线观看| 亚洲第一久久影院| 欧美性生活一区| 亚洲成人久久影院| 日本精品一区二区三区高清| 一区二区三区四区在线播放 | 亚洲成人激情av| 在线观看91视频| 亚洲综合999| 精品视频在线看| 性做久久久久久免费观看欧美| 精品视频999| 天天综合日日夜夜精品| 5858s免费视频成人| 青青草原综合久久大伊人精品| 欧美一卡二卡在线| 久久国产精品99久久人人澡| 亚洲精品在线电影| 国产不卡视频一区| 国产精品第13页| 在线观看视频欧美| 免费成人在线网站| 久久免费精品国产久精品久久久久| 国产精品一区二区在线看| 国产欧美一区二区精品久导航 | 国产不卡视频在线观看| 中文字幕一区二区三区蜜月| 色婷婷精品久久二区二区蜜臀av| 亚洲一级二级三级| 91精品国模一区二区三区| 国产一区在线视频| 自拍偷自拍亚洲精品播放| 欧美色图在线观看| 极品少妇一区二区三区精品视频 | 亚洲精品视频免费观看| 欧美日产在线观看| 精彩视频一区二区三区| 国产精品久久久久久妇女6080 | 欧美日韩免费一区二区三区| 另类小说欧美激情| 国产精品黄色在线观看| 欧美日韩一区二区三区四区五区|