⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdchart.c

📁 Nessus的应用与漏洞扫描技术的研究
💻 C
📖 第 1 页 / 共 5 页
字号:
	/* ----- solid poly region (volume) ----- */	/*  so that grid lines appear under solid */	if( do_vol )		{		setno = GDC_stack_type==GDC_STACK_DEPTH? num_hlc_sets? num_hlc_sets:															   num_sets:												 1; /* backmost*/		if( type == GDC_COMBO_HLC_BAR    ||			type == GDC_COMBO_LINE_BAR   ||			type == GDC_3DCOMBO_LINE_BAR ||			type == GDC_3DCOMBO_HLC_BAR )			{			if( uvol[0] != GDC_NOVALUE )				draw_3d_bar( im, PX(0), PX(0)+hlf_barwdth,								 PV(0), PV(uvol[0]),								 0, 0,								 ExtVolColor[0],								 ExtVolColor[0] );			for( i=1; i<num_points-1; ++i )				if( uvol[i] != GDC_NOVALUE )					draw_3d_bar( im, PX(i)-hlf_barwdth, PX(i)+hlf_barwdth,									 PV(0), PV(uvol[i]),									 0, 0,									 ExtVolColor[i],									 ExtVolColor[i] );			if( uvol[i] != GDC_NOVALUE )				draw_3d_bar( im, PX(i)-hlf_barwdth, PX(i),								 PV(0), PV(uvol[i]),								 0, 0,								 ExtVolColor[i],								 ExtVolColor[i] );			}		else		if( type == GDC_COMBO_HLC_AREA   ||			type == GDC_COMBO_LINE_AREA  ||			type == GDC_3DCOMBO_LINE_AREA||			type == GDC_3DCOMBO_HLC_AREA )			for( i=1; i<num_points; ++i )				if( uvol[i-1] != GDC_NOVALUE && uvol[i] != GDC_NOVALUE )					draw_3d_area( im, PX(i-1), PX(i),									 PV(0), PV(uvol[i-1]), PV(uvol[i]),									 0, 0,									 ExtVolColor[i],									 ExtVolColor[i] );		setno = 0;		}		/* volume polys done*/	if( GDC_annotation && threeD )		/* back half of annotation line */		{		int	x1 = PX(GDC_annotation->point+(do_bar?1:0)),			y1 = PY(lowest);		setno = GDC_stack_type==GDC_STACK_DEPTH? num_hlc_sets? num_hlc_sets:															   num_sets:												 1; /* backmost*/		gdImageLine( im, x1, y1, PX(GDC_annotation->point+(do_bar?1:0)), PY(lowest), AnnoteColor );		gdImageLine( im, PX(GDC_annotation->point+(do_bar?1:0)), PY(lowest),						 PX(GDC_annotation->point+(do_bar?1:0)), PY(highest)-2, AnnoteColor );		setno = 0;		}	/* ---------- start plotting the data ---------- */	switch( type )		{		case GDC_3DBAR:					/* depth, width, y interval need to allow for whitespace between bars */		case GDC_BAR:		/* --------- */		switch( GDC_stack_type )			{			case GDC_STACK_DEPTH:			for( setno=num_sets-1; setno>=0; --setno )		/* back sets first   PX, PY depth*/				for( i=0; i<num_points; ++i )					if( uvals[setno][i] != GDC_NOVALUE )						draw_3d_bar( im, PX(i+(do_bar?1:0))-hlf_barwdth, PX(i+(do_bar?1:0))+hlf_barwdth,										 PY(0), PY(uvals[setno][i]),										 xdepth_3D, ydepth_3D,										 ExtColor I(setno,i),										 threeD? ExtColorShd I(setno,i): ExtColor I(setno,i) );			setno = 0;			break;			case GDC_STACK_LAYER:				{				j = 0;/*				for( i=0; i<num_points; ++i )*//*					if( uvals[j][i] != GDC_NOVALUE )*//*						{*//*						lasty[i] = uvals[j][i];*//*						draw_3d_bar( im, PX(i+(do_bar?1:0))-hlf_barwdth, PX(i+(do_bar?1:0))+hlf_barwdth,*//*										 PY(0), PY(uvals[j][i]),*//*										 xdepth_3D, ydepth_3D,*//*										 ExtColor I(j,i),*//*										 threeD? ExtColorShd I(j,i): ExtColor I(j,i) );*//*						}*/				for( i=0; i<num_points; ++i )					{					struct BS#ifdef USE_ALLOCA								*barset =(struct BS*)alloca (num_sets * sizeof (struct BS));#else								barset[num_sets];#endif /* USE_ALLOCA */					float		lasty_pos = 0.0;					float		lasty_neg = 0.0;					int			k;					for( j=0, k=0; j<num_sets; ++j )						{						if( uvals[j][i] != GDC_NOVALUE )							{							if( uvals[j][i] < 0.0 )								{								barset[k].y1 = lasty_neg;								barset[k].y2 = uvals[j][i] + lasty_neg;								lasty_neg    = barset[k].y2;								}							else								{								barset[k].y1 = lasty_pos;								barset[k].y2 = uvals[j][i] + lasty_pos;								lasty_pos    = barset[k].y2;								}							barset[k].clr   = ExtColor I(j,i);							barset[k].shclr = threeD? ExtColorShd I(j,i): ExtColor I(j,i);							++k;							}						}					qsort( barset, k, sizeof(struct BS), barcmpr );					for( j=0; j<k; ++j )						{						draw_3d_bar( im,									 PX(i+(do_bar?1:0))-hlf_barwdth, PX(i+(do_bar?1:0))+hlf_barwdth,									 PY(barset[j].y1), PY(barset[j].y2),									 xdepth_3D, ydepth_3D,									 barset[j].clr,									 barset[j].shclr );						}					}				}				break;			case GDC_STACK_BESIDE:				{												/* h/.5, h/1, h/1.5, h/2, ...*/				int	new_barwdth = (int)( (float)hlf_barwdth / ((float)num_sets/2.0) );				for( i=0; i<num_points; ++i )					for( j=0; j<num_sets; ++j )						if( uvals[j][i] != GDC_NOVALUE )							draw_3d_bar( im, PX(i+(do_bar?1:0))-hlf_barwdth+new_barwdth*j+1,											 PX(i+(do_bar?1:0))-hlf_barwdth+new_barwdth*(j+1),											 PY(0), PY(uvals[j][i]),											 xdepth_3D, ydepth_3D,											 ExtColor I(j,i),											 threeD? ExtColorShd I(j,i): ExtColor I(j,i) );					}				break;			default:				break;			}						break;		case GDC_LINE:		case GDC_COMBO_LINE_BAR:		case GDC_COMBO_LINE_AREA:			for( j=num_sets-1; j>=0; --j )				for( i=1; i<num_points; ++i )					if( uvals[j][i-1] != GDC_NOVALUE && uvals[j][i] != GDC_NOVALUE )						{						gdImageLine( im, PX(i-1), PY(uvals[j][i-1]), PX(i), PY(uvals[j][i]), ExtColor I(j,i) );						gdImageLine( im, PX(i-1), PY(uvals[j][i-1])+1, PX(i), PY(uvals[j][i])+1, ExtColor I(j,i) );						}					else						{						if( uvals[j][i-1] != GDC_NOVALUE )							gdImageSetPixel( im, PX(i-1), PY(uvals[j][i-1]), ExtColor I(j,i) );						if( uvals[j][i] != GDC_NOVALUE )							gdImageSetPixel( im, PX(i), PY(uvals[j][i]), ExtColor I(j,i) );						}			break;		case GDC_3DLINE:		case GDC_3DCOMBO_LINE_BAR:		case GDC_3DCOMBO_LINE_AREA:			{			int#ifdef USE_ALLOCA				*y1 = (int*)alloca (num_sets * sizeof (int)),				*y2 = (int*)alloca (num_sets * sizeof (int));#else				y1[num_sets],				y2[num_sets];#endif /* USE_ALLOCA */			for( i=1; i<num_points; ++i )				{				if( GDC_stack_type == GDC_STACK_DEPTH )					{					for( j=num_sets-1; j>=0; --j )						if( uvals[j][i-1] != GDC_NOVALUE &&							uvals[j][i]   != GDC_NOVALUE )							{							setno = j;							y1[j] = PY(uvals[j][i-1]);							y2[j] = PY(uvals[j][i]);							draw_3d_line( im,										  PY(0),										  PX(i-1), PX(i), 										  &(y1[j]), &(y2[j]),										  xdepth_3D, ydepth_3D,										  1,										  &(ExtColor I(j,i)),										  &(ExtColorShd I(j,i)) );							setno = 0;							}					}				else				if( GDC_stack_type == GDC_STACK_BESIDE ||					GDC_stack_type == GDC_STACK_SUM )			/* all same plane*/					{					int		set;					int#ifdef USE_ALLOCA							*clr = (int*)alloca (num_sets * sizeof (int)),							*clrshd = (int*)alloca (num_sets * sizeof (int));#else							clr[num_sets],							clrshd[num_sets];#endif /* USE_ALLOCA */					float	usey1 = 0.0,							usey2 = 0.0;					for( j=0,set=0; j<num_sets; ++j )						if( uvals[j][i-1] != GDC_NOVALUE &&							uvals[j][i]   != GDC_NOVALUE )							{							if( GDC_stack_type == GDC_STACK_SUM )								{								usey1 += uvals[j][i-1];								usey2 += uvals[j][i];								}							else								{								usey1 = uvals[j][i-1];								usey2 = uvals[j][i];								}							y1[set]     = PY(usey1);							y2[set]     = PY(usey2);							clr[set]    = ExtColor I(j,i);							clrshd[set] = ExtColorShd I(j,i);	/* fred */							++set;							}					draw_3d_line( im,						  PY(0),						  PX(i-1), PX(i), 						  y1, y2,						  xdepth_3D, ydepth_3D,						  set,						  clr,						  clrshd );					}				}			}			break;		case GDC_AREA:		case GDC_3DAREA:		  switch( GDC_stack_type )			{			case GDC_STACK_SUM:				{				float#ifdef USE_ALLOCA						*lasty = (float*)alloca (num_points * sizeof (float));#else						lasty[num_points];#endif /* USE_ALLOCA */				j = 0;				for( i=1; i<num_points; ++i )					if( uvals[j][i] != GDC_NOVALUE )						{						lasty[i] = uvals[j][i];						if( uvals[j][i-1] != GDC_NOVALUE )							draw_3d_area( im, PX(i-1), PX(i),											 PY(0), PY(uvals[j][i-1]), PY(uvals[j][i]),											 xdepth_3D, ydepth_3D,											 ExtColor I(j,i),											 threeD? ExtColorShd I(j,i): ExtColor I(j,i) );						}				for( j=1; j<num_sets; ++j )					for( i=1; i<num_points; ++i )						if( uvals[j][i] != GDC_NOVALUE && uvals[j][i-1] != GDC_NOVALUE )							{							draw_3d_area( im, PX(i-1), PX(i),											 PY(lasty[i]), PY(lasty[i-1]+uvals[j][i-1]), PY(lasty[i]+uvals[j][i]),											 xdepth_3D, ydepth_3D,											 ExtColor I(j,i),                                             threeD? ExtColorShd I(j,i): ExtColor I(j,i) );							lasty[i] += uvals[j][i];							}				}				break;			case GDC_STACK_BESIDE:								/* behind w/o depth*/				for( j=num_sets-1; j>=0; --j )					/* back sets 1st  (setno = 0)*/					for( i=1; i<num_points; ++i )						if( uvals[j][i-1] != GDC_NOVALUE && uvals[j][i] != GDC_NOVALUE )							draw_3d_area( im, PX(i-1), PX(i),											 PY(0), PY(uvals[j][i-1]), PY(uvals[j][i]),											 xdepth_3D, ydepth_3D,											 ExtColor I(j,i),                                             threeD? ExtColorShd I(j,i): ExtColor I(j,i) );				break;			case GDC_STACK_DEPTH:			default:				for( setno=num_sets-1; setno>=0; --setno )		/* back sets first   PX, PY depth*/					for( i=1; i<num_points; ++i )						if( uvals[setno][i-1] != GDC_NOVALUE && uvals[setno][i] != GDC_NOVALUE )							draw_3d_area( im, PX(i-1), PX(i),											 PY(0), PY(uvals[setno][i-1]), PY(uvals[setno][i]),											 xdepth_3D, ydepth_3D,											 ExtColor I(setno,i),                                             threeD? ExtColorShd I(setno,i): ExtColor I(setno,i) );				setno = 0;			}			break;		case GDC_3DHILOCLOSE:		case GDC_3DCOMBO_HLC_BAR:		case GDC_3DCOMBO_HLC_AREA:			{			gdPoint     poly[4];			for( j=num_hlc_sets-1; j>=0; --j )			 {			 for( i=1; i<num_points+1; ++i )				 if( uvals[CLOSESET+j*3][i-1] != GDC_NOVALUE )					 {					 if( (GDC_HLC_style & GDC_HLC_I_CAP) &&			/* bottom half of 'I'*/						 uvals[LOWSET+j*3][i-1] != GDC_NOVALUE )						 {						 SET_3D_POLY( poly, PX(i-1)-hlf_hlccapwdth, PX(i-1)+hlf_hlccapwdth,											PY(uvals[LOWSET+j*3][i-1]), PY(uvals[LOWSET+j*3][i-1]),											xdepth_3D, ydepth_3D );						 gdImageFilledPolygon( im, poly, 4, ExtColor I(LOWSET+j*3,i-1) );						 gdImagePolygon( im, poly, 4, ExtColorShd I(LOWSET+j*3,i-1) );						 }																	 /* all HLC have vert line*/					 if( uvals[LOWSET+j*3][i-1] != GDC_NOVALUE )						 {											/* bottom 'half'*/						 SET_3D_POLY( poly, PX(i-1), PX(i-1),											PY(uvals[LOWSET+j*3][i-1]), PY(uvals[CLOSESET+j*3][i-1]),											xdepth_3D, ydepth_3D );						 gdImageFilledPolygon( im, poly, 4, ExtColor I(LOWSET+j*3,i-1) );						 gdImagePolygon( im, poly, 4, ExtColorShd I(LOWSET+j*3,i-1) );						 }					 if( uvals[HIGHSET+j*3][i-1] != GDC_NOVALUE )						 {											/* top 'half'*/						 SET_3D_POLY( poly, PX(i-1), PX(i-1),											PY(uvals[CLOSESET+j*3][i-1]), PY(uvals[HIGHSET+j*3][i-1]),											xdepth_3D, ydepth_3D );						 gdImageFilledPolygon( im, poly, 4, ExtColor I(HIGHSET+j*3,i-1) );						 gdImagePolygon( im, poly, 4, ExtColorShd I(HIGHSET+j*3,i-1) );						 }																	/* line at close*/					 gdImageLine( im, PX(i-1),           PY(uvals[CLOSESET+j*3][i-1]),									  PX(i-1)+xdepth_3D, PY(uvals[CLOSESET+j*3][i-1])-ydepth_3D,									  ExtColorShd I(CLOSESET+j*3,i-1) );																 /* top half 'I'*/					 if( !( (GDC_HLC_style & GDC_HLC_DIAMOND) &&							(PY(uvals[HIGHSET+j*3][i-1]) > PY(uvals[CLOSESET+j*3][i-1])-hlf_hlccapwdth) ) &&						 uvals[HIGHSET+j*3][i-1] != GDC_NOVALUE )						 if( GDC_HLC_style & GDC_HLC_I_CAP )							 {							 SET_3D_POLY( poly, PX(i-1)-hlf_hlccapwdth, PX(i-1)+hlf_hlccapwdth,												PY(uvals[HIGHSET+j*3][i-1]), PY(uvals[HIGHSET+j*3][i-1]),												xdepth_3D, ydepth_3D );							 gdImageFilledPolygon( im, poly, 4, ExtColor I(HIGHSET+j*3,i-1) );							 gdImagePolygon( im, poly, 4, ExtColorShd I(HIGHSET+j*3,i-1) );							 }					 if( i < num_points &&						 uvals[CLOSESET+j*3][i] != GDC_NOVALUE )						 {						 if( GDC_HLC_style & GDC_HLC_CLOSE_CONNECTED )	/* line from prev close */							 {							 SET_3D_POLY( poly, PX(i-1), PX(i),												PY(uvals[CLOSESET+j*3][i-1]), PY(uvals[CLOSESET+j*3][i-1]),												xdepth_3D, ydepth_3D );							 gdImageFilledPolygon( im, poly, 4, ExtColor I(CLOSESET+j*3,i) );							 gdImagePolygon( im, poly, 4, ExtColorShd I(CLOSESET+j*3,i) );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -