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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? gui_fillpolygon.c

?? Keil C下通過(guò)的UCGUI,UCGUI的移植源代碼
?? 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\Core\GUI_Protected.h"
#include "gui\Core\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();
}


?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
高清成人免费视频| 亚洲国产中文字幕| 日本特黄久久久高潮| 国产精品资源在线观看| 欧美日韩三级一区| 中文字幕成人在线观看| 蜜桃一区二区三区四区| 欧美视频日韩视频在线观看| 国产精品久久久久久妇女6080| 日韩1区2区日韩1区2区| 在线免费观看不卡av| 中文字幕二三区不卡| 精品午夜久久福利影院| 欧美美女一区二区在线观看| 一区精品在线播放| 国产麻豆91精品| 日韩美女在线视频| 婷婷久久综合九色综合伊人色| av不卡在线播放| 欧美激情自拍偷拍| 国产一区二区三区免费| 日韩欧美亚洲一区二区| 午夜精品福利在线| 色av一区二区| 一区二区三区日韩欧美精品 | 国产无一区二区| 久久激情五月激情| 日韩一区二区三区四区| 首页亚洲欧美制服丝腿| 欧美日韩视频不卡| 午夜视频在线观看一区二区三区| 91成人在线免费观看| 亚洲精品免费在线观看| 不卡一区二区在线| 国产精品三级av在线播放| 成人免费精品视频| 中文字幕精品三区| 99免费精品视频| 最新不卡av在线| 成人黄色免费短视频| 国产精品无码永久免费888| 国产凹凸在线观看一区二区| 久久久久久久av麻豆果冻| 国产制服丝袜一区| 国产亚洲综合av| 国产精品一区不卡| 国产日韩综合av| 国产麻豆一精品一av一免费| 久久精品一二三| 丁香五精品蜜臀久久久久99网站| 亚洲国产精品99久久久久久久久| 成人涩涩免费视频| 18成人在线视频| 99久精品国产| 亚洲精品久久久久久国产精华液| 91在线精品一区二区| 一片黄亚洲嫩模| 欧美日韩不卡一区二区| 欧美日韩精品欧美日韩精品一 | 亚洲午夜av在线| 欧美精品电影在线播放| 喷白浆一区二区| 久久尤物电影视频在线观看| 粉嫩av亚洲一区二区图片| 成人免费一区二区三区在线观看| 欧美中文字幕不卡| 青椒成人免费视频| 国产午夜精品一区二区三区视频 | 青青草91视频| 国产日韩欧美精品电影三级在线| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 色成人在线视频| 青青草91视频| 国产精品欧美一区二区三区| 精品一区二区免费看| 久久久欧美精品sm网站| 免费一级欧美片在线观看| 精品国产伦一区二区三区观看体验| 91麻豆精品91久久久久同性| 亚洲一本大道在线| 欧美成人精品二区三区99精品| 91国偷自产一区二区使用方法| 国产精一区二区三区| 亚洲亚洲精品在线观看| 国产精品欧美一区二区三区| 日韩精品一区二区三区四区视频| 色婷婷av一区二区三区之一色屋| 国产在线精品视频| 亚洲夂夂婷婷色拍ww47| 精品久久免费看| 在线免费一区三区| 处破女av一区二区| 激情另类小说区图片区视频区| 亚洲一区二区视频| 国产精品国产三级国产a| 精品日韩成人av| 欧美日本一区二区三区四区| 色哟哟精品一区| www.爱久久.com| 国产成人av电影在线| 欧美aa在线视频| 丝袜亚洲另类欧美| 一区二区三区精品在线观看| 国产精品嫩草影院av蜜臀| 精品国产123| 欧美一区二区在线免费观看| 欧美怡红院视频| 91色.com| av色综合久久天堂av综合| 国产精品77777| 精品在线播放午夜| 正在播放亚洲一区| 欧美日韩一区二区三区免费看| 99久久精品国产麻豆演员表| 国产99久久久精品| 国产98色在线|日韩| 国产精品主播直播| 国产电影一区在线| 国产麻豆精品在线观看| 国产一区二区三区在线看麻豆| 欧美aaaaa成人免费观看视频| 天天av天天翘天天综合网| 亚洲一区二区三区免费视频| 一区二区三区国产精华| 亚洲免费av网站| 亚洲男人的天堂在线aⅴ视频 | 欧美巨大另类极品videosbest | 欧美一区二区三区电影| 欧美一区日本一区韩国一区| 91麻豆精品久久久久蜜臀| 欧美一区二区三区爱爱| 91精品国产91热久久久做人人| 在线成人高清不卡| 欧美一区二区三区四区视频| 日韩欧美一区二区在线视频| 欧美不卡视频一区| 久久综合99re88久久爱| 久久久久久免费| 中文字幕av不卡| 中文字幕在线不卡| 亚洲乱码精品一二三四区日韩在线| 亚洲欧美日韩国产另类专区| 亚洲精品午夜久久久| 亚洲动漫第一页| 日韩黄色片在线观看| 另类小说色综合网站| 国产一区二区不卡| 风间由美一区二区av101| 成人精品视频一区二区三区| 91视视频在线直接观看在线看网页在线看| 色域天天综合网| 欧美高清dvd| 精品999久久久| 欧美国产视频在线| 亚洲男人都懂的| 丝袜美腿高跟呻吟高潮一区| 另类小说综合欧美亚洲| 国产成人超碰人人澡人人澡| 99精品国产视频| 欧美伊人久久久久久久久影院| 91精品国产一区二区三区蜜臀 | 久久综合色婷婷| 国产精品久久久久天堂| 一区二区三区影院| 日本aⅴ精品一区二区三区| 精品在线免费观看| 成人久久久精品乱码一区二区三区| 91麻豆免费在线观看| 91精品国产手机| 久久久精品天堂| 亚洲女子a中天字幕| 日韩电影免费在线看| 男男视频亚洲欧美| 日本一区二区三区电影| 国产精品第四页| 午夜精品成人在线| 韩国毛片一区二区三区| 99re视频这里只有精品| 欧美日韩一级片网站| 久久综合九色综合欧美亚洲| 亚洲同性gay激情无套| 日本亚洲最大的色成网站www| 免费观看久久久4p| 成人黄色国产精品网站大全在线免费观看| 91成人免费在线| 久久品道一品道久久精品| 亚洲最新视频在线观看| 国产一区二区三区免费观看| 欧美在线免费观看亚洲| 久久无码av三级| 亚洲国产人成综合网站| 久久丁香综合五月国产三级网站| 91香蕉视频mp4| 精品国产免费人成在线观看| 亚洲美女在线国产| 精品亚洲成a人| 欧美日韩在线电影| 国产精品女人毛片| 美女mm1313爽爽久久久蜜臀| 色综合久久中文字幕|