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

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

?? draw-arc.c

?? 該文件為一個嵌入式GUI圖形庫源碼
?? C
字號:
/*
 *  ARC Drawing API
 *
 *
 *  COPYRIGHT (c) 2001 - 2010.
 *  emTech System Corporation.
 *
 *  The license and distribution terms for this file may be
 *  found in found in the file LICENSE.
 */

/*	Huangf emcore@263.net
 */

/*	Stolen from microwindows
 */
 
#include "emGUI.h"

/* argument holder for pie, arc and ellipse functions*/
typedef struct {
	WndID	wID;
	GID		gID;
	int		x0, y0;
	int		rx, ry;
	int		ax, ay;
	int		bx, by;
	int		adir, bdir;
	int		type;
} SLICE;

/*
 * Clip a line segment for arc or pie drawing.
 * Returns 0 if line is clipped or on acceptable side, 1 if it's vertically
 * on other side, otherwise 3.
 */
static int
clip_line(
	SLICE 	*slice, 
	int 	xe, 
	int 	ye, 
	int 	dir, 
	int 	y, 
	int 	*x0,
	int 	*x1
)
{
	/* hline on the same vertical side with the given edge? */
	if ((y >= 0 && ye >= 0) || (y < 0 && ye < 0)) {
		int x;

		if (ye == 0) x = xe; else
		x = (int)(long)xe * y / ye;

		if (x >= *x0 && x <= *x1) {
			if (dir > 0)
				*x0 = x;
			else
				*x1 = x;
			return 0;
		} else {
			if (dir > 0) {
				if (x <= *x0)
					return 0;
			} else {
				if (x >= *x1)
					return 0;
			}
		}
		return 3;
	}
	return 1;
}

/* relative offsets, direction from left to right. */
static void
draw_line(
	SLICE	*slice, 
	int 	x0, 
	int 	y, 
	int 	x1
)
{
	int	dbl = (slice->adir > 0 && slice->bdir < 0);
	int discard, ret;
	int	x2 = x0, x3 = x1;

	if (y == 0) {
		if (slice->type != GRPIE)
			return;
		/* edges on different sides */
		if ((slice->ay <= 0 && slice->by >= 0) ||
		    (slice->ay >= 0 && slice->by <= 0)) {
			if (slice->adir < 0)  {
				if (x1 > 0)
					x1 = 0;
			}
			if (slice->bdir > 0) {
				if (x0 < 0)
					x0 = 0;
			}
		} else {
			if (!dbl) {
				/* FIXME leaving in draws dot in center*/
				GrPoint(slice->wID, slice->gID, slice->x0, slice->y0);
				return;
			}
		}
		GrLine(slice->wID, slice->gID, slice->x0 + x0, slice->y0, slice->x0 + x1, slice->y0, TRUE);
		return;
	}

	/* clip left edge / line */
	ret = clip_line(slice, slice->ax, slice->ay, slice->adir, y, &x0, &x1);

	if (dbl) {
		if (!ret) {
			/* edges separate line to two parts */
			GrLine(
				slice->wID, 
				slice->gID,
				slice->x0 + x0, 
				slice->y0 + y,
				slice->x0 + x1,
				slice->y0 + y,
				TRUE
			);
			x0 = x2;
			x1 = x3;
		}
	} 
	else {
		if (ret > 1) {
			return;
		}
	}

	discard = ret;
	ret = clip_line(slice, slice->bx, slice->by, slice->bdir, y, &x0, &x1);

	discard += ret;
	if (discard > 2 && !(dbl && ret == 0 && discard == 3)) {
		return;
	}
	if (discard == 2) {
		/* line on other side than slice */
		if (slice->adir < 0 || slice->bdir > 0) {
			return;
		}
	}
	GrLine(
		slice->wID, 
		slice->gID,
		slice->x0 + x0, 
		slice->y0 + y,
		slice->x0 + x1, 
		slice->y0 + y,
		TRUE
	);
}

/* draw one line segment or set of points, called from drawarc routine*/
static void
drawarcsegment(SLICE *slice, int xp, int yp)
{
	switch (slice->type & 0x0f) {
		case GRELLIPSEFILL:
			/* draw ellipse fill segment*/
			GrLine(
				slice->wID, 
				slice->gID,
				slice->x0 - xp, 
				slice->y0 - yp,
				slice->x0 + xp, 
				slice->y0 - yp,
				TRUE
			);
			GrLine(
				slice->wID, 
				slice->gID,
				slice->x0 - xp, 
				slice->y0 + yp,
				slice->x0 + xp, 
				slice->y0 + yp,
				TRUE
			);
			return;

		case GRELLIPSE:
			/* set four points symmetrically situated around a point*/
			GrPoint(
				slice->wID, 
				slice->gID,
				slice->x0 + xp, 
				slice->y0 + yp
			);
			GrPoint(
				slice->wID, 
				slice->gID,
				slice->x0 - xp, 
				slice->y0 + yp
			);
			GrPoint(
				slice->wID, 
				slice->gID,
				slice->x0 + xp, 
				slice->y0 - yp
			);
			GrPoint(
				slice->wID, 
				slice->gID,
				slice->x0 - xp, 
				slice->y0 - yp
			);
			return;

		case GRPIE:
			/* draw top and bottom halfs of pie*/
			if (slice->type & GRLEFTTOP){
				draw_line(slice, -xp, -yp, 0);
			}
			if (slice->type & GRRIGHTTOP){
				draw_line(slice, 0, -yp, +xp);
			}
			if (slice->type & GRLEFTBOTTOM){
				draw_line(slice, -xp, +yp, 0);
			}	
			if (slice->type & GRRIGHTBOTTOM){
				draw_line(slice, 0, +yp, +xp);
			}	
			return;

		default:	/* GRARC, GRARCOUTLINE*/
			/* set four points symmetrically around a point and clip*/
			if (slice->type & GRRIGHTBOTTOM){
				draw_line(slice, +xp, +yp, +xp);
			}	
			if (slice->type & GRLEFTBOTTOM){
				draw_line(slice, -xp, +yp, -xp);
			}	
			if (slice->type & GRRIGHTTOP){
				draw_line(slice, +xp, -yp, +xp);
			}
			if (slice->type & GRLEFTTOP){
				draw_line(slice, -xp, -yp, -xp);
			}	
			return;
	}
}

/* General routine to plot points on an arc.  Used by arc, pie and ellipse*/
static void
drawarc(SLICE *slice)
{
	int xp, yp;		/* current point (based on center) */
	int rx, ry;
	long Asquared;		/* square of x semi axis */
	long TwoAsquared;
	long Bsquared;		/* square of y semi axis */
	long TwoBsquared;
	long d;
	long dx, dy;

	rx = slice->rx;
	ry = slice->ry;

	xp = 0;
	yp = ry;
	Asquared = rx * rx;
	TwoAsquared = 2 * Asquared;
	Bsquared = ry * ry;
	TwoBsquared = 2 * Bsquared;
	d = Bsquared - Asquared * ry + (Asquared >> 2);
	dx = 0;
	dy = TwoAsquared * ry;

	while (dx < dy) {
		drawarcsegment(slice, xp, yp);
		if (d > 0) {
			yp--;
			dy -= TwoAsquared;
			d -= dy;
		}
		xp++;
		dx += TwoBsquared;
		d += (Bsquared + dx);
	}

	d += ((3L * (Asquared - Bsquared) / 2L - (dx + dy)) >> 1);

	while (yp >= 0) {
		drawarcsegment(slice, xp, yp);
		if (d < 0) {
			xp++;
			dx += TwoBsquared;
			d += dx;
		}
		yp--;
		dy -= TwoAsquared;
		d += (Asquared - dy);
	}

}

/* 
 * Draw an arc or pie using start/end points.
 * Integer only routine.  To specify start/end angles, 
 * use GdArcAngle, which requires floating point.
 */
void
GrArc(
	WndID	wID, 
	GID		gID,
	int 	x0, 
	int 	y0, 
	int 	rx, 
	int 	ry,
	int 	ax, 
	int 	ay, 
	int 	bx, 
	int 	by, 
	int 	type
)
{
	int	adir, bdir;
	SLICE	slice;

	if (rx <= 0 || ry <= 0)
		return;

	/*
	 * Calculate right/left side clipping, based on quadrant.
	 * dir is positive when right side is filled and negative when
	 * left side is to be filled.
	 *
	 * >= 0 is bottom half
	 */
	if (ay >= 0)
		adir = 1;
	else
		adir = -1;

	if (by >= 0)
		bdir = -1;
	else
		bdir = 1;

	/*
	 * The clip_line routine has problems around the 0 and
	 * 180 degree axes.
	 * This <fix> is required to make the clip_line algorithm
	 * work.  Getting these routines to work for all angles is
	 * a bitch.  And they're still buggy.  Doing this causes
	 * half circles to be outlined with a slightly bent line
	 * on the x axis. FIXME
	 */
	if (ay == 0) ++ay;
	if (by == 0) ++by;

	/* swap rightmost edge first */
	if (bx > ax) {
		int swap;

		swap = ax;
		ax = bx;
		bx = swap;

		swap = ay;
		ay = by;
		by = swap;

		swap = adir;
		adir = bdir;
		bdir = swap;
	}

	slice.wID = wID;
	slice.gID = gID;
	slice.x0 = x0;
	slice.y0 = y0;
	slice.rx = rx;
	slice.ry = ry;
	slice.ax = ax;
	slice.ay = ay;
	slice.bx = bx;
	slice.by = by;
	slice.adir = adir;
	slice.bdir = bdir;
	slice.type = type;

	drawarc(&slice);

	if (type & GROUTLINE) {
		/* draw two lines from rx,ry to arc endpoints*/
		GrLine(wID, gID, x0, y0, x0+ax, y0+ay, TRUE);
		GrLine(wID, gID, x0, y0, x0+bx, y0+by, TRUE);
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91浏览器打开| 国产人伦精品一区二区| 精品久久久久香蕉网| 亚洲日本va午夜在线影院| 蜜臀av一区二区在线免费观看| 成人一区在线看| 日韩欧美一区二区不卡| 亚洲欧洲一区二区在线播放| 激情六月婷婷综合| 欧美人狂配大交3d怪物一区| 亚洲婷婷国产精品电影人久久| 激情成人综合网| 欧美一区二区三区在线视频| 亚洲精品v日韩精品| 99久久99久久精品免费观看| 国产午夜精品在线观看| 另类小说图片综合网| 884aa四虎影成人精品一区| 一区二区三区日韩欧美| www.欧美色图| 《视频一区视频二区| 成人妖精视频yjsp地址| 久久青草国产手机看片福利盒子| 男男gaygay亚洲| 日韩视频中午一区| 奇米色一区二区三区四区| 6080亚洲精品一区二区| 亚洲h在线观看| 欧美日本乱大交xxxxx| 亚洲电影中文字幕在线观看| 欧美精品一区二区在线观看| 欧美a一区二区| 日韩免费电影一区| 国内精品国产成人国产三级粉色| 日韩欧美国产一区在线观看| 蜜桃久久久久久| 欧美zozo另类异族| 国产盗摄一区二区三区| 国产精品嫩草影院av蜜臀| 成人午夜大片免费观看| 综合激情网...| 色婷婷久久综合| 午夜久久久久久电影| 日韩午夜激情av| 粉嫩一区二区三区在线看| 亚洲婷婷综合色高清在线| 欧洲另类一二三四区| 五月激情六月综合| 日韩网站在线看片你懂的| 国产成人精品综合在线观看| 综合电影一区二区三区| 欧美日韩在线观看一区二区 | 国产成人免费在线观看| 欧美激情中文不卡| 91国产视频在线观看| 日本视频免费一区| 337p粉嫩大胆色噜噜噜噜亚洲| 精品sm在线观看| 国产69精品久久久久毛片| 亚洲精品老司机| 日韩精品一区二区在线观看| 成人91在线观看| 日韩在线卡一卡二| 国产日产精品1区| 欧美剧在线免费观看网站 | 色琪琪一区二区三区亚洲区| 午夜视频久久久久久| 国产亚洲精品中文字幕| 在线免费观看日本欧美| 精品一区二区三区久久| 亚洲精品国产视频| 久久久国产一区二区三区四区小说 | 中文字幕制服丝袜一区二区三区| 91美女精品福利| 久久9热精品视频| 一区二区三区在线播放| 亚洲精品在线三区| 欧美亚洲国产怡红院影院| 国产成人夜色高潮福利影视| 亚洲国产精品自拍| 日韩毛片视频在线看| 亚洲h在线观看| 国产精品无遮挡| 精品国产91洋老外米糕| 一本大道久久a久久综合婷婷| 精品一区二区在线免费观看| 亚洲va国产天堂va久久en| 中文字幕在线不卡视频| 欧美成人video| 欧美日韩综合不卡| 色婷婷av一区二区三区大白胸| 国产伦精品一区二区三区视频青涩| 亚洲男同性恋视频| 国产欧美一区二区三区在线看蜜臀 | 色哟哟一区二区三区| 国产伦精品一区二区三区在线观看 | 亚洲乱码国产乱码精品精的特点| 精品成人一区二区| 欧美精品日韩精品| 91国偷自产一区二区使用方法| av不卡一区二区三区| 丁香啪啪综合成人亚洲小说 | 日本成人在线不卡视频| 亚洲综合色噜噜狠狠| 亚洲视频免费在线| 18欧美亚洲精品| 国产精品电影一区二区三区| 久久综合九色综合久久久精品综合| 欧美肥胖老妇做爰| 91精品国产入口| 欧美一区二区三区在线看| 欧美一级理论性理论a| 777亚洲妇女| 日韩一区和二区| 欧美va在线播放| 欧美xxxxxxxx| 精品久久一区二区三区| 欧美精品一区二区久久婷婷| 欧美精品一区二区三区蜜臀| 欧美精品一区二区三区在线| 久久一日本道色综合| 国产目拍亚洲精品99久久精品| 欧美极品另类videosde| 成人免费在线观看入口| 亚洲永久精品国产| 日本一区中文字幕| 国产乱子伦视频一区二区三区| 丰满少妇久久久久久久| 91丨九色丨尤物| 3atv一区二区三区| 日韩免费观看高清完整版| 国产亚洲成年网址在线观看| 国产精品福利一区二区三区| 一区二区国产盗摄色噜噜| 日韩国产高清在线| 国产精品亚洲成人| 在线亚洲人成电影网站色www| 欧美一区永久视频免费观看| 久久综合一区二区| 亚洲免费在线视频| 三级欧美在线一区| 粉嫩av一区二区三区在线播放| 色婷婷综合中文久久一本| 日韩欧美aaaaaa| 综合色天天鬼久久鬼色| 日韩成人一区二区三区在线观看| 久久成人精品无人区| 91美女视频网站| 日韩精品一区国产麻豆| 中文字幕日本乱码精品影院| 蜜臀av性久久久久蜜臀av麻豆| 成人一级片在线观看| 91精品婷婷国产综合久久性色| 国产日韩亚洲欧美综合| 午夜精品久久久久久| 高清不卡在线观看av| 欧美挠脚心视频网站| 亚洲国产成人自拍| 奇米影视7777精品一区二区| 91免费观看视频| 久久久99免费| 日本亚洲欧美天堂免费| 99久久免费视频.com| 久久婷婷色综合| 蜜臀a∨国产成人精品| 在线观看日韩国产| 久久久亚洲国产美女国产盗摄| 亚洲午夜精品17c| 成人激情免费视频| 欧美va亚洲va香蕉在线| 亚洲成人av一区| 91香蕉国产在线观看软件| 国产欧美一区二区精品婷婷| 日本aⅴ亚洲精品中文乱码| 在线视频你懂得一区二区三区| 国产日韩欧美麻豆| 乱一区二区av| 日韩欧美一卡二卡| 一区二区三区中文字幕| 91美女片黄在线观看91美女| 中文一区一区三区高中清不卡| 国内久久婷婷综合| 精品国产伦一区二区三区观看方式| 亚洲国产成人91porn| 在线中文字幕一区二区| 亚洲同性同志一二三专区| 99久久99久久精品免费看蜜桃 | 不卡的av网站| 毛片不卡一区二区| 日韩亚洲国产中文字幕欧美| 婷婷夜色潮精品综合在线| 欧美日本韩国一区二区三区视频| 亚洲美腿欧美偷拍| 色屁屁一区二区| 一二三区精品视频| 在线观看区一区二| 水蜜桃久久夜色精品一区的特点| 欧美色精品天天在线观看视频| 亚洲一区二区av在线| 3d成人h动漫网站入口|