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

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

?? draw.c

?? 嵌入式圖形處理系統,emgui嵌入式圖形處理系統,
?? 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丝袜呻吟高潮美腿白嫩在线观看| 久久精品一区四区| 不卡的电影网站| 国产精品电影一区二区| av不卡一区二区三区| 中文字幕视频一区二区三区久| av在线综合网| 一区2区3区在线看| 日韩一区二区电影在线| 麻豆精品新av中文字幕| 欧美成人性福生活免费看| 国产一二精品视频| 亚洲精品免费播放| 欧美日韩亚洲综合在线| 久久精品国产一区二区| 国产女人水真多18毛片18精品视频| a亚洲天堂av| 日韩精品国产精品| 国产午夜精品一区二区三区四区| 成人h动漫精品| 亚洲国产日日夜夜| 精品1区2区在线观看| 99精品热视频| 首页国产欧美日韩丝袜| 久久精品一区二区三区不卡牛牛 | 26uuu国产一区二区三区| 国产一区二区福利视频| 一区二区视频在线看| 日韩免费高清视频| 9色porny自拍视频一区二区| 日韩高清一区二区| 中文字幕中文在线不卡住| 91精品办公室少妇高潮对白| 久久国产乱子精品免费女| 亚洲欧美一区二区三区国产精品| 欧美哺乳videos| 欧洲国内综合视频| 粉嫩aⅴ一区二区三区四区五区 | av电影一区二区| 免费高清视频精品| 亚洲一区二区精品3399| 久久亚洲免费视频| 91精品视频网| 日本高清免费不卡视频| 国产成都精品91一区二区三| 视频一区中文字幕国产| 亚洲品质自拍视频| 国产午夜精品久久| 日韩精品一区二区三区视频播放 | 欧美xxx久久| 欧美日韩国产一二三| 成人动漫视频在线| 久久国产欧美日韩精品| 亚洲免费电影在线| 国产精品无圣光一区二区| 日韩欧美久久久| 欧美日韩国产在线观看| proumb性欧美在线观看| 国产精品资源网| 久久99久久99小草精品免视看| 亚欧色一区w666天堂| 亚洲欧美日韩精品久久久久| 国产精品视频免费看| 久久久久国产一区二区三区四区| 日韩精品一区二区三区视频在线观看| 欧美三级一区二区| 色香蕉成人二区免费| 成人av在线资源| 丰满少妇在线播放bd日韩电影| 久久99日本精品| 美女性感视频久久| 日韩在线一区二区三区| 午夜日韩在线观看| 日韩精品国产精品| 六月丁香综合在线视频| 日韩av一区二区三区| 丝瓜av网站精品一区二区| 午夜激情综合网| 日韩主播视频在线| 蜜桃视频一区二区三区| 美女在线视频一区| 国产一区二区不卡在线 | 中文字幕二三区不卡| 国产精品国产三级国产有无不卡 | 午夜精品福利视频网站| 午夜国产不卡在线观看视频| 免费成人在线播放| 国产精品中文字幕日韩精品 | 成人精品小蝌蚪| 99久久99久久免费精品蜜臀| 91亚洲大成网污www| av午夜精品一区二区三区| 91搞黄在线观看| 制服丝袜激情欧洲亚洲| 2014亚洲片线观看视频免费| 国产亚洲欧美中文| 亚洲欧美日本韩国| 亚洲已满18点击进入久久| 亚瑟在线精品视频| 国产美女久久久久| 风间由美一区二区av101| 91免费在线视频观看| 欧美午夜影院一区| 欧美一区日本一区韩国一区| 日韩女同互慰一区二区| 国产女人18毛片水真多成人如厕 | 一区二区高清免费观看影视大全| 天堂一区二区在线| 国产麻豆精品theporn| 91毛片在线观看| 欧美一区二区在线免费播放| 久久久99久久| 亚洲人成小说网站色在线| 亚洲超碰精品一区二区| 国产精品18久久久久久久久 | 国产亚洲va综合人人澡精品| 亚洲最色的网站| 日韩高清一级片| 成人一二三区视频| 欧美片网站yy| 国产精品视频看| 日韩极品在线观看| 成人小视频免费观看| 欧美精品自拍偷拍| 中文字幕中文字幕在线一区| 久久国内精品视频| 色狠狠桃花综合| 精品av久久707| 亚洲一区二区三区在线看| 国内精品久久久久影院色| 日本道精品一区二区三区| 337p日本欧洲亚洲大胆精品| 亚洲国产欧美日韩另类综合| 丰满岳乱妇一区二区三区| 欧美精品久久一区二区三区 | 亚洲免费高清视频在线| 国产激情一区二区三区| 欧美一二三四在线| 亚洲免费观看高清在线观看| 国产在线播放一区二区三区| 欧美酷刑日本凌虐凌虐| 综合网在线视频| 国产成人小视频| 欧美电视剧在线看免费| 亚洲福利电影网| 欧美在线啊v一区| 国产精品少妇自拍| 国产高清不卡二三区| 日韩欧美色综合网站| 亚洲国产毛片aaaaa无费看| 97精品电影院| 欧美激情中文不卡| 久久99精品国产91久久来源| 欧美三级视频在线播放| 亚洲三级在线免费观看| 成人国产精品免费网站| 精品免费99久久| 日韩精品免费专区| 717成人午夜免费福利电影| 亚洲国产一区视频| 色88888久久久久久影院野外| 国产精品久久久爽爽爽麻豆色哟哟| 国产一区二区三区观看| 久久久久久亚洲综合影院红桃| 捆绑调教美女网站视频一区| 9191久久久久久久久久久| 亚洲第一电影网| 欧美美女直播网站| 日韩主播视频在线| 日韩手机在线导航| 久久国产福利国产秒拍| 精品国产麻豆免费人成网站| 免费高清在线一区| 精品动漫一区二区三区在线观看| 久久国产综合精品| 国产午夜精品久久久久久久| 岛国一区二区在线观看| 国产欧美日韩三区| 成人av资源下载| 一区二区三区在线免费| 欧美视频自拍偷拍| 日韩av在线免费观看不卡| 欧美va亚洲va香蕉在线| 国产一区二区成人久久免费影院| 欧美国产欧美综合| 色av成人天堂桃色av| 视频一区欧美精品| 2023国产精品| 99vv1com这只有精品| 亚洲成精国产精品女| 精品少妇一区二区三区在线视频 | 日韩高清不卡一区二区三区| 欧美一区二区视频免费观看| 国产麻豆视频一区| 一区二区三区小说| 日韩精品一区二区三区在线观看| 成人一区二区三区|