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

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

?? gui_fillpolygon.c

?? 使用coderwarrior打開 內含中文字庫
?? 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一区二区三区免费野_久草精品视频
欧洲精品在线观看| 久久久久久麻豆| 精品国产免费一区二区三区香蕉| 国产情人综合久久777777| 综合久久综合久久| 蜜臀av性久久久久蜜臀aⅴ流畅 | 丝袜美腿亚洲一区| 国产成人精品亚洲777人妖| 在线观看一区二区视频| 国产日韩v精品一区二区| 青椒成人免费视频| 欧美综合在线视频| 亚洲同性gay激情无套| 国内不卡的二区三区中文字幕| 精品视频在线看| 亚洲三级在线免费观看| 成人午夜精品在线| 久久青草国产手机看片福利盒子| 日韩国产精品91| 欧美性大战久久久| 一区二区三区不卡视频| 不卡电影一区二区三区| 日韩美女天天操| 五月天一区二区三区| 91视频你懂的| 日韩码欧中文字| 成人久久视频在线观看| 欧美高清在线精品一区| 国产精品中文欧美| 久久精品一区二区三区四区| 日韩av在线发布| 欧美日韩免费一区二区三区视频| 亚洲男同1069视频| 波多野结衣精品在线| 国产精品午夜电影| 99久久精品免费精品国产| 国产精品美女久久久久aⅴ| 韩日av一区二区| 久久九九99视频| 国产精品一区二区三区乱码| 久久久久久久电影| 丁香一区二区三区| 国产精品久久午夜| 色嗨嗨av一区二区三区| 亚洲一区二区在线观看视频| 色婷婷激情综合| 亚洲综合视频网| 91麻豆精品91久久久久同性| 日韩和欧美的一区| 精品久久一区二区三区| 久久99九九99精品| 国产日韩欧美电影| 99国产精品99久久久久久| 一区二区成人在线视频| 777午夜精品免费视频| 久久成人免费网| 久久久久久久久久久久久久久99 | 亚洲大型综合色站| 日韩丝袜情趣美女图片| 国产精品伊人色| 一区二区三区在线视频免费观看| 欧美日韩国产片| 国产美女视频91| 最新日韩av在线| 欧美欧美欧美欧美首页| 国内成人自拍视频| 一级日本不卡的影视| 日韩一区二区影院| 成人av免费在线观看| 亚洲国产精品久久人人爱蜜臀| 欧美一区二区成人| aaa欧美日韩| 青青草97国产精品免费观看| 中文一区一区三区高中清不卡| 欧美在线免费观看亚洲| 九九**精品视频免费播放| 亚洲欧美日韩一区二区| 欧美电影精品一区二区| 91美女在线看| 麻豆成人91精品二区三区| 欧美国产1区2区| 日韩一区二区在线看片| 成人看片黄a免费看在线| 免费国产亚洲视频| 亚洲欧美激情一区二区| 久久亚洲春色中文字幕久久久| 91蝌蚪porny| 国产精品伊人色| 久久精品国产一区二区| 亚洲精品菠萝久久久久久久| 国产亚洲欧美一区在线观看| 3atv一区二区三区| 色先锋资源久久综合| 国产精品99久久久久久宅男| 日日摸夜夜添夜夜添精品视频| 1024精品合集| 国产精品视频免费看| 精品剧情在线观看| 欧美一级黄色录像| 欧美三级午夜理伦三级中视频| 99精品热视频| 成人av网站在线| 国产成人免费网站| 国产一区二区调教| 久久精品国产99| 午夜不卡av免费| 一区二区三区在线观看欧美| 亚洲色图视频网站| 一色桃子久久精品亚洲| 国产色产综合色产在线视频| 久久久久久久久一| 国产调教视频一区| 久久久精品天堂| 久久精品无码一区二区三区| 日韩久久免费av| 日韩三级伦理片妻子的秘密按摩| 欧美日本国产一区| 91精品国产一区二区人妖| 欧美日本在线视频| 91精品国产麻豆国产自产在线 | 日韩午夜在线观看| 欧美日韩的一区二区| 欧美美女bb生活片| 欧美高清视频不卡网| 欧美老女人在线| 日韩午夜在线观看| 久久久精品免费网站| 国产亚洲欧美日韩俺去了| 久久精品亚洲国产奇米99| 国产精品久久久久四虎| 国产精品灌醉下药二区| 亚洲女与黑人做爰| 亚洲成av人**亚洲成av**| 婷婷国产v国产偷v亚洲高清| 日本中文字幕不卡| 国内精品伊人久久久久av影院| 国产麻豆精品视频| av电影在线观看一区| 色婷婷精品久久二区二区蜜臂av| 欧美日韩视频第一区| 精品av久久707| 国产精品国产三级国产有无不卡| 亚洲综合在线第一页| 蜜臀久久久99精品久久久久久| 国产麻豆欧美日韩一区| 色综合天天狠狠| 欧美一区二区免费| 国产午夜精品在线观看| 亚洲女同一区二区| 麻豆91小视频| bt7086福利一区国产| 欧美综合天天夜夜久久| 精品欧美一区二区久久| 国产精品国产自产拍在线| 亚洲一区二区三区视频在线| 精品一区二区三区免费毛片爱| 91丝袜美腿高跟国产极品老师| 欧美一a一片一级一片| 精品福利视频一区二区三区| 中文字幕日本不卡| 免费的成人av| 99re66热这里只有精品3直播| 91精品福利在线一区二区三区| 国产精品萝li| 美女久久久精品| 日本电影欧美片| 久久久久综合网| 调教+趴+乳夹+国产+精品| 粉嫩高潮美女一区二区三区| 在线91免费看| 亚洲欧美综合色| 国产精品一二一区| 欧美高清视频www夜色资源网| 国产精品久久三| 久久爱另类一区二区小说| 色综合久久综合网97色综合 | 国产在线一区观看| 欧美伊人精品成人久久综合97 | 国产最新精品免费| 欧美色图免费看| 亚洲色图在线视频| 成人性生交大片免费看中文网站| 欧美一区二区免费观在线| 亚洲国产人成综合网站| 99re这里只有精品首页| 久久久99久久| 国产一区二区三区不卡在线观看| 欧美二区乱c少妇| 亚洲一区二区三区中文字幕在线| 成人不卡免费av| 国产精品美女www爽爽爽| 国内偷窥港台综合视频在线播放| 日韩视频免费直播| 视频一区国产视频| 欧美日韩免费在线视频| 亚洲丰满少妇videoshd| 欧美嫩在线观看| 亚洲成人av一区| 91精品国产综合久久久蜜臀图片| 亚洲精品免费在线观看|