• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setlinestyle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setlinestyle函数的典型用法代码示例。如果您正苦于以下问题:C++ setlinestyle函数的具体用法?C++ setlinestyle怎么用?C++ setlinestyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setlinestyle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: showcounter

void showcounter(int x,int y,int i)
{
 int col;

 switch(i)
 {
  case 0:col=BLUE;
	 break;
  case 1:col=YELLOW;
	 break;
  case 2:col=GREEN;
	 break;
  case 3:col=MAGENTA;
	 break;
 }

 setlinestyle(0,0,1);
 setfillstyle(1,col);
 fillellipse(x*48+24,y*48+24,20,20);
 settextstyle(3,0,2);
 settextjustify(1,1);
 setcolor(RED);
 outtextxy(x*48+24,y*48+24,pini[i]);
}
开发者ID:rahuljain,项目名称:playground_CPlusPlus,代码行数:24,代码来源:PROJECT1.CPP


示例2: drawFeature

void drawFeature(unsigned i, char mini)
{
    t_point* featurePoints;
    if(mini)
    {
        allLargeFeatures[i].updatepolyMiniPoints();
        featurePoints = allLargeFeatures[i].getpolyPoints();
        i = allLargeFeatures[i].getID();
    } else {
        featurePoints = allFeatures[i].getpolyPoints();
    }
    
    //closed features are polygons
    if (allFeatures[i].isClosed())
    {
        setcolor(colorScheme[allFeatures[i].getcolorID()][colorMode]);
        fillpoly(featurePoints, allFeatures[i].getnPoints());

    } else { //open features are lines
        setcolor(colorScheme[allFeatures[i].getcolorID()][colorMode]);
        if(mini)
        {
            for (unsigned j = 0; j < allFeatures[i].getnPoints() - 1; j ++) {
                drawline(featurePoints[j],featurePoints[j+1]);
            }
        } else {
            setlinewidth(floor(allFeatures[i].getlineWidth()/trueScreen.get_width()));
            setlinestyle(allFeatures[i].getlineStyle());
            for (unsigned j = 0; j < allFeatures[i].getnPoints() - 1; j ++) {
                drawline(featurePoints[j],featurePoints[j+1]);
                fillarc(featurePoints[j].x,featurePoints[j].y,allFeatures[i].getlineWidth()/2200,0,360);
            }
            fillarc(featurePoints[allFeatures[i].getnPoints() - 1].x,featurePoints[allFeatures[i].getnPoints() - 1].y,allFeatures[i].getlineWidth()/2200,0,360);
        }           
    }
}
开发者ID:lifeishard,项目名称:AccessMap,代码行数:36,代码来源:DrawBackground.cpp


示例3: setlinestyle

void Bunches::draw_all(Logic_Nim &nim) {
	setlinestyle(0, 0, 1);
	for (int i = 0; i < Logic_Nim::num_of_bunches; i++)
		Bunches::draw_bunch(i, nim);
}
开发者ID:Students03,项目名称:Nim,代码行数:5,代码来源:Bunches.cpp


示例4: ruler_info_draw_pixel

static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *arg)
{
	Scene *scene = CTX_data_scene(C);
	UnitSettings *unit = &scene->unit;
	RulerItem *ruler_item;
	RulerInfo *ruler_info = arg;
	RegionView3D *rv3d = ruler_info->ar->regiondata;
//	ARegion *ar = ruler_info->ar;
	const float cap_size = 4.0f;
	const float bg_margin = 4.0f * U.pixelsize;
	const float bg_radius = 4.0f * U.pixelsize;
	const float arc_size = 64.0f * U.pixelsize;
#define ARC_STEPS 24
	const int arc_steps = ARC_STEPS;
	int i;
	//unsigned int color_act = 0x666600;
	unsigned int color_act = 0xffffff;
	unsigned int color_base = 0x0;
	unsigned char color_back[4] = {0xff, 0xff, 0xff, 0x80};
	unsigned char color_text[3];
	unsigned char color_wire[3];

	/* anti-aliased lines for more consistent appearance */
	glEnable(GL_LINE_SMOOTH);

	BLF_enable(blf_mono_font, BLF_ROTATION);
	BLF_size(blf_mono_font, 14 * U.pixelsize, U.dpi);
	BLF_rotation(blf_mono_font, 0.0f);

	UI_GetThemeColor3ubv(TH_TEXT, color_text);
	UI_GetThemeColor3ubv(TH_WIRE, color_wire);

	for (ruler_item = ruler_info->items.first, i = 0; ruler_item; ruler_item = ruler_item->next, i++) {
		const bool is_act = (i == ruler_info->item_active);
		float dir_ruler[2];
		float co_ss[3][2];
		int j;

		/* should these be checked? - ok for now not to */
		for (j = 0; j < 3; j++) {
			ED_view3d_project_float_global(ar, ruler_item->co[j], co_ss[j], V3D_PROJ_TEST_NOP);
		}

		glEnable(GL_BLEND);

		cpack(is_act ? color_act : color_base);

		if (ruler_item->flag & RULERITEM_USE_ANGLE) {
			glBegin(GL_LINE_STRIP);
			for (j = 0; j < 3; j++) {
				glVertex2fv(co_ss[j]);
			}
			glEnd();
			cpack(0xaaaaaa);
			setlinestyle(3);
			glBegin(GL_LINE_STRIP);
			for (j = 0; j < 3; j++) {
				glVertex2fv(co_ss[j]);
			}
			glEnd();
			setlinestyle(0);

			/* arc */
			{
				float dir_tmp[3];
				float co_tmp[3];
				float arc_ss_coords[ARC_STEPS + 1][2];

				float dir_a[3];
				float dir_b[3];
				float quat[4];
				float axis[3];
				float angle;
				const float px_scale = (ED_view3d_pixel_size(rv3d, ruler_item->co[1]) *
				                        min_fff(arc_size,
				                                len_v2v2(co_ss[0], co_ss[1]) / 2.0f,
				                                len_v2v2(co_ss[2], co_ss[1]) / 2.0f));

				sub_v3_v3v3(dir_a, ruler_item->co[0], ruler_item->co[1]);
				sub_v3_v3v3(dir_b, ruler_item->co[2], ruler_item->co[1]);
				normalize_v3(dir_a);
				normalize_v3(dir_b);

				cross_v3_v3v3(axis, dir_a, dir_b);
				angle = angle_normalized_v3v3(dir_a, dir_b);

				axis_angle_to_quat(quat, axis, angle / arc_steps);

				copy_v3_v3(dir_tmp, dir_a);

				glColor3ubv(color_wire);

				for (j = 0; j <= arc_steps; j++) {
					madd_v3_v3v3fl(co_tmp, ruler_item->co[1], dir_tmp, px_scale);
					ED_view3d_project_float_global(ar, co_tmp, arc_ss_coords[j], V3D_PROJ_TEST_NOP);
					mul_qt_v3(quat, dir_tmp);
				}

				glEnableClientState(GL_VERTEX_ARRAY);
				glVertexPointer(2, GL_FLOAT, 0, arc_ss_coords);
//.........这里部分代码省略.........
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:101,代码来源:view3d_ruler.c


示例5: gp_draw_data

/* draw grease-pencil datablock */
static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag)
{
	bGPDlayer *gpl, *actlay=NULL;
	
	/* reset line drawing style (in case previous user didn't reset) */
	setlinestyle(0);
	
	/* turn on smooth lines (i.e. anti-aliasing) */
	glEnable(GL_LINE_SMOOTH);
	
	/* turn on alpha-blending */
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glEnable(GL_BLEND);
		
	/* loop over layers, drawing them */
	for (gpl= gpd->layers.first; gpl; gpl= gpl->next) {
		bGPDframe *gpf;
		
		short debug = (gpl->flag & GP_LAYER_DRAWDEBUG) ? 1 : 0;
		short lthick= gpl->thickness;
		float color[4], tcolor[4];
		
		/* don't draw layer if hidden */
		if (gpl->flag & GP_LAYER_HIDE) 
			continue;
		
		/* if layer is active one, store pointer to it */
		if (gpl->flag & GP_LAYER_ACTIVE)
			actlay= gpl;
		
		/* get frame to draw */
		gpf= gpencil_layer_getframe(gpl, cfra, 0);
		if (gpf == NULL) 
			continue;
		
		/* set color, stroke thickness, and point size */
		glLineWidth(lthick);
		QUATCOPY(color, gpl->color); // just for copying 4 array elements
		QUATCOPY(tcolor, gpl->color); // additional copy of color (for ghosting)
		glColor4f(color[0], color[1], color[2], color[3]);
		glPointSize((float)(gpl->thickness + 2));
		
		/* draw 'onionskins' (frame left + right) */
		if (gpl->flag & GP_LAYER_ONIONSKIN) {
			/* drawing method - only immediately surrounding (gstep = 0), or within a frame range on either side (gstep > 0)*/			
			if (gpl->gstep) {
				bGPDframe *gf;
				float fac;
				
				/* draw previous frames first */
				for (gf=gpf->prev; gf; gf=gf->prev) {
					/* check if frame is drawable */
					if ((gpf->framenum - gf->framenum) <= gpl->gstep) {
						/* alpha decreases with distance from curframe index */
						fac= (float)(gpf->framenum - gf->framenum) / (float)gpl->gstep;
						tcolor[3] = color[3] - fac;
						gp_draw_strokes(gf, offsx, offsy, winx, winy, dflag, debug, lthick, tcolor);
					}
					else 
						break;
				}
				
				/* now draw next frames */
				for (gf= gpf->next; gf; gf=gf->next) {
					/* check if frame is drawable */
					if ((gf->framenum - gpf->framenum) <= gpl->gstep) {
						/* alpha decreases with distance from curframe index */
						fac= (float)(gf->framenum - gpf->framenum) / (float)gpl->gstep;
						tcolor[3] = color[3] - fac;
						gp_draw_strokes(gf, offsx, offsy, winx, winy, dflag, debug, lthick, tcolor);
					}
					else 
						break;
				}	
				
				/* restore alpha */
				glColor4f(color[0], color[1], color[2], color[3]);
			}
			else {
				/* draw the strokes for the ghost frames (at half of the alpha set by user) */
				if (gpf->prev) {
					tcolor[3] = (color[3] / 7);
					gp_draw_strokes(gpf->prev, offsx, offsy, winx, winy, dflag, debug, lthick, tcolor);
				}
				
				if (gpf->next) {
					tcolor[3] = (color[3] / 4);
					gp_draw_strokes(gpf->next, offsx, offsy, winx, winy, dflag, debug, lthick, tcolor);
				}
				
				/* restore alpha */
				glColor4f(color[0], color[1], color[2], color[3]);
			}
		}
		
		/* draw the strokes already in active frame */
		tcolor[3]= color[3];
		gp_draw_strokes(gpf, offsx, offsy, winx, winy, dflag, debug, lthick, tcolor);
		
//.........这里部分代码省略.........
开发者ID:jinjoh,项目名称:NOOR,代码行数:101,代码来源:drawgpencil.c


示例6: drawConstraint

void drawConstraint(TransInfo *t)
{
	TransCon *tc = &(t->con);

	if (!ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE))
		return;
	if (!(tc->mode & CON_APPLY))
		return;
	if (t->flag & T_USES_MANIPULATOR)
		return;
	if (t->flag & T_NO_CONSTRAINT)
		return;

	/* nasty exception for Z constraint in camera view */
	// TRANSFORM_FIX_ME
//	if ((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB)
//		return;

	if (tc->drawExtra) {
		tc->drawExtra(t);
	}
	else {
		if (tc->mode & CON_SELECT) {
			float vec[3];
			char col2[3] = {255, 255, 255};
			int depth_test_enabled;

			convertViewVec(t, vec, (t->mval[0] - t->con.imval[0]), (t->mval[1] - t->con.imval[1]));
			add_v3_v3(vec, t->center_global);

			drawLine(t, t->center_global, tc->mtx[0], 'X', 0);
			drawLine(t, t->center_global, tc->mtx[1], 'Y', 0);
			drawLine(t, t->center_global, tc->mtx[2], 'Z', 0);

			glColor3ubv((GLubyte *)col2);

			depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
			if (depth_test_enabled)
				glDisable(GL_DEPTH_TEST);

			setlinestyle(1);
			glBegin(GL_LINE_STRIP);
			glVertex3fv(t->center_global);
			glVertex3fv(vec);
			glEnd();
			setlinestyle(0);

			if (depth_test_enabled)
				glEnable(GL_DEPTH_TEST);
		}

		if (tc->mode & CON_AXIS0) {
			drawLine(t, t->center_global, tc->mtx[0], 'X', DRAWLIGHT);
		}
		if (tc->mode & CON_AXIS1) {
			drawLine(t, t->center_global, tc->mtx[1], 'Y', DRAWLIGHT);
		}
		if (tc->mode & CON_AXIS2) {
			drawLine(t, t->center_global, tc->mtx[2], 'Z', DRAWLIGHT);
		}
	}
}
开发者ID:GeniaPenksik,项目名称:blender,代码行数:62,代码来源:transform_constraints.c


示例7: main


//.........这里部分代码省略.........
car(250,400);
setcolor(WHITE);
setfillstyle(1,WHITE);
for(i=-2000;i<+25000;i+=100)
bar((getmaxx()/2)-5,i,(getmaxx()/2)+5,i+80);

delay(1000);

setcolor(getbkcolor());
setfillstyle(1,getbkcolor());
for(i=1;i<320;i++)
{
bar(getmaxx()/2,0,(getmaxx()/2)-i,getmaxy());
bar(getmaxx()/2,0,(getmaxx()/2)+i,getmaxy());
delay(5);
}

delay(1000);



setcolor(YELLOW);
settextstyle(7,0,15);
outtextxy(100-20,100,"R");

settextstyle(7,0,15);
outtextxy(495-20,100,"E");

setcolor(LIGHTBLUE);
settextstyle(7,0,7);
outtextxy(198-20,130,"UN   LIF");

setcolor(BLUE);
setlinestyle(0,0,3);
line(275,155,385,155);
line(275-2,160,385-2,160);
line(275-4,165,385-4,165);
line(275-6,170,385-6,170);
line(275-8,175,385-8,175);
line(275-9,180,385-9,180);
line(275-10,185,385-10,185);
line(275-12,190,385-12,190);

setcolor(YELLOW);
settextstyle(10,0,7);
outtextxy(295,95,"4");


setcolor(LIGHTBLUE);
for(i=1;i<=465;i++)
{
line(80,228,80+i,228);
delay(5);
}
for(i=1;i<20;i++)
{
line(80,228+i,545,228+i);
delay(7);
}
delay(500);
setcolor(LIGHTRED);
settextstyle(8,0,5);
setusercharsize(2,1,1,2);
textdisp1(80,225,"Run For Life",RED,LIGHTRED);

setcolor(LIGHTRED);
开发者ID:rishabh-tripathi,项目名称:Run4Life-Dos-Game,代码行数:67,代码来源:R4L01SC.C


示例8: ui_draw_but_COLORBAND

void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
{
	ColorBand *coba;
	CBData *cbd;
	float x1, y1, sizex, sizey;
	float v3[2], v1[2], v2[2], v1a[2], v2a[2];
	int a;
	float pos, colf[4] = {0, 0, 0, 0}; /* initialize in case the colorband isn't valid */
	struct ColorManagedDisplay *display = NULL;

	coba = (ColorBand *)(but->editcoba ? but->editcoba : but->poin);
	if (coba == NULL) return;

	if (but->block->color_profile)
		display = ui_block_display_get(but->block);

	x1 = rect->xmin;
	y1 = rect->ymin;
	sizex = rect->xmax - x1;
	sizey = rect->ymax - y1;

	/* first background, to show tranparency */

	glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255);
	glRectf(x1, y1, x1 + sizex, y1 + sizey);
	glEnable(GL_POLYGON_STIPPLE);
	glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255);
	glPolygonStipple(checker_stipple_sml);
	glRectf(x1, y1, x1 + sizex, y1 + sizey);
	glDisable(GL_POLYGON_STIPPLE);

	glShadeModel(GL_FLAT);
	glEnable(GL_BLEND);
	
	cbd = coba->data;
	
	v1[0] = v2[0] = x1;
	v1[1] = y1;
	v2[1] = y1 + sizey;
	
	glBegin(GL_QUAD_STRIP);
	
	glColor4fv(&cbd->r);
	glVertex2fv(v1);
	glVertex2fv(v2);

	for (a = 1; a <= sizex; a++) {
		pos = ((float)a) / (sizex - 1);
		do_colorband(coba, pos, colf);
		if (display)
			IMB_colormanagement_scene_linear_to_display_v3(colf, display);
		
		v1[0] = v2[0] = x1 + a;
		
		glColor4fv(colf);
		glVertex2fv(v1);
		glVertex2fv(v2);
	}
	
	glEnd();
	glShadeModel(GL_FLAT);
	glDisable(GL_BLEND);
	
	/* outline */
	glColor4f(0.0, 0.0, 0.0, 1.0);
	fdrawbox(x1, y1, x1 + sizex, y1 + sizey);
	
	/* help lines */
	v1[0] = v2[0] = v3[0] = x1;
	v1[1] = y1;
	v1a[1] = y1 + 0.25f * sizey;
	v2[1] = y1 + 0.5f * sizey;
	v2a[1] = y1 + 0.75f * sizey;
	v3[1] = y1 + sizey;
	
	
	cbd = coba->data;
	glBegin(GL_LINES);
	for (a = 0; a < coba->tot; a++, cbd++) {
		v1[0] = v2[0] = v3[0] = v1a[0] = v2a[0] = x1 + cbd->pos * sizex;
		
		if (a == coba->cur) {
			glColor3ub(0, 0, 0);
			glVertex2fv(v1);
			glVertex2fv(v3);
			glEnd();
			
			setlinestyle(2);
			glBegin(GL_LINES);
			glColor3ub(255, 255, 255);
			glVertex2fv(v1);
			glVertex2fv(v3);
			glEnd();
			setlinestyle(0);
			glBegin(GL_LINES);
			
#if 0
			glColor3ub(0, 0, 0);
			glVertex2fv(v1);
			glVertex2fv(v1a);
//.........这里部分代码省略.........
开发者ID:Eibriel,项目名称:kiriblender,代码行数:101,代码来源:interface_draw.c


示例9: main

void main()
{int gdriver=DETECT,gmode=DETECT;
randomize();
initgraph(&gdriver,&gmode,"");
setbkcolor(BLACK);
clrscr();
cleardevice();
load();
x=random(640);
y=random(480);
//c=random(16);
color();
//setfillstyle(1,c);
setlinestyle(random(6),random(10),random(5));
settextstyle(3,HORIZ_DIR,1);
while(ch!='q')
{//cleardevice();
//outtextxy(30,40," Q   W   E  or arrow key ");
init();
show();
while(!kbhit())
{
check();
//gotoxy(4,2);
//cout<<"\n\n\tX = "<<mx<<"   Y = "<<my<<"  B = "<<b;
if(ch=='w'){cleardevice();ch='A';}
if(x<0||x>640||y<0||y>480||ch=='e')
{ch='A';

x=random(640);
y=random(480);
color();
setlinestyle(random(6),random(10),random(5));
setfillstyle(random(10),random(16));
//c=random(16);
setcolor(c);
}
//change();
mchange();
//if(((m%4000)>200&&(m%4000)<400)||((m%4000)>1000&&(m%4000)<1500)){
//sound((m%4000)+3000);
//}
//if((m%4000)==400||(m%4000)==1500)nosound();
//putpixel(x,y,c);
// Uncomment any one of these and watch
//circle(x+random(20),y+random(20),random(10));
//rectangle(x-random(2),y-random(2),x+random(2),y+random(2));
//line(x,y,320,240);
//line(x,y,(x*y)%100,(x*y)%100);
//line(x-y%40,y,x,x^2);
//line(x-y%40,y,x,(y+(x^2))%480);
//line(y,x,x,y);
//line(x*2,y/2,x/2,y*2);
//circle(x+random(50),y+random(50),(x*y)%10);
//ellipse(x+random(60),y+random(60),0,random(360),random(30),random(30));
//floodfill(x,y,c);
//ellipse(x+random(400),y+random(400),0,random(360),random(100),random(100));
//ellipse(x,y,0,360,5,5);
//ellipse(x-random(640),y-random(480),0,random(360),random(100),random(100));
//bar3d(x-random(3),y-random(3),x+random(3),y+random(3),random(3),1);
//linerel(x,y);
//lineto(x,y);
button();
draw();
//arc(x,y,0,random(360),random(40));
//x=random(640);
//y=random(480);
delay(1);
}
ch=getch();
key();
}
closegraph();
}
开发者ID:Divyavrat,项目名称:CppCodes,代码行数:74,代码来源:PAINT7.CPP


示例10: draw_marker

/* function to draw markers */
static void draw_marker(
        View2D *v2d, const uiFontStyle *fstyle, TimeMarker *marker, int cfra, int flag,
        /* avoid re-calculating each time */
        const float ypixels, const float xscale, const float yscale)
{
	const float xpos = marker->frame * xscale;
	int icon_id;

	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	
	/* vertical line - dotted */
#ifdef DURIAN_CAMERA_SWITCH
	if ((marker->camera) || (flag & DRAW_MARKERS_LINES))
#else
	if (flag & DRAW_MARKERS_LINES)
#endif
	{
		setlinestyle(3);
		
		if (marker->flag & SELECT)
			glColor4ub(255, 255, 255, 96);
		else
			glColor4ub(0, 0, 0, 96);
		
		glBegin(GL_LINES);
		glVertex2f(xpos + 0.5f, 12.0f);
		glVertex2f(xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
		glEnd();
		
		setlinestyle(0);
	}
	
	/* 5 px to offset icon to align properly, space / pixels corrects for zoom */
	if (flag & DRAW_MARKERS_LOCAL) {
		icon_id = (marker->flag & ACTIVE) ? ICON_PMARKER_ACT :
		          (marker->flag & SELECT) ? ICON_PMARKER_SEL :
		          ICON_PMARKER;
	}
	else {
		icon_id = (marker->flag & SELECT) ? ICON_MARKER_HLT :
		          ICON_MARKER;
	}
	
	UI_icon_draw(xpos - 0.45f * UI_DPI_ICON_SIZE, UI_DPI_ICON_SIZE, icon_id);
	
	glDisable(GL_BLEND);
	
	/* and the marker name too, shifted slightly to the top-right */
	if (marker->name[0]) {
		float x, y;

		/* minimal y coordinate which wouldn't be occluded by scroll */
		int min_y = 17.0f * UI_DPI_FAC;
		
		if (marker->flag & SELECT) {
			UI_ThemeColor(TH_TEXT_HI);
			x = xpos + 4.0f * UI_DPI_FAC;
			y = (ypixels <= 39.0f * UI_DPI_FAC) ? (ypixels - 10.0f * UI_DPI_FAC) : 29.0f * UI_DPI_FAC;
			y = max_ii(y, min_y);
		}
		else {
			UI_ThemeColor(TH_TEXT);
			if ((marker->frame <= cfra) && (marker->frame + 5 > cfra)) {
				x = xpos + 8.0f * UI_DPI_FAC;
				y = (ypixels <= 39.0f * UI_DPI_FAC) ? (ypixels - 10.0f * UI_DPI_FAC) : 29.0f * UI_DPI_FAC;
				y = max_ii(y, min_y);
			}
			else {
				x = xpos + 8.0f * UI_DPI_FAC;
				y = 17.0f * UI_DPI_FAC;
			}
		}

#ifdef DURIAN_CAMERA_SWITCH
		if (marker->camera && (marker->camera->restrictflag & OB_RESTRICT_RENDER)) {
			float col[4];
			glGetFloatv(GL_CURRENT_COLOR, col);
			col[3] = 0.4;
			glColor4fv(col);
		}
#endif

		UI_fontstyle_draw_simple(fstyle, x, y, marker->name);
	}
}
开发者ID:DrangPo,项目名称:blender,代码行数:87,代码来源:anim_markers.c


示例11: wind_barb

 /*NP*/ void
wind_barb (float wdir, float wspd, short x, short y, short siz)
	/*************************************************************/
	/*  WIND_BARB                                                */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Plots wind barb at location (x,y) for given wind.        */
	/*************************************************************/
{
  short x1, y1, x2, y2, x3, y3, sped, maxsiz = 3;
  float dx, dy, spcx, spcy, wid, hgt;

  dx = (ucomp (wdir, 10) * (float) siz) / 1.5F;
  dy = (vcomp (wdir, 10) * (float) siz) / 1.5F;

  x1 = x;
  y1 = y;
  x2 = x1 + (short) dx;
  y2 = y1 - (short) dy;

  /* ----- Draw backbone of wind barb, along with origin dot ----- */
  if (siz > maxsiz)
    {
      setlinestyle (1, 2);
    }
  else
    {
      setlinestyle (1, 1);
    }

  rectangle (0, x1 - 1, y1 - 1, x1 + 1, y1 + 1);
  moveto (x1, y1);
  lineto (x2, y2);

  sped = (short) wspd;
  x1 = x2;
  y1 = y2;

  wid = 5;			/* Number of flags that will fit */
  spcx = dx / wid;
  spcy = dy / wid;
  x1 = x1 + (short) spcx;
  y1 = y1 - (short) spcy;

  /* ----- Draw wind flags (increments of 50kt) ----- */
  while (sped > 47)
    {
      x1 = x1 - (short) spcx;
      y1 = y1 + (short) spcy;

      hgt = .5F;		/* Heigth of flags */
      x2 = x1 + (short) (dy * hgt);
      y2 = y1 + (short) (dx * hgt);

      x3 = x1 - (short) spcx;
      y3 = y1 + (short) spcy;

      moveto (x1, y1);
      lineto (x2, y2);
      lineto (x3, y3);

      x2 = (x1 + x2 + x3) / 3;
      y2 = (y1 + y2 + y3) / 3;

      sped -= 50;
      x1 = x3;
      y1 = y3;
    }

  /* ----- Draw wind barbs (increments of 5kt) ----- */
  while (sped > 7)
    {
      hgt = .5F;		/* Heigth of flags */
      x2 = x1 + (short) (dy * hgt);
      y2 = y1 + (short) (dx * hgt);

      x3 = x1 - (short) spcx;
      y3 = y1 + (short) spcy;

      moveto (x3, y3);
      lineto (x2, y2);

      sped -= 10;
      x1 = x3;
      y1 = y3;
    }

  /* ----- Draw short barb ----- */
  if (sped > 3)
    {
      hgt = .5F;		/* Heigth of flags */
      x2 = x1 + (short) (dy * hgt);
      y2 = y1 + (short) (dx * hgt);

      x3 = x1 - (short) spcx;
      y3 = y1 + (short) spcy;

      dx = (x3 - x2) / 2;
      dy = (y3 - y2) / 2;

//.........这里部分代码省略.........
开发者ID:ArielleBassanelli,项目名称:gempak,代码行数:101,代码来源:xwvid1.c


示例12: draw_hodo

void
draw_hodo (void)
	/*************************************************************/
	/*  DRAW_HODO                                                */
	/*  John Hart  NSSFC KCMO                                    */
	/*                                                           */
	/*  Draws a standard Hodograph display.                      */
	/*************************************************************/
{
  short x1, y1, x2, y2, i, y3;
  float wdir, wspd, mnu, mnv, ix1, ix2, ix3, ix4;
  char st[10];

  setcolor (0, draw_reg, gc);
  rectangle (1, 1, 1, hov.brx + 14, hov.bry + 14);
  setcolor (1, draw_reg, gc);
  set_font (2);
  setcliprgn (hov.tlx, hov.tly, hov.brx, hov.bry, draw_reg, gc);
  setlinestyle (1, 1);
  rectangle (0, hov.tlx, hov.tly, hov.brx, hov.bry);

  /* ----- Plot crosshairs ----- */
  setcolor (31, draw_reg, gc);
  hodo_to_pix (180.0F, 60.0F, &x1, &y1);
  moveto (x1, hov.tly);
  lineto (x1, hov.bry);

  setcolor (31, draw_reg, gc);
  hodo_to_pix (270.0F, 60.0F, &x1, &y1);
  moveto (hov.tlx, y1);
  lineto (hov.brx, y1);

  /* ----- Plot Radius circles ----- */
  setcolor (24, draw_reg, gc);
  setlinestyle (2, 1);
  hodo_to_pix (0.0F, 0.0F, &x1, &y1);
  x2 = x1;
  y2 = y1;
  for (i = hov.scale; i <= hov.hodomag; i = i + hov.scale)
    {
      hodo_to_pix (0.0F, (float) i, &x1, &y1);
      y3 = (y1 - y2);
      ellipse (0, x2 - y3, y2 - y3, x2 + y3, y2 + y3);
    }

  setcolor (1, draw_reg, gc);
  /* ----- Plot X-Coord hash marks ----- */
  for (i = hov.scale; i <= hov.hodomag; i = i + hov.scale)
    {
      hodo_to_pix (180.0F, (float) i, &x1, &y1);
      moveto (x1 - 3, y1);
      lineto (x1 + 3, y1);
      itoa (i, st, 10);
      outgtext (st, x1 - getgtextextent (st) - 4, y1 - 5);

      hodo_to_pix (360.0F, (float) i, &x1, &y1);
      moveto (x1 - 3, y1);
      lineto (x1 + 3, y1);
      itoa (i, st, 10);
      outgtext (st, x1 - getgtextextent (st) - 4, y1 - 5);
    }

  /* ----- Plot Y-Coord hash marks ----- */
  setcolor (1, draw_reg, gc);
  for (i = hov.scale; i <= hov.hodomag; i = i + hov.scale)
    {
      hodo_to_pix (90.0F, (float) i, &x1, &y1);
      moveto (x1, y1 - 3);
      lineto (x1, y1 + 3);
      itoa (i, st, 10);
      outgtext (st, x1 - (getgtextextent (st) / 2), y1 + 5);

      hodo_to_pix (270.0F, (float) i, &x1, &y1);
      moveto (x1, y1 - 3);
      lineto (x1, y1 + 3);
      itoa (i, st, 10);
      outgtext (st, x1 - (getgtextextent (st) / 2), y1 + 5);
    }

  /* ----- Plot Hodograph (Shear Vectors) ----- */
  setcolor (2, draw_reg, gc);
  setlinestyle (1, 2);

  if ((sndgp != NULL) && (sndgp->numlev > 0))
    {
      trace_hodo (3);

      /* ----- Plot Mean Wind Vector ----- */
      setcolor (5, draw_reg, gc);
      mean_wind (-1.0F, -1.0F, &mnu, &mnv, &wdir, &wspd);
      hodo_to_pix (wdir, wspd, &x1, &y1);
      moveto (x1, y1);
      rectangle (0, (short) (x1 - 4), (short) (y1 - 4), (short) (x1 + 4),
		 (short) (y1 + 4));


      /* ----- Plot 30/75 Storm Motion Vector ----- */
      mean_wind (sndgp->sndg[sfc ()].pres, i_pres (msl (6000.0F)), &ix1, &ix2,
		 &ix3, &ix4);
      setcolor (11, draw_reg, gc);
//.........这里部分代码省略.........
开发者ID:ArielleBassanelli,项目名称:gempak,代码行数:101,代码来源:xwvid1.c


示例13: draw_skewt

void draw_skewt (void)
/*************************************************************/
/*  DRAW_SKEWT                                               */
/*  John Hart  NSSFC KCMO                                    */
/*                                                           */
/*  Draws a standard Skew-T/LogP diagram.                    */
/*************************************************************/
{
  short i;
  float thta;
  float ix1, ix2, ix3, ix4, ix5, ix6, ix7;
  float lvl[] =
    { 1050.0F, 1000.0F, 850.0F, 700.0F, 500.0F, 300.0F, 200.0F, 100.0F };
  char rtitle[200];

  setcliprgn (1, 1, xwdth, xhght, draw_reg, gc);
  setcolor (0, draw_reg, gc);
  rectangle (1, 1, 1, skv.brx + 14, skv.bry + skv.tly + 14);
  setcolor (1, draw_reg, gc);
  set_font (2);
  setcliprgn (skv.tlx, skv.tly, skv.brx, skv.bry, draw_reg, gc);
  setlinestyle (1, 1);
  rectangle (0, skv.tlx, skv.tly, skv.brx, skv.bry);

/* ----- Draw Skewed Temperature Lines ----- */
  setcolor (24, draw_reg, gc);
  setlinestyle (2, 1);
  for (i = (-160); i <= 50; i = i + 10)
    {
      isotherm ((float) i);
    }

/* ----- Draw Dry Adiabats ----- */
  setcolor (24, draw_reg, gc);
  setlinestyle (1, 1);
  for (thta = (-70.0F); thta <= 350.0F; thta = thta + 20.0F)
    {
      dry_adiabat (thta);
    };

/* ----- Draw Horizontal Pressure Lines ----- */
  setcolor (1, draw_reg, gc);
  setlinestyle (1, 1);
  for (i = 1; i < 8; i++)
    {
      isobar (lvl[i], 0);
    }
  for (i = 100; i <= 1050; i = i + 50)
    {
      isobar ((float) i, 1);
    }

/* ----- Draw OPC Horizontal Stability Lines ----- *
 ************************************************************************
 *  OPC MODIFICATION - J. Morgan 5/12/05				*
 *  Draws:								*
 *	 Lowest Inversion Height					*
 *	 Layer Based Mixing Height					*
 *	 Surface Based Mixing Height					*
 *  Calls:								*
 *	 xwvid.c: void isobar_nolabel ()				*
 *	skparams.c: void low_inv ()					* 
 *	 skparams.c: void mix_height ()					*
 ***********************************************************************/

  low_inv( &ix1, &ix2 );
  setcolor (5, draw_reg, gc);
  setlinestyle (1, 1);
  isobar_nolabel (ix1);

  mix_height( &ix1, &ix2, &ix3, &ix4, &ix5, &ix6, &ix7, 1);
  setcolor (6, draw_reg, gc);
  setlinestyle (2, 1);
  isobar_nolabel (ix1);

  mix_height( &ix1, &ix2, &ix3, &ix4, &ix5, &ix6, &ix7, 0);
  setcolor (7, draw_reg, gc);
  setlinestyle (4, 1);
  isobar_nolabel (ix1);	

/* Draw frame boarder */
  setcolor (1, draw_reg, gc);
  rectangle (0, skv.tlx, skv.tly, skv.brx, skv.bry);

  if (sndgp != NULL)
    {

      /* ----- Plot old sounding if exists ----- */
      setcolor (28, draw_reg, gc);
      if ((overlay_previous == 1) && (sndgp->ovrlev > 0))
	{
	  trace_temp2 (3);
	  trace_dwpt2 (3);
	}

      if (sndgp->numlev > 0)
	{
	  /* ----- Plot Environmental Temperature Data ----- */
	  setcolor (2, draw_reg, gc);
	  trace_temp (sndgp, 3);
//.........这里部分代码省略.........
开发者ID:ArielleBassanelli,项目名称:gempak,代码行数:101,代码来源:xwvid1.c


示例14: setfillcolor

 void Circle::erase()
 {
     setfillcolor(BLACK);
	 setlinestyle(style, width);
	fillcircle (cen.x,cen.y, radius);
 }
开发者ID:2015cnugithub,项目名称:2151002029HouZeYi,代码行数:6,代码来源:Figure.cpp


示例15: draw_image_seq


//.........这里部分代码省略.........
			glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmax, tot_clip.ymin);
		}
		else if (sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) {
			glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
			glTexCoord2f(0.0f, 1.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
			glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
			glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
		}
	}
	else {
		glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
		glTexCoord2f(0.0f, 1.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
		glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
		glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
	}
	glEnd();
	glBindTexture(GL_TEXTURE_2D, last_texid);
	glDisable(GL_TEXTURE_2D);
	if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA)
		glDisable(GL_BLEND);
	glDeleteTextures(1, &texid);

	if (glsl_used)
		IMB_colormanagement_finish_glsl_draw();

	if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {

		float x1 = v2d->tot.xmin;
		float y1 = v2d->tot.ymin;
		float x2 = v2d->tot.xmax;
		float y2 = v2d->tot.ymax;

		/* border */
		setlinestyle(3);

		UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 1.0, 0);

		glBegin(GL_LINE_LOOP);
		glVertex2f(x1 - 0.5f, y1 - 0.5f);
		glVertex2f(x1 - 0.5f, y2 + 0.5f);
		glVertex2f(x2 + 0.5f, y2 + 0.5f);
		glVertex2f(x2 + 0.5f, y1 - 0.5f);
		glEnd();

		/* safety border */
		if ((sseq->flag & SEQ_DRAW_SAFE_MARGINS) != 0) {
			float fac = 0.1;

			float a = fac * (x2 - x1);
			x1 += a;
			x2 -= a;

			a = fac * (y2 - y1);
			y1 += a;
			y2 -= a;

			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

			uiSetRoundBox(UI_CNR_ALL);
			uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);

			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

		}

		setlinestyle(0);
开发者ID:ideasman42,项目名称:blender-wayland,代码行数:67,代码来源:sequencer_draw.c


示例16: main

int main()
{
	int gd=DETECT,gm;
	initgraph(&gd,&gm,"c://TC/bgi");
	setbkcolor(BROWN);
	setlinestyle(SOLID_LINE,1,3);
	GetVertices();
	GetEdges();
      //	getch();
	edgecost();
       getch();
	Redraw(adj);
   //PRIMS ALGO
    Vertex *v;
	int min_edge=MAX_NUM;
   int min_x, min_y,k,l,z;

   for(z=0;z<vcount;z++) //create near
	 near1[z]=-1;

   for(k=0;k<vcount;k++) //near array fill
     {
	for(l=0;l<vcount;l++)
	  {
		if(adj[k][l]<min_edge)
		    {min_edge=adj[k][l];
		      min_x=k;
		      min_y=l;
		     }
	    }
	}

    mincost=0;
   mincost+=min_edge;
  // int m=MAX_VERT;
   //int t[m][2];
   t[0][0]=min_x;
   t[0][1]=min_y;

   Edge_fill(&v[min_x],&v[min_y],RED,TRUE);
   getch();
    extra[min_x][min_y]=1;
    extra[min_y][min_x]=1;

   for(z=0;z<vcount;z++)   //near array update
   {
	if(adj[z][min_x]<adj[z][min_y])
	       near1[z]=min_x;
	else
		 near1[z]=min_y;
   }

   near1[min_x]=near1[min_y]=-1;
  // int k;
   int min_j;
   //prims algorithm
   for( z =1;z<vcount-1;z++)
   {  min_j=MAX_NUM;

	     for(int j=0;j<vcount;j++) //choose nearest vertex
	      {
		if(adj[j][near1[j]]<min_j && near1[j]!=-1)
		    min_j=j;
		    }

	t[z][0]=min_j;
	   t[z][1]=near1[min_j];

	 mincost+=adj[min_j][near1[min_j]];

	 extra[min_j][near1[min_j]]=1;
	  extra[near1[min_j]][min_j]=1;

	 near1[min_j]=-1;

	 for(k=0;k<vcount;k++)
	 {
		if(near1[k]!=-1 && adj[k][near1[k]]>adj[k][min_j])
		    near1[k]=min_j;

	}
}
      getch();
	Redraw(extra);
	gotoxy(2,4);

	printf("Minimum Cost of this spaning tree is : %d",mincost);

	getch();

	closegraph();
	return 0;
}
开发者ID:Upa005,项目名称:Algorithms,代码行数:93,代码来源:EDGES.CPP


示例17: setlinestyle

void PontoGrafico::exibe(int x1, int y1, int, int) const
{
  setlinestyle(0, 0, this->c_grossura);
  putpixel(this->c_x + x1, this->c_y + y1, this->c_cor);
  setlinestyle(0, 0, 1);
}
开发者ID:felipelalli,项目名称:micaroni,代码行数:6,代码来源:PINTAFUN.CPP


示例18: Line3D

//***************
void Line3D(int x1,int y1, int x2, int y2){
  setlinestyle(0,0,1);setcolor(8);
  line(x1,y1,x2,y2);
  setlinestyle(0,0,1);setcolor(15);
  line(x1,y1+1,x2,y1+1);
}
开发者ID:agudeloandres,项目名称:C_Struct_Files,代码行数:7,代码来源:ABOUT.CPP


示例19: PontoGrafico

void PintaFun::desenha_ponto(const COORDENADA& x1, const COORDENADA& y1,
                             const COORDENADA& x2, const COORDENADA& y2,
                             MouseFun& mouse, MOUSE_EVENTO* evento)
{
  BOLEANO pinta = FALSO;
  COORDENADA antx, anty;

  if (*evento == MOUSE_DOWN)
    pinta = VERDADEIRO;
  else
    if (*evento == MOUSE_UP)
    {
      if (pinta)
      {
        PontoGrafico* ponto = new PontoGrafico(mouse.x() - this->x1(), mouse.y() - this->y1());
        c_lista.ins(ponto);
        ponto->exibe(this->x1(), this->y1(),
                     this->x2(), this->y2());
        //putpixel(mouse.x(), mouse.y(), 15);
        pinta = FALSO;
      }
    }
    else
      if (*evento == MOUSE_UP_DIREITO)
        return;

  while (mouse.verifica(x1, y1, x2, y2))
  {
    {
      COORDENADA ax, ay;
      ax = mouse.x();
      ay = mouse.y();

      setcolor(7);
      setlinestyle(1, 0, 0);
      setwritemode(XOR_PUT);
      line(ax, this->y1(), ax, this->y2());
      line(this->x1(), ay, this->x2(), ay);

      *evento = mouse.evento_pause();

      line(ax, this->y1(), ax, this->y2());
      line(this->x1(), ay, this->x2(), ay);
      setwritemode(COPY_PUT);
      setlinestyle(SOLID_LINE, 0, 0);
    }

    if (*evento == MOUSE_DOWN)
      pinta = VERDADEIRO;
    else
      if (*evento == MOUSE_UP)
      {
        if (pinta)
        {
          PontoGrafico* ponto = new PontoGrafico(mouse.x() - this->x1(), mouse.y() - this->y1());
          c_lista.ins(ponto);
          ponto->exibe(this->x1(), this->y1(),
                       this->x2(), this->y2());
          //putpixel(mouse.x(), mouse.y(), 15);
          pinta = FALSO;
        }
      }
      else
        if (*evento == MOUSE_UP_DIREITO)
          return;
  }
}
开发者ID:felipelalli,项目名称:micaroni,代码行数:67,代码来源:PINTAFUN.CPP


示例20: draw_marker

/* function to draw markers */
static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
{
	float xpos, ypixels, xscale, yscale;
	int icon_id= 0;
	
	xpos = marker->frame;
	
	/* no time correction for framelen! space is drawn with old values */
	ypixels= v2d->mask.ymax-v2d->mask.ymin;
	UI_view2d_getscale(v2d, &xscale, &yscale);
	
	glScalef(1.0f/xscale, 1.0f, 1.0f);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);			
	
	/* vertical line - dotted */
	// NOTE: currently only used for sequencer 
	if (flag & DRAW_MARKERS_LINES) {
		setlinestyle(3);
		
		if (marker->flag & SELECT)
			glColor4ub(255, 255, 255, 96);
		else
			glColor4ub(0, 0, 0, 96);
		
		glBegin(GL_LINES);
			glVertex2f((xpos*xscale)+0.5f, 12.0f);
			glVertex2f((xpos*xscale)+0.5f, 34.0f*yscale); /* a bit lazy but we know it cant be greater then 34 strips high */
		glEnd();
		
		setlinestyle(0);
	}
	
	/* 5 px to offset icon to align properly, space / pixels corrects for zoom */
	if (flag & DRAW_MARKERS_LOCAL) {
		icon_id= (marker->flag & ACTIVE) ? ICON_PMARKER_ACT : 
		(marker->flag & SELECT) ? ICON_PMARKER_SEL : 
		ICON_PMARKER;
	}
	else {
		icon_id= (marker->flag & SELECT) ? ICON_MARKER_HLT : 
		ICON_MARKER;
	}
	
	UI_icon_draw(xpos*xscale-5.0f, 16.0f, icon_id);
	
	glBlendFunc(GL_ONE, GL_ZERO);
	glDisable(GL_BLEND);
	
	/* and the marker name too, shifted slightly to the top-right */
	if (marker->name && marker->name[0]) {
		float x, y;
		
		if (marker->flag & SELECT) {
			UI_ThemeColor(TH_TEXT_HI);
			x= xpos*xscale + 4.0f;
			y= (ypixels <= 39.0f)? (ypixels-10.0f) : 29.0f;
		}
		else {
			UI_ThemeColor(TH_TEXT);
			if((marker->frame <= cfra) && (marker->frame+5 > cfra)) {
				x= xpos*xscale + 4.0f;
				y= (ypixels <= 39.0f)? (ypixels - 10.0f) : 29.0f;
			}
			else {
				x= xpos*xscale + 4.0f;
				y= 17.0f;
			}
		}
		UI_DrawString(x, y, marker->name);
	}
	
	glScalef(xscale, 1.0f, 1.0f);
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:76,代码来源:anim_markers.c



注:本文中的setlinestyle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setlogmask函数代码示例发布时间:2022-05-30
下一篇:
C++ setlinebuf函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap