本文整理汇总了C++中setlinestyle函数的典型用法代码示例。如果您正苦于以下问题:C++ setlinestyle函数的具体用法?C++ setlinestyle怎么用?C++ setlinestyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setlinestyle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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]);
}
示例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);
}
}
}
示例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);
}
示例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);
//.........这里部分代码省略.........
示例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);
//.........这里部分代码省略.........
示例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);
}
}
}
示例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);
示例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);
//.........这里部分代码省略.........
示例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();
}
示例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);
}
}
示例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;
//.........这里部分代码省略.........
示例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);
//.........这里部分代码省略.........
示例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);
//.........这里部分代码省略.........
示例14: setfillcolor
void Circle::erase()
{
setfillcolor(BLACK);
setlinestyle(style, width);
fillcircle (cen.x,cen.y, radius);
}
示例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);