/* drawing stuff */ static void actor_draw(Actor *actor, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Element *elem; Point center; double dx,dy,r,th; Point ps1,ps2,pi1,pi2; assert(actor != NULL); assert(renderer != NULL); elem = &actor->element; center.x = elem->corner.x + elem->width/2; center.y = elem->corner.y + elem->height/2; /* background */ renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); /* foreground */ renderer_ops->set_linewidth(renderer, ACTOR_BORDER_WIDTH); renderer_ops->set_linejoin(renderer, LINEJOIN_MITER); renderer_ops->draw_ellipse(renderer, ¢er, elem->width, elem->height, &ACTOR_BG_COLOR, &ACTOR_FG_COLOR); /* text */ text_draw(actor->text, renderer); /* computing and drawing decorations */ r = elem->height/2.0; th = actor->text->height; dy = r - th; dx = r*r - dy*dy; if (dx>0) dx=sqrt(dx); else dx=0; dx= r-dx; ps1.x=elem->corner.x + dx; ps1.y=elem->corner.y + th; ps2.x=elem->corner.x + elem->width-dx; ps2.y=ps1.y; pi1.x=ps1.x; pi1.y=elem->corner.y + elem->height - th; pi2.x=ps2.x; pi2.y=pi1.y; renderer_ops->set_linewidth(renderer, ACTOR_BORDER_WIDTH); switch (actor->type) { case ACTOR_AGENT: renderer_ops->draw_line(renderer, &ps1, &ps2, &ACTOR_FG_COLOR); break; case ACTOR_POSITION: renderer_ops->draw_line(renderer, &ps1, &ps2, &ACTOR_FG_COLOR); renderer_ops->draw_line(renderer, &pi1, &pi2, &ACTOR_FG_COLOR); break; case ACTOR_ROLE: renderer_ops->draw_line(renderer, &pi1, &pi2, &ACTOR_FG_COLOR); break; case ACTOR_UNSPECIFIED: break; } }
void TextRender () { glMatrixMode (GL_PROJECTION); glPushMatrix (); glLoadIdentity (); glOrtho (0, view_size.x, view_size.y, 0, 0.1f, 2048); glMatrixMode (GL_MODELVIEW); glPushMatrix (); glLoadIdentity(); glTranslatef(0, 0, -1.0f); glDisable (GL_CULL_FACE); glDisable (GL_FOG); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable (GL_TEXTURE_2D); glColor3f (1, 1, 1); if (CVarUtils::GetCVar<bool> ("show.stats")) text_draw (buffer); glPopMatrix (); glMatrixMode (GL_PROJECTION); glPopMatrix (); glMatrixMode (GL_MODELVIEW); buffer[0] = 0; }
static void scores_draw(state_t *state) { char buf[BUF_SIZE]; glColor3f(0.9, 0.9, 0.9); snprintf(buf, sizeof(buf), "%10d spawned", state->total_noobs); text_draw(buf, 664, 550); glColor3f(0.1, 1.0, 0.1); snprintf(buf, sizeof(buf), "%10d kills", state->kills); text_draw(buf, 664, 576); glColor3f(1.0, 0.1, 0.1); snprintf(buf, sizeof(buf), "%10d leaks", state->leaks); text_draw(buf, 664, 602); }
void mappers_draw(mappers_t *m) { int x,y; x = m->info.x; y = m->info.y; if(m->isshowing == 0) return; gui_draw_border(GUI_COLOR_DARKBLUE,x,y,m->info.w,m->info.h); gui_draw_border(GUI_COLOR_GREY,x,y,m->info.w,9); button_draw(&m->donebtn); if(nes->rom) { switch(nes->rom->boardid) { //nes-event case B_EVENT: gui_draw_text(GUI_TEXT,x+2,y+2,"NES-EVENT Configuration"); mapper105_draw(m); break; //unif case -1: default: gui_draw_text(GUI_TEXT,x+2,y+2,"Mapper Configuration"); text_draw(&m->label); break; } } }
static void node_draw(Node *node, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Element *elem; real x, y, w, h; Point points[7]; int i; assert(node != NULL); assert(renderer != NULL); elem = &node->element; x = elem->corner.x; y = elem->corner.y; w = elem->width; h = elem->height; renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer_ops->set_linewidth(renderer, node->line_width); renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0); /* Draw outer box */ points[0].x = x; points[0].y = y; points[1].x = x + NODE_DEPTH; points[1].y = y - NODE_DEPTH; points[2].x = x + w + NODE_DEPTH; points[2].y = y - NODE_DEPTH; points[3].x = x + w + NODE_DEPTH; points[3].y = y + h - NODE_DEPTH; points[4].x = x + w; points[4].y = y + h; points[5].x = x; points[5].y = y + h; points[6].x = x; points[6].y = y; renderer_ops->draw_polygon(renderer, points, 7, &node->fill_color, &node->line_color); /* Draw interior lines */ points[0].x = x; points[0].y = y; points[1].x = x + w; points[1].y = y; renderer_ops->draw_line(renderer, &points[0], &points[1], &node->line_color); points[0].x = x + w; points[0].y = y; points[1].x = x + w + NODE_DEPTH; points[1].y = y - NODE_DEPTH; renderer_ops->draw_line(renderer, &points[0], &points[1], &node->line_color); points[0].x = x + w; points[0].y = y; points[1].x = x + w; points[1].y = y + h; renderer_ops->draw_line(renderer, &points[0], &points[1], &node->line_color); /* Draw text */ text_draw(node->name, renderer); /* Draw underlines (!) */ renderer_ops->set_linewidth(renderer, NODE_LINEWIDTH); points[0].x = node->name->position.x; points[0].y = points[1].y = node->name->position.y + node->name->descent; for (i = 0; i < node->name->numlines; i++) { points[1].x = points[0].x + text_get_line_width(node->name, i); renderer_ops->draw_line(renderer, points, points + 1, &node->name->color); points[0].y = points[1].y += node->name->height; } }
/* drawing stuff */ static void goal_draw(Goal *goal, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Point p1,p2; BezPoint bpl[5]; Element *elem; /* some asserts */ assert(goal != NULL); assert(renderer != NULL); elem = &goal->element; renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0); renderer_ops->set_linejoin(renderer, LINEJOIN_MITER); renderer_ops->set_linewidth(renderer, GOAL_LINE_WIDTH); if (goal->type==GOAL) { /* goal */ p1.x=elem->corner.x; p1.y= elem->corner.y; p2.x=p1.x+elem->width; p2.y=p1.y+elem->height; renderer_ops->draw_rounded_rect (renderer,&p1,&p2, &GOAL_BG_COLOR, &GOAL_FG_COLOR, elem->height/2.0); } else { /* softgoal */ compute_cloud(goal,bpl); renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer_ops->draw_beziergon(renderer,bpl,5,&GOAL_BG_COLOR,&GOAL_FG_COLOR); } /* drawing text */ text_draw(goal->text, renderer); }
/** draw is here */ static void req_draw(Requirement *req, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Element *elem; real x, y, w, h; Point c; assert(req != NULL); assert(renderer != NULL); elem = &req->element; x = elem->corner.x; y = elem->corner.y; w = elem->width; h = elem->height; c.x = x + w/2.0; c.y = y + h/2.0; renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer_ops->set_linewidth(renderer, REQ_LINEWIDTH); renderer_ops->set_dashlength(renderer, REQ_DASHLEN); renderer_ops->set_linestyle(renderer, LINESTYLE_DASHED); renderer_ops->fill_ellipse(renderer, &c, w, h, &color_white); renderer_ops->draw_ellipse(renderer, &c, w, h, &color_black); text_draw(req->text, renderer); }
void UserIDScreenInterface::UserIDButtonDraw ( Button *button, bool highlighted, bool clicked ) { UplinkAssert ( button ); int screenheight = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" ); glScissor ( button->x, screenheight - (button->y + button->height), button->width, button->height ); glEnable ( GL_SCISSOR_TEST ); // Draw a background colour SetColour ( "PasswordBoxBackground" ); glBegin ( GL_QUADS ); glVertex2i ( button->x, button->y ); glVertex2i ( button->x + button->width - 1, button->y ); glVertex2i ( button->x + button->width - 1, button->y + button->height ); glVertex2i ( button->x, button->y + button->height ); glEnd (); // Draw the text SetColour ( "DefaultText" ); text_draw ( button, highlighted, clicked ); // Draw a border if ( highlighted || clicked ) border_draw ( button ); glDisable ( GL_SCISSOR_TEST ); }
static void ellipse_draw(Ellipse *ellipse, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Element *elem; Point center; assert(ellipse != NULL); assert(renderer != NULL); elem = &ellipse->element; center.x = elem->corner.x + elem->width/2; center.y = elem->corner.y + elem->height/2; if (ellipse->show_background) { renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer_ops->fill_ellipse(renderer, ¢er, elem->width, elem->height, &ellipse->inner_color); } renderer_ops->set_linewidth(renderer, ellipse->border_width); renderer_ops->set_linestyle(renderer, ellipse->line_style); renderer_ops->set_dashlength(renderer, ellipse->dashlength); renderer_ops->set_linejoin(renderer, LINEJOIN_MITER); renderer_ops->draw_ellipse(renderer, ¢er, elem->width, elem->height, &ellipse->border_color); text_draw(ellipse->text, renderer); }
static void state_draw(State *state, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Element *elem; real x, y, w, h; Point p1, p2; assert(state != NULL); assert(renderer != NULL); elem = &state->element; x = elem->corner.x; y = elem->corner.y; w = elem->width; h = elem->height; renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer_ops->set_linewidth(renderer, STATE_LINEWIDTH); renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID); p1.x = x; p1.y = y; p2.x = x + w; p2.y = y + h; renderer_ops->fill_rounded_rect(renderer, &p1, &p2, &state->fill_color, 1.0); renderer_ops->draw_rounded_rect(renderer, &p1, &p2, &state->line_color, 1.0); text_draw(state->text, renderer); }
static void radiocell_draw(RadioCell *radiocell, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); PolyShape *poly; Point *points; int n; assert(radiocell != NULL); assert(renderer != NULL); poly = &radiocell->poly; points = &poly->points[0]; n = poly->numpoints; if (radiocell->show_background) renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer_ops->set_linecaps(renderer, LINECAPS_BUTT); renderer_ops->set_linejoin(renderer, LINEJOIN_MITER); renderer_ops->set_linestyle(renderer, radiocell->line_style, radiocell->dashlength); renderer_ops->set_linewidth(renderer, radiocell->line_width); renderer_ops->draw_polygon(renderer, points, n, (radiocell->show_background) ? &radiocell->fill_colour : NULL, &radiocell->line_colour); text_draw(radiocell->text, renderer); }
static void wave_draw_one(wave_t *wave, int dx) { char buf[BUF_SIZE]; snprintf(buf, sizeof(buf), "%dx", wave->noobs); if(wave->hp > NOOB_DEFAULT_HP * 50) glColor3f(1.0, 0.2, 0.2); text_draw(buf, dx + 5, BOT_BAR - 13); glPushMatrix(); glTranslatef(dx, LEVEL_BAR, 0); if(wave->shield > wave->hp) glColor3f(0.5, 0.5, 1.0); else glColor3f(0.9, 0.9, 0.9); glCallList(DISPLAY_LIST_WAVE); glTranslatef(57, 5, 0); if(wave->armor_type & ARMOR_COMPOSITE) { glCallList(DISPLAY_LIST_COMP); glTranslatef(-12, 0, 0); } if(wave->armor_type & ARMOR_REFLECTIVE) glCallList(DISPLAY_LIST_REFLECT); glPopMatrix(); }
void textNum_draw_Hcentered ( s32 n, u8 y, u16 ms ) { char str[12]; intToStr(n, str, 1); text_draw ( str, XCENTER, y, ms ); }
void mapper105_draw(mappers_t *m) { text_draw(&m->m105_label); checkbox_draw(&m->m105_check[0]); checkbox_draw(&m->m105_check[1]); checkbox_draw(&m->m105_check[2]); checkbox_draw(&m->m105_check[3]); }
void ConsoleScreenInterface::MessageDraw ( Button *button, bool highlighted, bool clicked ) { clear_draw ( button->x, button->y, button->width, button->height ); glColor3f ( 0.6f, 1.0f, 0.6f ); text_draw ( button, highlighted, clicked ); }
static void function_draw(Function *pkg, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Element *elem; real x, y, w, h; Point p1, p2; real font_height ; assert(pkg != NULL); assert(pkg->text != NULL); assert(renderer != NULL); elem = &pkg->element; x = elem->corner.x; y = elem->corner.y; w = elem->width; h = elem->height; font_height = pkg->text->height ; renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer_ops->set_linewidth(renderer, font_height / FUNCTION_BORDERWIDTH_SCALE ); renderer_ops->set_linestyle(renderer, pkg->is_wish ? LINESTYLE_DASHED : LINESTYLE_SOLID); if ( pkg->is_wish ) renderer_ops->set_dashlength( renderer, font_height / FUNCTION_DASHLENGTH_SCALE ) ; p1.x = x; p1.y = y; p2.x = x+w; p2.y = y+h; if (pkg->is_user) { renderer_ops->fill_rect(renderer, &p1, &p2, &color_white); renderer_ops->draw_rect(renderer, &p1, &p2, &color_black); p1.x += font_height / FUNCTION_MARGIN_SCALE; p1.y += font_height / FUNCTION_MARGIN_SCALE; p2.y -= font_height / FUNCTION_MARGIN_SCALE; p2.x -= font_height / FUNCTION_MARGIN_SCALE; /* y += FUNCTION_MARGIN_M; */ } renderer_ops->fill_rect(renderer, &p1, &p2, &color_white); renderer_ops->draw_rect(renderer, &p1, &p2, &color_black); text_draw(pkg->text, renderer); }
void texture_edit_draw_button(d3rect *box,int title_offset,char *title,float font_size,bool has_trig,int sel_idx) { float col_rg,vertexes[8],colors[16]; // the button box col_rg=0.7f; if (texture_edit_frame_click_idx==sel_idx) col_rg=0.5f; vertexes[0]=vertexes[6]=(float)box->lx; vertexes[2]=vertexes[4]=(float)box->rx; vertexes[1]=vertexes[3]=(float)box->ty; vertexes[5]=vertexes[7]=(float)box->by; colors[0]=colors[1]=colors[4]=colors[5]=col_rg; colors[2]=colors[6]=1.0f; colors[8]=colors[9]=colors[12]=colors[13]=col_rg-0.2f; colors[10]=colors[14]=0.8f; colors[3]=colors[7]=colors[11]=colors[15]=1.0f; glVertexPointer(2,GL_FLOAT,0,vertexes); glEnableClientState(GL_COLOR_ARRAY); glColorPointer(4,GL_FLOAT,0,colors); glDrawArrays(GL_QUADS,0,4); glDisableClientState(GL_COLOR_ARRAY); // the outline glColor4f(0.0f,0.0f,0.0f,1.0f); glDrawArrays(GL_LINE_LOOP,0,4); // the trig if (has_trig) { vertexes[0]=(float)(box->rx-20); vertexes[1]=(float)(box->ty+5); vertexes[2]=(float)(box->rx-5); vertexes[3]=(float)(box->by-5); vertexes[4]=(float)(box->rx-35); vertexes[5]=(float)(box->by-5); glVertexPointer(2,GL_FLOAT,0,vertexes); glColor4f(0.2f,0.2f,1.0f,1.0f); glDrawArrays(GL_TRIANGLES,0,3); glColor4f(0.0f,0.0f,0.0f,1.0f); glDrawArrays(GL_LINE_LOOP,0,3); } // the button text text_draw((box->lx+title_offset),(box->by-5),font_size,NULL,title); }
static void bar_draw(int x, int y, state_t *state) { char buf[BUF_SIZE]; glColor3f(0.1, 0.1, 0.1); glBegin(GL_QUADS); glVertex2f(0, BOT_BAR); glVertex2f(XRES, BOT_BAR); glVertex2f(XRES, YRES); glVertex2f(0, YRES); glEnd(); buf[0] = '\0'; glColor3f(0.9, 0.9, 0.9); if(in_main_area(x, y)) { if(state->selected != TT_NONE) snprintf(buf, sizeof(buf), "Click to place %s tower (cost: %d)", tt_data[state->selected].dscr, tower_cost); else if(grid[y/GRID_SIZE][x/GRID_SIZE].g == GRID_TYPE_TOWER) strcpy(buf, "Click to increase power supplied, " "right click to decrease"); else strcpy(buf, "Select a tower type from the lower left"); } else if(in_sel_box(x, y)) { int sy = YRES - y; if(x % BTN_SIZE > BTN_OFFSET && sy % BTN_SIZE > BTN_OFFSET) { sel_t *sel = &sel_arr[sy / BTN_SIZE][x / BTN_SIZE]; if(sel->unlocked) snprintf(buf, sizeof(buf), "Click to select %s tower", tt_data[sel->type].dscr); else if(sel->dep && sel->dep->unlocked) snprintf(buf, sizeof(buf), "Click to unlock %s tower (cost: %d)", tt_data[sel->type].dscr, sel->cost); } } text_draw(buf, 184, 550); snprintf(buf, sizeof(buf), "Power used: %d/%d", state->power_used, state->max_power); text_draw(buf, 184, 576); snprintf(buf, sizeof(buf), "Gil: %d", state->gil); text_draw(buf, 184, 602); }
void aadlbox_draw(Aadlbox *aadlbox, DiaRenderer *renderer) { int i; text_draw(aadlbox->name, renderer); /* draw ports */ for (i=0;i<aadlbox->num_ports;i++) aadlbox_draw_port(aadlbox->ports[i], renderer); }
static void state_draw(State *state, Renderer *renderer) { Element *elem; real x, y, w, h, r; Point p1, p2; assert(state != NULL); assert(renderer != NULL); elem = &state->element; x = elem->corner.x; y = elem->corner.y; w = elem->width; h = elem->height; renderer->ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer->ops->set_linewidth(renderer, STATE_LINEWIDTH); renderer->ops->set_linestyle(renderer, LINESTYLE_SOLID); if (state->state_type!=STATE_NORMAL) { p1.x = x + w/2; p1.y = y + h/2; if (state->state_type==STATE_END) { r = STATE_ENDRATIO; renderer->ops->fill_ellipse(renderer, &p1, r, r, &color_white); renderer->ops->draw_ellipse(renderer, &p1, r, r, &color_black); } r = STATE_RATIO; renderer->ops->fill_ellipse(renderer, &p1, r, r, &color_black); } else { p1.x = x; p1.y = y; p2.x = x + w; p2.y = y + h; renderer->ops->fill_rect(renderer, &p1, &p2, &color_white); draw_rounded_rectangle(renderer, p1, p2, 0.5); text_draw(state->text, renderer); } }
void draw_message_box(char *line1, char *line2, char *line3) { i32 i, w = CANVAS_WIDTH, h = CANVAS_HEIGHT; draw_sprite(0, h-1-2.0f*TILE_SIZE, 0, 4, 0); draw_sprite(0, h-1-1.0f*TILE_SIZE, 0, 5, 0); draw_sprite(w-1-TILE_SIZE, h-1-2.0f*TILE_SIZE, 0, 4, DrawFlags_FlipH); draw_sprite(w-1-TILE_SIZE, h-1-1.0f*TILE_SIZE, 0, 5, DrawFlags_FlipH); for (i = TILE_SIZE; i < w-1-TILE_SIZE; i += TILE_SIZE) { draw_sprite(i, h-1-2.0f*TILE_SIZE, 1, 4, 0); draw_sprite(i, h-1-1.0f*TILE_SIZE, 1, 5, 0); } rect_draw(rect_make_size(5, h-1-27, w-1-10, 22), PC_WHITE); if (line1) text_draw(8, 116+0*font.char_height, line1, PC_BLACK); if (line2) text_draw(8, 116+1*font.char_height, line2, PC_BLACK); if (line3) text_draw(8, 116+2*font.char_height, line3, PC_BLACK); }
void load_draw(load_t *m) { int x,y; x = m->info.x; y = m->info.y; if(m->isshowing == 0) return; gui_draw_border(GUI_COLOR_DARKBLUE,x,y,m->info.w,m->info.h); gui_draw_border(GUI_COLOR_GREY,x,y,m->info.w,9); gui_draw_text(GUI_TEXT,x+2,y+2,"Load ROM"); button_draw(&m->closebtn); button_draw(&m->loadbtn); list_draw(&m->romlist); list_draw(&m->dirlist); edit_draw(&m->edit); text_draw(&m->pathtext); text_draw(&m->rominfo[0]); text_draw(&m->rominfo[1]); }
static void rendobj_draw(RenderObject *rend_obj, Renderer *renderer) { render_store_render(rend_obj->desc->store, renderer, &rend_obj->element.corner, rend_obj->magnify); if ( (rend_obj->desc->use_text) && (!text_is_empty(rend_obj->text)) ) text_draw(rend_obj->text, renderer); }
int text_keypad_thumbscript_event(GR_EVENT *event) { int i; switch (event->type) { case GR_EVENT_TYPE_TIMER: if (is_clickwheel_timer(event)) { i = clickwheel_octrant(); if (clickwheel_change(i) && (i>=0)) { text_keypad_thumbscript_4gpush(i); text_draw(); } } break; case GR_EVENT_TYPE_KEY_DOWN: switch (event->keystroke.ch) { case '\n': case '\r': text_keypad_thumbscript_push(4); text_draw(); break; case 'l': case 'r': break; case 'w': text_output_char(28); break; case 'f': text_output_char(29); break; case 'd': text_output_char(10); break; case 'm': text_exit(); break; } break; } return 1; }
static void note_draw(Note *note, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Element *elem; real x, y, w, h; Point poly[5]; assert(note != NULL); assert(renderer != NULL); elem = ¬e->element; x = elem->corner.x; y = elem->corner.y; w = elem->width; h = elem->height; renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer_ops->set_linewidth(renderer, note->line_width); renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID); poly[0].x = x; poly[0].y = y; poly[1].x = x+w-NOTE_CORNER; poly[1].y = y; poly[2].x = x+w; poly[2].y = y+NOTE_CORNER; poly[3].x = x+w; poly[3].y = y+h; poly[4].x = x; poly[4].y = y+h; renderer_ops->fill_polygon(renderer, poly, 5, ¬e->fill_color); renderer_ops->draw_polygon(renderer, poly, 5, ¬e->line_color); poly[0] = poly[1]; poly[1].x = x + w - NOTE_CORNER; poly[1].y = y + NOTE_CORNER; poly[2] = poly[2]; renderer_ops->set_linewidth(renderer, note->line_width / 2); renderer_ops->draw_polyline(renderer, poly, 3, ¬e->line_color); text_draw(note->text, renderer); }
static void textobj_draw(Textobj *textobj, DiaRenderer *renderer) { assert(textobj != NULL); assert(renderer != NULL); if (textobj->show_background) { Rectangle box; Point ul, lr; text_calc_boundingbox (textobj->text, &box); ul.x = box.left - textobj->margin; ul.y = box.top - textobj->margin; lr.x = box.right + textobj->margin; lr.y = box.bottom + textobj->margin; if (textobj->text_angle == 0) { DIA_RENDERER_GET_CLASS (renderer)->draw_rect (renderer, &ul, &lr, &textobj->fill_color, NULL); } else { Point poly[4]; _textobj_get_poly (textobj, poly); DIA_RENDERER_GET_CLASS (renderer)->draw_polygon (renderer, poly, 4, &textobj->fill_color, NULL); } } if (textobj->text_angle == 0) { text_draw(textobj->text, renderer); } else { DIA_RENDERER_GET_CLASS (renderer)->draw_rotated_text (renderer, textobj->text, &textobj->text_handle.pos, textobj->text_angle); /* XXX: interactive case not working correctly */ if (renderer->is_interactive && dia_object_is_selected(&textobj->object) && textobj->text->focus.has_focus) { /* editing is not rotated */ text_draw(textobj->text, renderer); } } }
static void annotation_draw(Annotation *annotation, DiaRenderer *renderer) { Point *endpoints; Point vect,rvect,v1,v2; Point pts[4]; real vlen; DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); assert(annotation != NULL); assert(renderer != NULL); endpoints = &annotation->connection.endpoints[0]; renderer_ops->set_linewidth(renderer, ANNOTATION_LINE_WIDTH); renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID); renderer_ops->set_linecaps(renderer, LINECAPS_BUTT); vect = annotation->connection.endpoints[1]; point_sub(&vect,&annotation->connection.endpoints[0]); vlen = distance_point_point(&annotation->connection.endpoints[0], &annotation->connection.endpoints[1]); if (vlen > 0.0) { /* draw the squiggle */ point_scale(&vect,1/vlen); rvect.y = vect.x; rvect.x = -vect.y; pts[0] = annotation->connection.endpoints[0]; pts[1] = annotation->connection.endpoints[0]; v1 = vect; point_scale(&v1,.5*vlen); point_add(&pts[1],&v1); pts[2] = pts[1]; /* pts[1] and pts[2] are currently both at the middle of (pts[0],pts[3]) */ v1 = vect; point_scale(&v1,ANNOTATION_ZLEN); v2 = rvect; point_scale(&v2,ANNOTATION_ZLEN); point_sub(&v1,&v2); point_add(&pts[1],&v1); point_sub(&pts[2],&v1); pts[3] = annotation->connection.endpoints[1]; renderer_ops->draw_polyline(renderer, pts, sizeof(pts) / sizeof(pts[0]), &color_black); } text_draw(annotation->text,renderer); }
static void flow_draw(Flow *flow, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Point *endpoints, p1, p2; Arrow arrow; int n1 = 1, n2 = 0; Color* render_color = NULL; assert(flow != NULL); assert(renderer != NULL); arrow.type = ARROW_FILLED_TRIANGLE; arrow.width = FLOW_ARROWWIDTH; arrow.length = FLOW_ARROWLEN; endpoints = &flow->connection.endpoints[0]; renderer_ops->set_linewidth(renderer, FLOW_WIDTH); renderer_ops->set_linecaps(renderer, LINECAPS_BUTT); switch (flow->type) { case FLOW_SIGNAL: renderer_ops->set_dashlength(renderer, FLOW_DASHLEN); renderer_ops->set_linestyle(renderer, LINESTYLE_DASHED); render_color = &flow_color_signal ; break ; case FLOW_MATERIAL: renderer_ops->set_linewidth(renderer, FLOW_MATERIAL_WIDTH ) ; renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID); render_color = &flow_color_material ; break ; case FLOW_ENERGY: render_color = &flow_color_energy ; renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID); } p1 = endpoints[n1]; p2 = endpoints[n2]; renderer_ops->draw_line_with_arrows(renderer, &p1, &p2, FLOW_WIDTH, render_color, &arrow, NULL); text_draw(flow->text, renderer); }
void about_draw(about_t *m) { int i,x,y; x = m->info.x; y = m->info.y; if(m->isshowing == 0) return; gui_draw_border(GUI_WINDOWCLIENT,x,y,m->info.w,m->info.h); gui_draw_border(GUI_WINDOWBORDER,x,y,m->info.w,9); gui_draw_text(GUI_TEXT,x+2,y+2,"About"); button_draw(&m->donebtn); for(i=0;i<20;i++) text_draw(&m->text[i]); }
static void usecase_draw(Usecase *usecase, DiaRenderer *renderer) { DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer); Element *elem; real x, y, w, h; Point c; assert(usecase != NULL); assert(renderer != NULL); elem = &usecase->element; x = elem->corner.x; y = elem->corner.y; if (usecase->text_outside) { w = USECASE_WIDTH; h = USECASE_HEIGHT; c.x = x + elem->width/2.0; c.y = y + USECASE_HEIGHT / 2.0; } else { w = elem->width; h = elem->height; c.x = x + w/2.0; c.y = y + h/2.0; } renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID); renderer_ops->set_linewidth(renderer, usecase->line_width); if (usecase->collaboration) renderer_ops->set_linestyle(renderer, LINESTYLE_DASHED); else renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID); renderer_ops->fill_ellipse(renderer, &c, w, h, &usecase->fill_color); renderer_ops->draw_ellipse(renderer, &c, w, h, &usecase->line_color); text_draw(usecase->text, renderer); }