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

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

?? draw-arc.c

?? microwindows上的修改的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);
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人综合婷婷国产精品久久蜜臀 | 欧美一区二区成人| 亚洲一区二区三区四区五区中文| 91在线视频网址| 一区二区三区在线播| 欧美日韩三级一区| 免费看欧美美女黄的网站| 欧美一区二区高清| 国精品**一区二区三区在线蜜桃| 久久影视一区二区| 成人av电影在线网| 一区二区日韩av| 国产精品妹子av| 国产suv精品一区二区883| 亚洲欧洲美洲综合色网| 日本道色综合久久| 免费观看在线色综合| 久久久蜜桃精品| 91亚洲永久精品| 日韩不卡免费视频| 国产香蕉久久精品综合网| 99国产精品国产精品久久| 午夜精品免费在线观看| 精品999在线播放| 91亚洲精品久久久蜜桃| 亚洲成人激情自拍| 国产性做久久久久久| 色婷婷综合中文久久一本| 日本欧美大码aⅴ在线播放| 国产亚洲欧美色| 欧美私人免费视频| 国产电影精品久久禁18| 夜夜精品视频一区二区| 26uuu成人网一区二区三区| 成人午夜电影久久影院| 日韩精彩视频在线观看| 欧美激情艳妇裸体舞| 欧美精品在线一区二区三区| 国产成人免费视频一区| 日韩专区在线视频| 国产精品动漫网站| 日韩午夜小视频| 色综合久久中文字幕综合网 | 日韩精品一区二区三区蜜臀| av成人免费在线| 精一区二区三区| 亚洲影视在线播放| 欧美极品xxx| 欧美一区二区在线免费播放| bt欧美亚洲午夜电影天堂| 美国毛片一区二区| 亚洲第一av色| 亚洲色图在线播放| 日本一区二区三区在线观看| 欧美一区在线视频| 欧美三级在线播放| 91一区一区三区| 成人一区二区三区中文字幕| 麻豆精品精品国产自在97香蕉| 亚洲一区二区三区视频在线| 国产精品入口麻豆九色| 久久久久国产精品免费免费搜索| 欧美一级午夜免费电影| 欧美三片在线视频观看| 色婷婷久久综合| 91偷拍与自偷拍精品| caoporen国产精品视频| 成人av在线看| 成人avav影音| 国产aⅴ综合色| 国产精品一区三区| 国产伦精品一区二区三区视频青涩| 亚洲精品成人精品456| 日韩一区有码在线| 国产精品久久久久久久久免费相片| 久久影院午夜片一区| 精品奇米国产一区二区三区| 日韩一区二区三免费高清| 911精品国产一区二区在线| 欧美日韩久久久一区| 欧美色爱综合网| 在线播放91灌醉迷j高跟美女 | 3d动漫精品啪啪一区二区竹菊| 欧美熟乱第一页| 欧美精选一区二区| 欧美一区二区三区白人| 欧美成人a在线| xf在线a精品一区二区视频网站| 26uuu另类欧美亚洲曰本| 国产亚洲一区二区三区四区| 国产欧美日韩另类视频免费观看| 国产精品网站在线播放| 综合av第一页| 午夜激情综合网| 久久精品噜噜噜成人av农村| 激情图片小说一区| 成人一道本在线| 91免费在线播放| 欧美日韩精品久久久| 4438x亚洲最大成人网| 精品av久久707| 亚洲欧美综合色| 亚洲大片在线观看| 精品无码三级在线观看视频 | 丁香桃色午夜亚洲一区二区三区| 成人免费av在线| 91成人免费电影| 91精品国产综合久久小美女| 久久新电视剧免费观看| 亚洲欧洲日韩综合一区二区| 亚洲一区影音先锋| 久久99精品网久久| aaa欧美大片| 欧美一区二区不卡视频| 中文欧美字幕免费| 91捆绑美女网站| 91精品欧美福利在线观看| 久久亚洲一级片| 亚洲一区二区三区爽爽爽爽爽| 精品一区二区三区不卡 | 在线观看亚洲一区| 精品国产一区二区三区久久影院| ㊣最新国产の精品bt伙计久久| 午夜亚洲福利老司机| 丁香婷婷综合激情五月色| 91麻豆国产香蕉久久精品| 精品国产免费一区二区三区香蕉| 国产精品国产馆在线真实露脸| 免费久久99精品国产| 色综合久久久久综合体| 精品精品欲导航| 亚洲制服丝袜av| 国产成人av电影在线| 欧美精品一级二级| 亚洲欧美激情视频在线观看一区二区三区 | 欧美精品一区二区三区蜜臀| 亚洲视频电影在线| 国产精品2024| 日韩美一区二区三区| 亚洲摸摸操操av| 成人网页在线观看| 精品免费一区二区三区| 亚洲国产wwwccc36天堂| 99精品视频在线免费观看| 精品久久久久久久久久久久久久久久久 | 91丝袜国产在线播放| 国产亚洲成年网址在线观看| 日韩av成人高清| 欧美日韩国产一区| 亚洲激情综合网| 波多野结衣中文一区| 久久久久久久综合色一本| 日本人妖一区二区| 欧美三级中文字幕| 亚洲自拍欧美精品| 91原创在线视频| 中文字幕一区免费在线观看| 国产另类ts人妖一区二区| 韩国精品在线观看| 午夜电影一区二区| 欧美在线综合视频| 日韩毛片高清在线播放| 国产精品1区2区| 国产亚洲欧洲997久久综合| 另类综合日韩欧美亚洲| 91精品中文字幕一区二区三区| 亚洲一区二区综合| 日本福利一区二区| 亚洲一区二区三区美女| 91极品视觉盛宴| 亚洲动漫第一页| 欧美日本一区二区三区四区| 午夜欧美在线一二页| 在线播放日韩导航| 麻豆91在线播放免费| 日韩精品一区在线观看| 韩国一区二区三区| 久久久综合视频| 福利视频网站一区二区三区| 国产精品色哟哟| 一本一道综合狠狠老| 亚洲一级不卡视频| 91精品国产高清一区二区三区| 美女视频黄免费的久久| 久久久av毛片精品| 成人性生交大片免费看视频在线| 国产亚洲一本大道中文在线| 成人高清av在线| 亚洲综合男人的天堂| 337p亚洲精品色噜噜噜| 国内外成人在线| 国产精品色眯眯| 欧美色图片你懂的| 久久电影网站中文字幕| 欧美国产国产综合| 欧美中文字幕不卡| 麻豆精品一二三| 国产精品久久久久久久久果冻传媒 | 91福利在线免费观看| 免费成人av在线|