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

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

?? gd.c

?? 網絡編程
?? C
?? 第 1 頁 / 共 4 頁
字號:
#include <stdio.h>#include <math.h>#include <string.h>#include <stdlib.h>#include "gd.h"#include "mtables.c"static void gdImageBrushApply(gdImagePtr im, int x, int y);static void gdImageTileApply(gdImagePtr im, int x, int y);gdImagePtr gdImageCreate(int sx, int sy){	int i;	gdImagePtr im;	im = (gdImage *) malloc(sizeof(gdImage));	/* NOW ROW-MAJOR IN GD 1.3 */	im->pixels = (unsigned char **) malloc(sizeof(unsigned char *) * sy);	im->polyInts = 0;	im->polyAllocated = 0;	im->brush = 0;	im->tile = 0;	im->style = 0;	for (i=0; (i<sy); i++) {		/* NOW ROW-MAJOR IN GD 1.3 */		im->pixels[i] = (unsigned char *) calloc(			sx, sizeof(unsigned char));	}		im->sx = sx;	im->sy = sy;	im->colorsTotal = 0;	im->transparent = (-1);	im->interlace = 0;	return im;}void gdImageDestroy(gdImagePtr im){	int i;	for (i=0; (i<im->sy); i++) {		free(im->pixels[i]);	}		free(im->pixels);	if (im->polyInts) {			free(im->polyInts);	}	if (im->style) {		free(im->style);	}	free(im);}int gdImageColorClosest(gdImagePtr im, int r, int g, int b){	int i;	long rd, gd, bd;	int ct = (-1);	long mindist = 0;	for (i=0; (i<(im->colorsTotal)); i++) {		long dist;		if (im->open[i]) {			continue;		}		rd = (im->red[i] - r);			gd = (im->green[i] - g);		bd = (im->blue[i] - b);		dist = rd * rd + gd * gd + bd * bd;		if ((i == 0) || (dist < mindist)) {			mindist = dist;				ct = i;		}	}	return ct;}int gdImageColorExact(gdImagePtr im, int r, int g, int b){	int i;	for (i=0; (i<(im->colorsTotal)); i++) {		if (im->open[i]) {			continue;		}		if ((im->red[i] == r) && 			(im->green[i] == g) &&			(im->blue[i] == b)) {			return i;		}	}	return -1;}int gdImageColorAllocate(gdImagePtr im, int r, int g, int b){	int i;	int ct = (-1);	for (i=0; (i<(im->colorsTotal)); i++) {		if (im->open[i]) {			ct = i;			break;		}	}		if (ct == (-1)) {		ct = im->colorsTotal;		if (ct == gdMaxColors) {			return -1;		}		im->colorsTotal++;	}	im->red[ct] = r;	im->green[ct] = g;	im->blue[ct] = b;	im->open[ct] = 0;	return ct;}void gdImageColorDeallocate(gdImagePtr im, int color){	/* Mark it open. */	im->open[color] = 1;}void gdImageColorTransparent(gdImagePtr im, int color){	im->transparent = color;}void gdImageSetPixel(gdImagePtr im, int x, int y, int color){	int p;	switch(color) {		case gdStyled:		if (!im->style) {			/* Refuse to draw if no style is set. */			return;		} else {			p = im->style[im->stylePos++];		}		if (p != (gdTransparent)) {			gdImageSetPixel(im, x, y, p);		}		im->stylePos = im->stylePos %  im->styleLength;		break;		case gdStyledBrushed:		if (!im->style) {			/* Refuse to draw if no style is set. */			return;		}		p = im->style[im->stylePos++];		if ((p != gdTransparent) && (p != 0)) {			gdImageSetPixel(im, x, y, gdBrushed);		}		im->stylePos = im->stylePos %  im->styleLength;		break;		case gdBrushed:		gdImageBrushApply(im, x, y);		break;		case gdTiled:		gdImageTileApply(im, x, y);		break;		default:		if (gdImageBoundsSafe(im, x, y)) {			/* NOW ROW-MAJOR IN GD 1.3 */			im->pixels[y][x] = color;		}		break;	}}static void gdImageBrushApply(gdImagePtr im, int x, int y){	int lx, ly;	int hy;	int hx;	int x1, y1, x2, y2;	int srcx, srcy;	if (!im->brush) {		return;	}	hy = gdImageSY(im->brush)/2;	y1 = y - hy;	y2 = y1 + gdImageSY(im->brush);		hx = gdImageSX(im->brush)/2;	x1 = x - hx;	x2 = x1 + gdImageSX(im->brush);	srcy = 0;	for (ly = y1; (ly < y2); ly++) {		srcx = 0;		for (lx = x1; (lx < x2); lx++) {			int p;			p = gdImageGetPixel(im->brush, srcx, srcy);			/* Allow for non-square brushes! */			if (p != gdImageGetTransparent(im->brush)) {				gdImageSetPixel(im, lx, ly,					im->brushColorMap[p]);			}			srcx++;		}		srcy++;	}	}		static void gdImageTileApply(gdImagePtr im, int x, int y){	int srcx, srcy;	int p;	if (!im->tile) {		return;	}	srcx = x % gdImageSX(im->tile);	srcy = y % gdImageSY(im->tile);	p = gdImageGetPixel(im->tile, srcx, srcy);	/* Allow for transparency */	if (p != gdImageGetTransparent(im->tile)) {		gdImageSetPixel(im, x, y,			im->tileColorMap[p]);	}}		int gdImageGetPixel(gdImagePtr im, int x, int y){	if (gdImageBoundsSafe(im, x, y)) {		/* NOW ROW-MAJOR IN GD 1.3 */		return im->pixels[y][x];	} else {		return 0;	}}/* Bresenham as presented in Foley & Van Dam */void gdImageLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color){	int dx, dy, incr1, incr2, d, x, y, xend, yend, xdirflag, ydirflag;	dx = abs(x2-x1);	dy = abs(y2-y1);	if (dy <= dx) {		d = 2*dy - dx;		incr1 = 2*dy;		incr2 = 2 * (dy - dx);		if (x1 > x2) {			x = x2;			y = y2;			ydirflag = (-1);			xend = x1;		} else {			x = x1;			y = y1;			ydirflag = 1;			xend = x2;		}		gdImageSetPixel(im, x, y, color);		if (((y2 - y1) * ydirflag) > 0) {			while (x < xend) {				x++;				if (d <0) {					d+=incr1;				} else {					y++;					d+=incr2;				}				gdImageSetPixel(im, x, y, color);			}		} else {			while (x < xend) {				x++;				if (d <0) {					d+=incr1;				} else {					y--;					d+=incr2;				}				gdImageSetPixel(im, x, y, color);			}		}			} else {		d = 2*dx - dy;		incr1 = 2*dx;		incr2 = 2 * (dx - dy);		if (y1 > y2) {			y = y2;			x = x2;			yend = y1;			xdirflag = (-1);		} else {			y = y1;			x = x1;			yend = y2;			xdirflag = 1;		}		gdImageSetPixel(im, x, y, color);		if (((x2 - x1) * xdirflag) > 0) {			while (y < yend) {				y++;				if (d <0) {					d+=incr1;				} else {					x++;					d+=incr2;				}				gdImageSetPixel(im, x, y, color);			}		} else {			while (y < yend) {				y++;				if (d <0) {					d+=incr1;				} else {					x--;					d+=incr2;				}				gdImageSetPixel(im, x, y, color);			}		}	}}static void dashedSet(gdImagePtr im, int x, int y, int color,	int *onP, int *dashStepP);void gdImageDashedLine(gdImagePtr im, int x1, int y1, int x2, int y2, int color){	int dx, dy, incr1, incr2, d, x, y, xend, yend, xdirflag, ydirflag;	int dashStep = 0;	int on = 1;	dx = abs(x2-x1);	dy = abs(y2-y1);	if (dy <= dx) {		d = 2*dy - dx;		incr1 = 2*dy;		incr2 = 2 * (dy - dx);		if (x1 > x2) {			x = x2;			y = y2;			ydirflag = (-1);			xend = x1;		} else {			x = x1;			y = y1;			ydirflag = 1;			xend = x2;		}		dashedSet(im, x, y, color, &on, &dashStep);		if (((y2 - y1) * ydirflag) > 0) {			while (x < xend) {				x++;				if (d <0) {					d+=incr1;				} else {					y++;					d+=incr2;				}				dashedSet(im, x, y, color, &on, &dashStep);			}		} else {			while (x < xend) {				x++;				if (d <0) {					d+=incr1;				} else {					y--;					d+=incr2;				}				dashedSet(im, x, y, color, &on, &dashStep);			}		}			} else {		d = 2*dx - dy;		incr1 = 2*dx;		incr2 = 2 * (dx - dy);		if (y1 > y2) {			y = y2;			x = x2;			yend = y1;			xdirflag = (-1);		} else {			y = y1;			x = x1;			yend = y2;			xdirflag = 1;		}		dashedSet(im, x, y, color, &on, &dashStep);		if (((x2 - x1) * xdirflag) > 0) {			while (y < yend) {				y++;				if (d <0) {					d+=incr1;				} else {					x++;					d+=incr2;				}				dashedSet(im, x, y, color, &on, &dashStep);			}		} else {			while (y < yend) {				y++;				if (d <0) {					d+=incr1;				} else {					x--;					d+=incr2;				}				dashedSet(im, x, y, color, &on, &dashStep);			}		}	}}static void dashedSet(gdImagePtr im, int x, int y, int color,	int *onP, int *dashStepP){	int dashStep = *dashStepP;	int on = *onP;	dashStep++;	if (dashStep == gdDashSize) {		dashStep = 0;		on = !on;	}	if (on) {		gdImageSetPixel(im, x, y, color);	}	*dashStepP = dashStep;	*onP = on;}	int gdImageBoundsSafe(gdImagePtr im, int x, int y){	return (!(((y < 0) || (y >= im->sy)) ||		((x < 0) || (x >= im->sx))));}void gdImageChar(gdImagePtr im, gdFontPtr f, int x, int y, 	int c, int color){	int cx, cy;	int px, py;	int fline;	cx = 0;	cy = 0;	if ((c < f->offset) || (c >= (f->offset + f->nchars))) {		return;	}	fline = (c - f->offset) * f->h * f->w;	for (py = y; (py < (y + f->h)); py++) {		for (px = x; (px < (x + f->w)); px++) {			if (f->data[fline + cy * f->w + cx]) {				gdImageSetPixel(im, px, py, color);				}			cx++;		}		cx = 0;		cy++;	}}void gdImageCharUp(gdImagePtr im, gdFontPtr f, 	int x, int y, int c, int color){	int cx, cy;	int px, py;	int fline;	cx = 0;	cy = 0;	if ((c < f->offset) || (c >= (f->offset + f->nchars))) {		return;	}	fline = (c - f->offset) * f->h * f->w;	for (py = y; (py > (y - f->w)); py--) {		for (px = x; (px < (x + f->h)); px++) {			if (f->data[fline + cy * f->w + cx]) {				gdImageSetPixel(im, px, py, color);				}			cy++;		}		cy = 0;		cx++;	}}void gdImageString(gdImagePtr im, gdFontPtr f, 	int x, int y, unsigned char *s, int color){	int i;	int l;	l = strlen((char*)s);	for (i=0; (i<l); i++) {		gdImageChar(im, f, x, y, s[i], color);		x += f->w;	}}void gdImageStringUp(gdImagePtr im, gdFontPtr f, 	int x, int y, unsigned char *s, int color){	int i;	int l;	l = strlen((char*)s);	for (i=0; (i<l); i++) {		gdImageCharUp(im, f, x, y, s[i], color);		y -= f->w;	}}static int strlen16(unsigned short *s);void gdImageString16(gdImagePtr im, gdFontPtr f, 	int x, int y, unsigned short *s, int color){	int i;	int l;	l = strlen16(s);	for (i=0; (i<l); i++) {		gdImageChar(im, f, x, y, s[i], color);		x += f->w;	}}void gdImageStringUp16(gdImagePtr im, gdFontPtr f, 	int x, int y, unsigned short *s, int color){	int i;	int l;	l = strlen16(s);	for (i=0; (i<l); i++) {		gdImageCharUp(im, f, x, y, s[i], color);		y -= f->w;	}}static int strlen16(unsigned short *s){	int len = 0;	while (*s) {		s++;		len++;	}	return len;}/* s and e are integers modulo 360 (degrees), with 0 degrees  being the rightmost extreme and degrees changing clockwise.  cx and cy are the center in pixels; w and h are the horizontal   and vertical diameter in pixels. Nice interface, but slow, since  I don't yet use Bresenham (I'm using an inefficient but  simple solution with too much work going on in it; generalizing  Bresenham to ellipses and partial arcs of ellipses is non-trivial,  at least for me) and there are other inefficiencies (small circles  do far too much work). */void gdImageArc(gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color){	int i;	int lx = 0, ly = 0;	int w2, h2;	w2 = w/2;	h2 = h/2;	while (e < s) {		e += 360;	}	for (i=s; (i <= e); i++) {		int x, y;		x = ((long)cost[i % 360] * (long)w2 / costScale) + cx; 		y = ((long)sint[i % 360] * (long)h2 / sintScale) + cy;		if (i != s) {			gdImageLine(im, lx, ly, x, y, color);			}		lx = x;		ly = y;	}}#if 0	/* Bresenham octant code, which I should use eventually */	int x, y, d;	x = 0;	y = w;	d = 3-2*w;	while (x < y) {		gdImageSetPixel(im, cx+x, cy+y, color);		if (d < 0) {			d += 4 * x + 6;		} else {			d += 4 * (x - y) + 10;			y--;		}		x++;	}	if (x == y) {		gdImageSetPixel(im, cx+x, cy+y, color);	}#endifvoid gdImageFillToBorder(gdImagePtr im, int x, int y, int border, int color){	int lastBorder;	/* Seek left */	int leftLimit, rightLimit;	int i;	leftLimit = (-1);	if (border < 0) {		/* Refuse to fill to a non-solid border */		return;	}	for (i = x; (i >= 0); i--) {		if (gdImageGetPixel(im, i, y) == border) {			break;		}		gdImageSetPixel(im, i, y, color);		leftLimit = i;	}	if (leftLimit == (-1)) {		return;	}	/* Seek right */	rightLimit = x;	for (i = (x+1); (i < im->sx); i++) {			if (gdImageGetPixel(im, i, y) == border) {			break;		}		gdImageSetPixel(im, i, y, color);		rightLimit = i;	}	/* Look at lines above and below and start paints */	/* Above */	if (y > 0) {		lastBorder = 1;		for (i = leftLimit; (i <= rightLimit); i++) {			int c;			c = gdImageGetPixel(im, i, y-1);			if (lastBorder) {				if ((c != border) && (c != color)) {						gdImageFillToBorder(im, i, y-1, 						border, color);							lastBorder = 0;				}			} else if ((c == border) || (c == color)) {				lastBorder = 1;			}		}	}	/* Below */	if (y < ((im->sy) - 1)) {		lastBorder = 1;		for (i = leftLimit; (i <= rightLimit); i++) {			int c;			c = gdImageGetPixel(im, i, y+1);			if (lastBorder) {				if ((c != border) && (c != color)) {						gdImageFillToBorder(im, i, y+1, 						border, color);							lastBorder = 0;				}			} else if ((c == border) || (c == color)) {				lastBorder = 1;			}		}	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产色综合久久久蜜香臀| 日韩精品一区二区在线观看| 青娱乐精品视频| 中文字幕视频一区二区三区久| 欧美日本视频在线| 丁香六月综合激情| 奇米精品一区二区三区在线观看一| 国产精品短视频| 26uuu色噜噜精品一区二区| 欧美曰成人黄网| 成人avav在线| 国产伦精品一区二区三区在线观看 | 99久久精品99国产精品| 久久99国产精品麻豆| 亚洲成a人片在线不卡一二三区| 亚洲国产成人一区二区三区| 884aa四虎影成人精品一区| 91免费视频网| 国产激情一区二区三区| 美女视频黄a大片欧美| 亚洲激情在线激情| 国产精品福利电影一区二区三区四区| 精品国一区二区三区| 欧美精选一区二区| 色94色欧美sute亚洲线路一久| 成人av资源在线| 国产伦精品一区二区三区在线观看| 日韩国产在线观看| 亚洲成人动漫在线观看| 亚洲亚洲人成综合网络| 亚洲欧美日韩国产综合在线| 欧美国产一区二区| 国产欧美一区二区三区沐欲| www亚洲一区| 久久综合久久久久88| 欧美大片在线观看一区二区| 欧美一区二区三区不卡| 欧美日韩国产综合一区二区三区| 欧洲一区二区三区在线| 在线亚洲欧美专区二区| 色狠狠一区二区三区香蕉| 91婷婷韩国欧美一区二区| 91麻豆文化传媒在线观看| 色综合久久综合网| 在线亚洲一区二区| 色av成人天堂桃色av| 欧美性受极品xxxx喷水| 日本道免费精品一区二区三区| 99久久免费精品高清特色大片| 99久久久久久| 欧美午夜精品久久久久久孕妇| 欧美在线免费观看视频| 精品视频免费看| 欧美高清你懂得| 日韩精品一区二区三区在线| 久久久久9999亚洲精品| 日本一区二区成人| 亚洲美女在线国产| 亚洲一区二区影院| 蜜臀av亚洲一区中文字幕| 另类小说欧美激情| 国产成人自拍网| 99国产精品视频免费观看| 欧洲激情一区二区| 欧美一区二区三区在线观看| 欧美mv和日韩mv国产网站| 亚洲国产精品精华液ab| 亚洲综合色丁香婷婷六月图片| 日本美女一区二区三区视频| 国产一区二区精品久久99| 成人av综合一区| 欧美日本乱大交xxxxx| 久久综合成人精品亚洲另类欧美 | 欧美高清在线视频| 亚洲综合一区二区| 蜜芽一区二区三区| 成人污污视频在线观看| 色老头久久综合| 欧美成人a∨高清免费观看| 国产精品你懂的在线| 亚洲一区欧美一区| 国产一区二区三区免费观看| 色哟哟国产精品免费观看| 日韩精品一区二区三区视频在线观看| 国产日韩精品一区二区三区| 亚洲尤物视频在线| 国产精品一区二区不卡| 欧亚一区二区三区| 久久综合久久99| 亚洲欧美区自拍先锋| 麻豆91免费观看| 色综合久久66| 久久久不卡网国产精品一区| 一个色妞综合视频在线观看| 国模少妇一区二区三区| 欧美色男人天堂| 中文字幕在线一区免费| 强制捆绑调教一区二区| 日本高清不卡一区| 国产亚洲人成网站| 日本中文字幕一区| 91久久久免费一区二区| 日本一区二区三区久久久久久久久不| 视频在线观看国产精品| 色偷偷久久一区二区三区| 久久亚洲综合色| 男女性色大片免费观看一区二区| 91在线精品一区二区| 久久久午夜电影| 奇米在线7777在线精品| 欧美在线小视频| 亚洲丝袜精品丝袜在线| 国产成人综合自拍| 久久婷婷久久一区二区三区| 天天色图综合网| 欧美午夜免费电影| 亚洲女子a中天字幕| 福利一区二区在线| 精品成人一区二区| 六月丁香综合在线视频| 91麻豆精品国产自产在线观看一区| 亚洲乱码中文字幕| av一本久道久久综合久久鬼色| 久久久久久亚洲综合影院红桃| 免费看日韩精品| 欧美一区三区二区| 午夜精品久久久久久久99樱桃| 色天使色偷偷av一区二区| 专区另类欧美日韩| 成人黄色电影在线| 亚洲国产精品高清| 国产毛片精品国产一区二区三区| 精品国产制服丝袜高跟| 免费av网站大全久久| 欧美一级高清片| 久久99精品久久久久| 久久综合九色综合欧美98| 国产资源精品在线观看| 欧美精品一区二区久久久| 国内精品写真在线观看| 久久女同精品一区二区| 国产成人鲁色资源国产91色综| 欧美激情在线一区二区| 成人免费观看男女羞羞视频| 国产精品麻豆视频| jlzzjlzz亚洲女人18| 亚洲视频 欧洲视频| 91免费在线看| 亚洲成人激情综合网| 91精品国产入口| 精品一区二区精品| 国产亚洲欧美一区在线观看| 粉嫩久久99精品久久久久久夜| 亚洲丝袜美腿综合| 欧美日韩一区二区三区四区| 美女一区二区久久| 久久久噜噜噜久久中文字幕色伊伊 | 三级在线观看一区二区| 欧美一级高清片| 国产99久久久国产精品| 国产精品久久久久久亚洲毛片 | 国产自产视频一区二区三区| 国产精品素人视频| 欧美性色黄大片手机版| 免费成人av在线| 国产精品天天看| 欧美日韩大陆一区二区| 久久av中文字幕片| 中文字幕日韩一区| 欧美日韩一区二区在线观看视频| 美国一区二区三区在线播放| 日本一区二区久久| 欧美片网站yy| 国产激情一区二区三区桃花岛亚洲| 亚洲欧洲中文日韩久久av乱码| 欧美性大战xxxxx久久久| 黄网站免费久久| 最新久久zyz资源站| 欧美视频一区在线观看| 国内精品久久久久影院色| 综合色天天鬼久久鬼色| 宅男在线国产精品| 99久免费精品视频在线观看| 日韩av一级片| 亚洲天堂中文字幕| 日韩欧美电影一二三| 91小视频在线| 国内精品第一页| 性久久久久久久| 1024成人网色www| 亚洲精品在线观看网站| 欧美日韩一区二区三区免费看| 国产成人精品免费网站| 日韩精品福利网| 亚洲欧美日韩成人高清在线一区| 精品女同一区二区| 欧美日韩一区高清| 91在线视频网址| 成人午夜视频福利| 免费在线观看视频一区|