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

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

?? draw.c

?? 該文件為一個嵌入式GUI圖形庫源碼
?? C
字號:
/*
 *  Drawing Layer
 *
 *
 *  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
 */
 
#include "emGUI.h"

static void
extendrow(int y,int x1,int y1,int x2,int y2, int *minxptr,int *maxxptr);

void GrLine(
	WndID 		id, 
	GC_ID 		gc, 
	int 		x1, 
	int 		y1, 
	int 		x2, 
	int 		y2,
	boolean 	bDrawLastPoint
)
{
	
	int c, mode;
	unsigned short *pmem;
  	int xdelta;			/* width of rectangle around line */
  	int ydelta;			/* height of rectangle around line */
  	int xinc;			/* increment for moving x coordinate */
  	int yinc;			/* increment for moving y coordinate */
  	int rem;			/* current remainder */
  	
	c 		= gc->fcolor;
	mode 	= gc->mode;
	pmem	= WndDrawMemory(id);
	if (pmem == NULL){
		return ;
	}
	
	if (x1 < 0 || y1 < 0 || x2 < 0 || y2 < 0)
		return;

	/*  change to absolute cood */
	x1 += id->left;
	x2 += id->left;
	y1 += id->top;
	y2 += id->top;
	
	if (x1 == x2){
		DrawVertLine(
			pmem, 
			x1, 
			y1, 
			y2,
			c,
			mode			
		);

		return;
	}

	if (y1 == y2){
		DrawHorzLine(
			pmem, 
			x1, 
			y1,
			x2, 
			c, 
			mode
		);
		
		return;
	}

	/*	The line may be partially obscured. Do the draw line algorithm
	 * 	checking each point against the clipping regions.
   	 */
  	xdelta = x2 - x1;
  	ydelta = y2 - y1;
  	if (xdelta < 0) xdelta = -xdelta;
  	if (ydelta < 0) ydelta = -ydelta;
  	xinc = (x2 > x1) ? 1 : -1;
  	yinc = (y2 > y1) ? 1 : -1;
	DrawPixel(
		pmem,
		x1, 
		y1, 
		c,
		mode
	);
	
	if (xdelta >= ydelta) {
		rem = xdelta / 2;
		for(;;) {
			if(!bDrawLastPoint && x1 == x2)
				break;
			x1 += xinc;
			rem += ydelta;
			if (rem >= xdelta) {
				rem -= xdelta;
				y1 += yinc;
			}
			DrawPixel(
				pmem,
				x1, 
				y1, 
				c,
				mode
			);
			if(bDrawLastPoint && x1 == x2)
				break;
		}
  	} 
  	else {
		rem = ydelta / 2;
		for(;;) {
			if(!bDrawLastPoint && y1 == y2)
				break;
			y1 += yinc;
			rem += xdelta;
			if (rem >= ydelta) {
				rem -= ydelta;
				x1 += xinc;
			}
			DrawPixel(
				pmem,
				x1, 
				y1, 
				c,
				mode
			);
			if(bDrawLastPoint && y1 == y2)
				break;
		}
	}

}

void GrPoint(
	WndID id, 
	GC_ID gc, 
	int x, 
	int y
)
{
	int c, mode;
	unsigned short *pmem;

	if (x < 0 || y < 0)
		return;
		
	pmem 	= WndDrawMemory(id);
	if (pmem == NULL){
		return;
	}

	x += id->left;
	y += id->top;
	
	c 		= gc->fcolor;
	mode 	= gc->mode;	
	DrawPixel(
		pmem,
		x,
		y,
		c,
		mode
	);
}

void GrRect(
	WndID id, 
	GC_ID gc, 
	int x, 
	int y,
	int width, 
	int height
)
{
	int maxx;
  	int maxy;
	int mode;
	unsigned short *pmem;
	int c;
	
	pmem = WndDrawMemory(id);
	if (pmem == NULL){
		return;
	}

	c = gc->fcolor;
	mode = gc->mode;

  	if (width <= 0 || height <= 0)
	  	return;

	x += id->left;
	y += id->top;
	
  	maxx = x + width - 1;
  	maxy = y + height - 1;
  	DrawHorzLine(
		pmem,
		x,
		y,
		maxx,
		c,
		mode
	);
	
  	if (height > 1)
	  DrawHorzLine(
	  	pmem, 
	  	x, 
	  	maxx, 
	  	maxy,
	  	c,
	  	mode
	);
	
  	if (height < 3)
		return;
		
  	y++;
  	maxy--;
  	DrawVertLine(pmem, x, y, maxy, c, mode);
  	if (width > 1)
	  	DrawVertLine(
	  		pmem,
	  		maxx,
	  		y,
	  		maxy,
	  		c,
	  		mode
	  	);	
}  
	
void GrFillRect(
	WndID id, 
	GC_ID gc, 
	int x, 
	int y,
	int width, 
	int height
)
{
	int x1, y1;
	int c;
	unsigned short *pmem;
	if (id == NULL){
		return;
	}
	if (x < 0 || y < 0 || width < 0 || height < 0){
		return;
	}
	x1 		= x + width;
	y1 		= y + height;
	c 		= gc->fcolor;
	pmem 	= WndDrawMemory(id);
	FillRect(
		pmem,
		x,
		y,
		x1, 
		y1,
		c
	);
}

void GrPoly(
	WndID 	wId, 
	GID 	gId, 
	int 	count, 
	LPPOINT points
)
{
	int	firstx;
	int	firsty;
	int	didline;
	unsigned short *pmem;
	int	c, mode;
	
	pmem = WndDrawMemory(wId);
	if (pmem == NULL){
		return;
	}
	
	if (count < 2)
	  return;
	
	c 		= gId->fcolor;
	mode	= gId->mode;
	
	firstx 	= points->x;
	firsty 	= points->y;
	didline = FALSE;
	
	while (count-- > 1) {
		if (didline && (gId->mode == GR_XOR))
			DrawPixel(pmem, points->x + wId->left, points->y + wId->top, c, mode);
		
		GrLine(wId, gId, points[0].x, points[0].y, points[1].x, points[1].y, TRUE);
		points++;
		didline = TRUE;
	}
	
	if (gId->mode == GR_XOR) {
		points--;
		if (points->x == firstx && points->y == firsty){
			DrawPixel(pmem, points->x + wId->left, points->y + wId->top, c, mode);
		}
	}
}

/*
 * Fill a polygon in the foreground color, applying clipping if necessary.
 * The last point may be a duplicate of the first point, but this is
 * not required.
 * Note: this routine currently only correctly fills convex polygons.
 */
void 
GrFillPoly(
	WndID 	wId, 
	GID 	gId, 
	int 	count, 
	LPPOINT points)
{
	LPPOINT pp;		/* current point */
	int		miny;	/* minimum row */
	int		maxy;	/* maximum row */
	int		minx;	/* minimum column */
	int		maxx;	/* maximum column */
	int		i;		/* counter */
	unsigned short *pmem;
	int	c, mode;
	
	pmem = WndDrawMemory(wId);
	if (pmem == NULL){
		return;
	}
	
	
	if (count <= 0)
		return;
	
	c 		= gId->fcolor;
	mode	= gId->mode;

	/* First determine the minimum and maximum rows for the polygon. */
	pp   = points;
	miny = pp->y;
	maxy = pp->y;
	for (i = count; i-- > 0; pp++) {
		if (miny > pp->y) 
			miny = pp->y;
		if (maxy < pp->y) 
			maxy = pp->y;
	}
	
	if (miny < 0)
		miny = 0;

/*		
	if (maxy >= psd->yvirtres)
		maxy = psd->yvirtres - 1;
*/		
	if (miny > maxy)
		return;
	
	/* Now for each row, scan the list of points and determine the
	 * minimum and maximum x coordinate for each line, and plot the row.
	 * The last point connects with the first point automatically.
	 */
	for (; miny <= maxy; miny++) {
		minx = 0x0FFFFFFF;
		maxx = 0x00000000;
		pp 	 = points;
		
		for (i = count; --i > 0; pp++)
			extendrow(miny, pp[0].x, pp[0].y, pp[1].x, pp[1].y,	&minx, &maxx);
			
		extendrow(miny, pp[0].x, pp[0].y, points[0].x, points[0].y,	&minx, &maxx);
		
		if (minx <= maxx){
			DrawHorzLine(pmem, minx + wId->left, miny + wId->top, maxx + wId->left, c, mode);
		}
	}
}

/* Utility routine for filling polygons.  Find the intersection point (if
 * any) of a horizontal line with an arbitrary line, and extend the current
 * minimum and maximum x values as needed to include the intersection point.
 * Input parms:
 *	y 	row to check for intersection
 *	x1, y1	first endpoint
 *	x2, y2	second enpoint
 *	minxptr	address of current minimum x
 *	maxxptr	address of current maximum x
 */
static void
extendrow(
	int y,
	int x1,
	int y1,
	int x2,
	int y2,
	int *minxptr,
	int *maxxptr
)
{
	int x;			/* x coordinate of intersection */
	long num;			/* numerator of fraction */
	
	/* First make sure the specified line segment includes the specified
	 * row number.  If not, then there is no intersection.
	 */
	if (((y < y1) || (y > y2)) && ((y < y2) || (y > y1)))
		return;
	
	/* If a horizontal line, then check the two endpoints. */
	if (y1 == y2) {
		if (*minxptr > x1) 
			*minxptr = x1;
			
		if (*minxptr > x2) 
			*minxptr = x2;
			
		if (*maxxptr < x1) 
			*maxxptr = x1;
		
		if (*maxxptr < x2) 
			*maxxptr = x2;
		return;
	}
	
	/* If a vertical line, then check the x coordinate. */
	if (x1 == x2) {
		if (*minxptr > x1) 
			*minxptr = x1;
		if (*maxxptr < x1) 
			*maxxptr = x1;
		return;
	}

	/* An arbitrary line.  Calculate the intersection point using the
	 * formula x = x1 + (y - y1) * (x2 - x1) / (y2 - y1).
	 */
	num = ((long) (y - y1)) * (x2 - x1);
	x = x1 + num / (y2 - y1);
	if (*minxptr > x) 
		*minxptr = x;
		
	if (*maxxptr < x) 
		*maxxptr = x;
}

/*
 * Draw a rectangular area using the current clipping region and the
 * specified bit map.  This differs from rectangle drawing in that the
 * rectangle is drawn using the foreground color and possibly the background
 * color as determined by the bit map.  Each row of bits is aligned to the
 * next bitmap word boundary (so there is padding at the end of the row).
 * The background bit values are only written if the gr_usebg flag
 * is set.
 */
void
GrBitmap(
	WndID	win, 
	GID		gc,
	int	 	x, 
	int 	y, 
	int 	width, 
	int 	height,
	MWIMAGEBITS *imagebits
)
{
  	int minx;
  	int maxx;
  	MWIMAGEBITS bitvalue = 0;	/* bitmap word value */
  	int bitcount;			/* number of bits left in bitmap word */

	GrFillRect(win, gc, x, y, width, height);
  	minx = x;
  	maxx = x + width - 1;
  	bitcount = 0;
  	while (height > 0) {
		if (bitcount <= 0) {
			bitcount = MWIMAGE_BITSPERIMAGE;
			bitvalue = *imagebits++;
		}
		if (MWIMAGE_TESTBIT(bitvalue)){
			GrPoint(win, gc, x, y);
		}
		bitvalue = MWIMAGE_SHIFTBIT(bitvalue);
		bitcount--;
		if (x++ == maxx) {
			x = minx;
			y++;
			height--;
			bitcount = 0;
		}
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美男人的天堂一二区| 国产亚洲短视频| 久久久精品免费观看| 一区二区三区欧美亚洲| 国产乱人伦偷精品视频免下载| 91麻豆视频网站| 国产亚洲综合在线| 日本怡春院一区二区| 日本高清不卡视频| 中文在线一区二区| 激情丁香综合五月| 国产欧美日产一区| 日韩精品一级二级 | www.久久久久久久久| 日韩精品一区在线| 午夜av区久久| 欧美三级欧美一级| 亚洲欧洲成人精品av97| 国产精品一区二区在线观看不卡 | 91年精品国产| 国产欧美日产一区| 国产精品1024久久| 久久亚洲欧美国产精品乐播 | 成人免费黄色在线| 欧美极品少妇xxxxⅹ高跟鞋| 国产一区二区三区免费播放| 宅男在线国产精品| 日韩二区在线观看| 5858s免费视频成人| 亚洲成av人在线观看| 欧美性大战久久| 亚洲一区二区视频| 欧美日韩国产在线观看| 亚洲成人av中文| 宅男在线国产精品| 精品午夜一区二区三区在线观看| 日韩丝袜美女视频| 国产一区高清在线| 亚洲国产高清在线观看视频| 成人午夜免费电影| 亚洲天堂精品在线观看| 色婷婷一区二区| 午夜天堂影视香蕉久久| 欧美绝品在线观看成人午夜影视| 午夜电影一区二区三区| 欧美一区二区免费视频| 美国毛片一区二区| 久久久噜噜噜久久中文字幕色伊伊| 国产福利视频一区二区三区| 国产精品美日韩| 在线观看日韩电影| 免费欧美日韩国产三级电影| 日韩精品一区二区三区四区视频 | 日本久久电影网| 天天影视网天天综合色在线播放| 欧美一区二区三级| 国产成人免费网站| 一卡二卡欧美日韩| 精品国产91亚洲一区二区三区婷婷| 国产精品一区二区视频| 最近日韩中文字幕| 欧美一区日本一区韩国一区| 国产精品91xxx| 亚洲男人的天堂av| 日韩欧美在线1卡| 成人美女在线视频| 天天色综合成人网| 国产精品你懂的| 欧美一区二区三区免费在线看 | 精品一区二区在线播放| 中文字幕乱码日本亚洲一区二区| 91国偷自产一区二区三区成为亚洲经典| 婷婷国产在线综合| 中文成人av在线| 日韩一区二区在线观看视频播放| 成人久久视频在线观看| 日韩av午夜在线观看| 国产精品久久久久久久蜜臀| 欧美绝品在线观看成人午夜影视| 成人一区二区三区| 日韩激情视频在线观看| 国产精品三级久久久久三级| 日韩一区二区在线看| 在线看一区二区| www.欧美.com| 国产成人亚洲综合a∨猫咪| 日韩av网站免费在线| 一区二区三区不卡视频| 久久久精品免费观看| 欧美一区午夜视频在线观看| 97成人超碰视| 成人永久看片免费视频天堂| 精品在线观看视频| 日韩av成人高清| 午夜久久久久久久久| 亚洲激情欧美激情| 最新高清无码专区| 国产精品久久久久桃色tv| 久久精品人人做人人爽97| 欧美www视频| 日韩亚洲欧美中文三级| 91精品欧美一区二区三区综合在| 色综合久久综合网97色综合| 国产成人精品亚洲777人妖| 韩国女主播一区二区三区| 奇米一区二区三区av| 奇米在线7777在线精品| 亚洲成av人片一区二区梦乃| 亚洲免费在线观看视频| 亚洲欧美日韩国产手机在线| 国产精品国产自产拍在线| 亚洲国产精品成人综合色在线婷婷| 久久婷婷成人综合色| 精品久久国产字幕高潮| 欧美成人性福生活免费看| 欧美一区二区三区性视频| 日韩欧美在线影院| 久久久久久久久一| 久久午夜国产精品| 国产色91在线| 中文字幕在线不卡| 一区二区三区在线播放| 亚洲综合区在线| 亚洲a一区二区| 久久精品国产精品亚洲红杏| 国产自产高清不卡| 丁香桃色午夜亚洲一区二区三区| 国产99久久久国产精品| 波多野结衣中文一区| 91福利资源站| 91.com在线观看| 久久综合久久综合九色| 国产精品理伦片| 亚洲精品你懂的| 日本欧美在线观看| 国产露脸91国语对白| www.激情成人| 欧美日韩一级片在线观看| 91精品在线一区二区| 久久久美女毛片| 亚洲激情图片一区| 久久国产乱子精品免费女| 成人黄色免费短视频| 在线观看日韩av先锋影音电影院| 在线观看91av| 国产视频911| 亚洲第一会所有码转帖| 经典三级视频一区| 色综合欧美在线| 日韩精品一区二区三区老鸭窝 | 99久久夜色精品国产网站| 欧美伦理视频网站| 欧美激情一区二区三区在线| 一区二区三区四区高清精品免费观看 | 国产精品福利一区| 日韩中文欧美在线| 99精品久久免费看蜜臀剧情介绍| 欧美亚洲国产一卡| 亚洲精品在线免费播放| 一区二区三区国产豹纹内裤在线 | 色天天综合色天天久久| 欧美电视剧免费观看| 一区二区三区四区在线| 国产成人精品免费一区二区| 欧美性受极品xxxx喷水| 国产精品麻豆久久久| 另类小说综合欧美亚洲| 在线观看免费视频综合| 国产欧美一区在线| 日本欧美一区二区三区| 91一区一区三区| xnxx国产精品| 亚洲成人中文在线| 成人av在线播放网址| 亚洲精品一区二区三区精华液 | 亚洲日本免费电影| 国产精品一区在线| 日韩欧美中文字幕公布| 亚洲午夜在线视频| 91麻豆.com| 欧美激情一区二区三区四区| 免费不卡在线视频| 欧美精品自拍偷拍| 亚洲国产日韩精品| 在线观看av不卡| 亚洲色图在线看| 99re热视频精品| 国产精品成人午夜| 国产v日产∨综合v精品视频| 日韩美女一区二区三区| 蜜桃在线一区二区三区| 欧美日韩国产经典色站一区二区三区 | 色综合色综合色综合色综合色综合| 国产亚洲1区2区3区| 国产精品一二三| 国产夜色精品一区二区av| 国产成人精品亚洲日本在线桃色| 久久久久亚洲蜜桃| 国产精品一区二区视频| 亚洲国产成人一区二区三区|