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

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

?? draw-arc.c

?? 嵌入式圖形處理系統(tǒng),emgui嵌入式圖形處理系統(tǒng),
?? 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);
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美撒尿777hd撒尿| 欧美丰满一区二区免费视频| av激情亚洲男人天堂| 欧美性感一区二区三区| www久久精品| 亚洲18色成人| 91香蕉视频mp4| 337p粉嫩大胆色噜噜噜噜亚洲 | 99视频精品免费视频| 欧美一区二区视频在线观看2022 | 精品成人一区二区三区| 亚洲免费观看高清完整版在线观看| 日本午夜精品一区二区三区电影 | 成人激情av网| 精品久久人人做人人爰| 亚洲午夜免费福利视频| av中文字幕在线不卡| 亚洲精品一区二区三区四区高清 | 在线播放中文一区| 亚洲最新在线观看| 成人精品小蝌蚪| 国产午夜亚洲精品理论片色戒| 五月天亚洲精品| 99亚偷拍自图区亚洲| 国产精品视频在线看| 国产伦理精品不卡| 精品久久五月天| 久久99精品久久久久久| 精品国产麻豆免费人成网站| 首页亚洲欧美制服丝腿| 欧美电影影音先锋| 性做久久久久久免费观看欧美| 日本道色综合久久| 一区二区三区日韩欧美| 色综合夜色一区| 亚洲欧美在线观看| 91女神在线视频| 综合亚洲深深色噜噜狠狠网站| 成人av资源在线观看| 中文字幕欧美区| 99国产精品久久久久| 亚洲三级电影网站| 欧美制服丝袜第一页| 亚洲v精品v日韩v欧美v专区| 欧美二区三区的天堂| 日本三级韩国三级欧美三级| 日韩亚洲国产中文字幕欧美| 乱中年女人伦av一区二区| 日韩免费看的电影| 国产传媒日韩欧美成人| 91精品国产免费久久综合| 国产在线国偷精品产拍免费yy| 亚洲午夜精品网| 亚洲免费观看视频| 一区二区三区国产豹纹内裤在线| 午夜精品久久久久久久久久久| 国产无一区二区| 日韩午夜电影在线观看| 在线观看亚洲成人| av在线综合网| 高清在线成人网| 免费欧美日韩国产三级电影| 亚洲香肠在线观看| 国产精品国产三级国产普通话99| 欧美成人bangbros| 日韩一区二区免费高清| 欧美综合亚洲图片综合区| 成人免费毛片嘿嘿连载视频| 国模冰冰炮一区二区| 日韩电影在线一区| 日韩在线一区二区| 无码av中文一区二区三区桃花岛| 成人激情黄色小说| 日韩理论片网站| 欧美日韩免费观看一区三区| 色综合久久中文字幕| 成人久久18免费网站麻豆| 成人一区二区在线观看| 激情六月婷婷综合| 久久精品国产99久久6| 蜜桃视频在线观看一区二区| 首页国产欧美日韩丝袜| 日韩国产成人精品| 日韩电影免费一区| 日韩av在线播放中文字幕| 日韩电影免费在线看| 麻豆精品一区二区三区| 另类中文字幕网| 国产成人午夜高潮毛片| 国产激情视频一区二区三区欧美| 国产在线不卡一区| 国产成人亚洲精品青草天美| 成人av动漫网站| 在线免费视频一区二区| 欧美日韩国产区一| 欧美成人艳星乳罩| 国产欧美视频一区二区三区| 国产精品污www在线观看| 亚洲午夜电影在线观看| 精品一区二区国语对白| 成人综合日日夜夜| 91福利在线看| 欧美一区二区日韩一区二区| 最新久久zyz资源站| 中文字幕不卡在线播放| 99久久精品国产毛片| 91视频www| 在线成人av网站| 国产婷婷精品av在线| 国产精品久久久久毛片软件| 亚洲九九爱视频| 免费高清在线一区| 99久久99久久免费精品蜜臀| 欧美探花视频资源| 精品成人在线观看| 亚洲免费视频中文字幕| 久久国产精品99精品国产 | 欧美不卡一区二区三区四区| 日韩欧美卡一卡二| 日韩免费一区二区| 亚洲成人av一区二区| 一区二区三区在线视频观看| 国产成a人无v码亚洲福利| 国产精品小仙女| 欧美日韩精品欧美日韩精品| 久久久久久夜精品精品免费| 日本一区二区三级电影在线观看| 亚洲欧美另类图片小说| 毛片av一区二区三区| 成人教育av在线| 日韩午夜激情视频| 亚洲综合色噜噜狠狠| 久久 天天综合| 色偷偷久久一区二区三区| 日韩欧美色电影| 一区二区三区不卡视频在线观看 | 99久久精品国产精品久久| 欧美色图免费看| 国产目拍亚洲精品99久久精品| 一区二区三区在线播放| 国产99一区视频免费| 色欧美片视频在线观看 | 久久久不卡网国产精品一区| 日本一区二区三区电影| 日本成人在线一区| 91丨porny丨首页| 久久日韩粉嫩一区二区三区| 亚洲动漫第一页| 91美女视频网站| 精品区一区二区| 视频在线观看91| 95精品视频在线| 久久九九全国免费| 理论电影国产精品| 欧美精品少妇一区二区三区| 亚洲精品成人少妇| 99麻豆久久久国产精品免费 | 中文字幕一区在线观看视频| 久久国产精品72免费观看| 在线不卡中文字幕| 亚洲精品你懂的| 色婷婷综合视频在线观看| 国产精品水嫩水嫩| 成人在线视频一区| 欧美久久一二三四区| 亚洲成人精品一区二区| 欧美天堂一区二区三区| 日本一区二区三区电影| 精品久久国产老人久久综合| 一级日本不卡的影视| 91无套直看片红桃| 亚洲女同ⅹxx女同tv| 色综合久久中文字幕| 亚洲免费资源在线播放| 色噜噜久久综合| 亚洲午夜在线视频| 欧美日韩aaa| 麻豆一区二区在线| 亚洲精品在线网站| 国产成人免费av在线| 国产精品每日更新| 色久综合一二码| 香蕉久久夜色精品国产使用方法| 欧美日韩国产综合一区二区 | 日韩精品91亚洲二区在线观看| 欧美日韩一区二区三区高清| 亚洲gay无套男同| 日韩欧美成人激情| 国产成人啪午夜精品网站男同| 国产精品毛片久久久久久| 91麻豆自制传媒国产之光| 亚洲视频 欧洲视频| 在线国产电影不卡| 毛片不卡一区二区| 国产精品视频你懂的| 欧美在线观看视频在线| 美国毛片一区二区三区| 国产精品伦理一区二区| 欧美日韩大陆一区二区| 国产精品1024|