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

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

?? draw.c

?? microwindows上的修改的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一区二区三区免费野_久草精品视频
奇米888四色在线精品| 国产精品无码永久免费888| 一区二区免费在线| 一本色道久久综合精品竹菊| 亚洲乱码国产乱码精品精的特点 | 色综合婷婷久久| 亚洲欧洲精品一区二区三区 | 91精品欧美久久久久久动漫| 日韩电影在线看| 精品国内二区三区| 成人中文字幕合集| 亚洲老妇xxxxxx| 7777精品伊人久久久大香线蕉| 日韩激情av在线| 久久婷婷色综合| av在线不卡网| 性感美女久久精品| 亚洲图片激情小说| 欧美在线一区二区三区| 日韩福利电影在线| 欧美激情一二三区| 欧美亚洲尤物久久| 精品一二三四在线| 亚洲欧洲性图库| 欧美一区二区视频免费观看| 国产高清在线精品| 一区二区三区免费在线观看| 日韩美女主播在线视频一区二区三区| 国产精品一区二区91| 亚洲精品久久久蜜桃| 日韩欧美亚洲国产精品字幕久久久| 国产一区二三区| 一区二区三区中文字幕| wwwwxxxxx欧美| 91精品福利在线| 国内国产精品久久| 亚洲一区二区欧美| 国产欧美视频在线观看| 欧美色图激情小说| 成人教育av在线| 韩国中文字幕2020精品| 亚洲美女视频一区| 久久久久久久久久久久电影| 欧美日韩高清一区二区| 不卡的av中国片| 精彩视频一区二区| 亚洲成国产人片在线观看| 欧美高清在线精品一区| 欧美一区午夜精品| 欧美性高清videossexo| 丁香婷婷综合网| 96av麻豆蜜桃一区二区| 国产在线精品一区二区不卡了| 亚洲成人av免费| 亚洲女人的天堂| 国产日产亚洲精品系列| 欧美一区二区三区在线观看| 91黄色激情网站| caoporen国产精品视频| 国产一区二区日韩精品| 青椒成人免费视频| 亚洲va欧美va人人爽午夜| 亚洲精品亚洲人成人网在线播放| 国产日韩欧美高清在线| 欧美精品一区二区高清在线观看| 制服丝袜中文字幕一区| 欧美精品乱码久久久久久| 色狠狠av一区二区三区| 91麻豆免费看| 色一区在线观看| 91理论电影在线观看| 波波电影院一区二区三区| 国产成人综合在线观看| 国产一二精品视频| 国产精品一区二区三区四区| 国产一区二区三区四区五区美女| 麻豆精品精品国产自在97香蕉| 日韩高清一区二区| 免费成人在线观看| 另类欧美日韩国产在线| 久久狠狠亚洲综合| 国产在线视视频有精品| 国产一区二区网址| 在线视频欧美区| 欧美日韩国产美女| 337p亚洲精品色噜噜噜| 日韩一卡二卡三卡四卡| 日韩美女天天操| 久久久无码精品亚洲日韩按摩| 久久久久久一二三区| 欧美激情一区二区三区在线| 国产精品三级视频| 亚洲男同1069视频| 亚洲一二三四区| 免费一级欧美片在线观看| 麻豆成人综合网| 高潮精品一区videoshd| eeuss鲁片一区二区三区| 在线视频一区二区三区| 在线不卡一区二区| 26uuu精品一区二区| 中文字幕一区二区三区乱码在线 | 欧美老年两性高潮| 精品免费国产一区二区三区四区| 久久久91精品国产一区二区精品 | 欧美巨大另类极品videosbest | 久久国产精品色| 国产成人精品免费| 色av成人天堂桃色av| 91精品国产综合久久久久久久久久| 欧美电影免费观看高清完整版| 国产日韩一级二级三级| 亚洲欧美乱综合| 美女尤物国产一区| 99久久夜色精品国产网站| 欧美日韩中文国产| 久久久综合激的五月天| 一区二区在线免费观看| 久久成人免费日本黄色| 久久综合九色综合97_久久久| 欧美激情在线看| 天使萌一区二区三区免费观看| 国产一区二区在线看| 色综合久久久久网| 精品卡一卡二卡三卡四在线| 亚洲视频在线观看三级| 免费av成人在线| 色噜噜久久综合| 久久久精品国产免大香伊| 亚洲综合小说图片| 国产成人在线色| 制服丝袜在线91| 亚洲精选免费视频| 国产麻豆精品久久一二三| 欧洲一区二区三区在线| 国产亚洲欧美在线| 日韩精品福利网| 在线视频你懂得一区| 国产日产欧产精品推荐色 | 五月天激情综合| 成人app软件下载大全免费| 日韩三级精品电影久久久 | 国产精品伊人色| 欧美一区二区美女| 亚洲五码中文字幕| k8久久久一区二区三区 | 国产精品一线二线三线| 欧美精品久久99| 亚洲午夜在线观看视频在线| 成人午夜激情视频| 久久精品视频网| 国产综合色在线| 日韩欧美国产麻豆| 亚洲gay无套男同| 在线免费观看成人短视频| 国产精品欧美一区二区三区| 国产伦精品一区二区三区免费迷 | 日韩美女视频19| 国产伦精品一区二区三区免费迷| 日韩精品一区二区三区中文精品| 午夜精品久久久久久久| 欧美性大战久久| 一卡二卡三卡日韩欧美| 色综合天天综合网天天狠天天| 国产精品毛片a∨一区二区三区| 国产一区二区在线视频| 精品国产伦一区二区三区观看体验| 性做久久久久久久免费看| 欧美伊人久久大香线蕉综合69| 亚洲色图欧美激情| 色欧美片视频在线观看在线视频| 日韩一区欧美小说| 91麻豆123| 亚洲国产综合色| 666欧美在线视频| 日本视频在线一区| 精品黑人一区二区三区久久| 国产乱淫av一区二区三区| 久久嫩草精品久久久久| 国产在线精品一区在线观看麻豆| 久久久久久久久久久久电影| 国产成人自拍网| 综合久久久久久| 欧美在线高清视频| 石原莉奈在线亚洲二区| 日韩欧美一区二区免费| 国产伦精品一区二区三区免费迷 | 欧美男人的天堂一二区| 天天av天天翘天天综合网色鬼国产| 777a∨成人精品桃花网| 激情综合亚洲精品| 亚洲国产精品成人久久综合一区| 99国内精品久久| 性欧美大战久久久久久久久| 欧美mv日韩mv国产网站app| 国产精品一区一区| 亚洲另类春色校园小说| 日韩欧美视频在线| 成人av片在线观看| 亚洲一区二区影院|