本文整理汇总了C++中DIA_RENDERER_GET_CLASS函数的典型用法代码示例。如果您正苦于以下问题:C++ DIA_RENDERER_GET_CLASS函数的具体用法?C++ DIA_RENDERER_GET_CLASS怎么用?C++ DIA_RENDERER_GET_CLASS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DIA_RENDERER_GET_CLASS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _do_bezier
static void
_do_bezier (WpgImportRenderer *ren, WPGPoint *pts, int iNum)
{
int num_points = (iNum + 2) / 3;
int i;
int ofs = ren->Box.Height;
BezPoint *bps;
g_return_if_fail (num_points > 1);
bps = g_alloca (num_points * sizeof(BezPoint));
bps[0].type = BEZ_MOVE_TO;
bps[0].p1.x = pts[0].x / WPU_PER_DCM;
bps[0].p1.y = (ofs - pts[0].y) / WPU_PER_DCM;
for (i = 1; i < num_points; ++i) {
bps[i].type = BEZ_CURVE_TO;
/* although declared as unsigned (WORD) these values have to be treaded
* as signed, because they can move in both directions.
*/
bps[i].p1.x = (gint16)pts[i*3-2].x / WPU_PER_DCM;
bps[i].p1.y = (ofs - (gint16)pts[i*3-2].y) / WPU_PER_DCM;
bps[i].p2.x = (gint16)pts[i*3-1].x / WPU_PER_DCM;
bps[i].p2.y = (ofs - (gint16)pts[i*3-1].y) / WPU_PER_DCM;
bps[i].p3.x = (gint16)pts[i*3 ].x / WPU_PER_DCM;
bps[i].p3.y = (ofs - (gint16)pts[i*3 ].y) / WPU_PER_DCM;
}
/* XXX: should we fold this calls into one? What's closing a WPG PolyCurve? */
if (ren->LineAttr.Type != WPG_LA_NONE)
DIA_RENDERER_GET_CLASS(ren)->draw_bezier (DIA_RENDERER(ren),
bps, num_points, &ren->stroke);
if (ren->FillAttr.Type != WPG_FA_HOLLOW)
DIA_RENDERER_GET_CLASS(ren)->draw_beziergon (DIA_RENDERER(ren),
bps, num_points, &ren->fill, NULL);
}
示例2: _do_ellipse
static void
_do_ellipse (WpgImportRenderer *ren, WPGEllipse* pEll)
{
int h = ren->Box.Height;
Point center;
center.x = pEll->x / WPU_PER_DCM;
center.y = (h - pEll->y) / WPU_PER_DCM;
if (fabs(pEll->EndAngle - pEll->StartAngle) < 360) {
/* WPG arcs are counter-clockwise so ensure that end is bigger than start */
real arcEnd = pEll->EndAngle;
if (arcEnd < pEll->StartAngle)
arcEnd += 360;
if (ren->LineAttr.Type != WPG_LA_NONE)
DIA_RENDERER_GET_CLASS(ren)->draw_arc (DIA_RENDERER(ren), ¢er,
2 * pEll->rx / WPU_PER_DCM,
2 * pEll->ry / WPU_PER_DCM,
pEll->StartAngle, arcEnd,
&ren->stroke);
if (ren->FillAttr.Type != WPG_FA_HOLLOW)
DIA_RENDERER_GET_CLASS(ren)->fill_arc (DIA_RENDERER(ren), ¢er,
2 * pEll->rx / WPU_PER_DCM,
2 * pEll->ry / WPU_PER_DCM,
pEll->StartAngle, arcEnd,
&ren->fill);
} else {
DIA_RENDERER_GET_CLASS(ren)->draw_ellipse (DIA_RENDERER(ren), ¢er,
2 * pEll->rx / WPU_PER_DCM,
2 * pEll->ry / WPU_PER_DCM,
(ren->FillAttr.Type != WPG_FA_HOLLOW) ? &ren->fill : NULL,
(ren->LineAttr.Type != WPG_LA_NONE) ? &ren->stroke : NULL);
}
}
示例3: handle_draw
void
handle_draw(Handle *handle, DDisplay *ddisp)
{
gboolean some_selected;
int x,y;
DiaRenderer *renderer = ddisp->renderer;
DiaInteractiveRendererInterface *irenderer =
DIA_GET_INTERACTIVE_RENDERER_INTERFACE (ddisp->renderer);
const Color *color;
ddisplay_transform_coords(ddisp, handle->pos.x, handle->pos.y, &x, &y);
/* change handle color to reflect different behaviour for multiple selected */
/* this code relies on the fact that only selected objects get their handles drawn */
some_selected = g_list_length (ddisp->diagram->data->selected) > 1;
if (handle->connected_to != NULL) {
color = &handle_color_connected[handle->type + (some_selected ? NUM_HANDLE_TYPES : 0)];
} else {
color = &handle_color[handle->type + (some_selected ? NUM_HANDLE_TYPES : 0)];
}
DIA_RENDERER_GET_CLASS(renderer)->set_linewidth(renderer, 0.0);
DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_SOLID);
DIA_RENDERER_GET_CLASS(renderer)->set_linejoin(renderer, LINEJOIN_MITER);
DIA_RENDERER_GET_CLASS(renderer)->set_fillstyle(renderer, FILLSTYLE_SOLID);
irenderer->fill_pixel_rect(renderer,
x - HANDLE_SIZE/2 + 1,
y - HANDLE_SIZE/2 + 1,
HANDLE_SIZE-2, HANDLE_SIZE-2,
/* it does not change the color, but does not reflect taht in the signature */
(Color *)color);
irenderer->draw_pixel_rect(renderer,
x - HANDLE_SIZE/2,
y - HANDLE_SIZE/2,
HANDLE_SIZE-1, HANDLE_SIZE-1,
&color_black);
if (handle->connect_type != HANDLE_NONCONNECTABLE) {
irenderer->draw_pixel_line
(renderer,
x - HANDLE_SIZE/2, y - HANDLE_SIZE/2,
x + HANDLE_SIZE/2, y + HANDLE_SIZE/2,
&color_black);
irenderer->draw_pixel_line
(renderer,
x - HANDLE_SIZE/2, y + HANDLE_SIZE/2,
x + HANDLE_SIZE/2, y - HANDLE_SIZE/2,
&color_black);
}
}
示例4: bus_draw
static void
bus_draw(Bus *bus, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Point *endpoints;
int i;
assert(bus != NULL);
assert(renderer != NULL);
endpoints = &bus->real_ends[0];
renderer_ops->set_linewidth(renderer, LINE_WIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
renderer_ops->draw_line(renderer,
&endpoints[0], &endpoints[1],
&bus->line_color);
for (i=0;i<bus->num_handles;i++) {
renderer_ops->draw_line(renderer,
&bus->parallel_points[i],
&bus->handles[i]->pos,
&bus->line_color);
}
}
示例5: beziergon_draw
static void
beziergon_draw(Beziergon *beziergon, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
BezierShape *bez = &beziergon->bezier;
BezPoint *points;
int n;
points = &bez->bezier.points[0];
n = bez->bezier.num_points;
renderer_ops->set_linewidth(renderer, beziergon->line_width);
renderer_ops->set_linestyle(renderer, beziergon->line_style);
renderer_ops->set_dashlength(renderer, beziergon->dashlength);
renderer_ops->set_linejoin(renderer, beziergon->line_join);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
if (beziergon->show_background)
renderer_ops->fill_bezier(renderer, points, n, &beziergon->inner_color);
renderer_ops->draw_bezier(renderer, points, n, &beziergon->line_color);
/* these lines should only be displayed when object is selected.
* Unfortunately the draw function is not aware of the selected
* state. This is a compromise until I fix this properly. */
if (renderer->is_interactive &&
dia_object_is_selected((DiaObject*)beziergon)) {
bezier_draw_control_lines (beziergon->bezier.bezier.num_points, beziergon->bezier.bezier.points, renderer);
}
}
示例6: aadlpackage_draw_borders
static void aadlpackage_draw_borders(Aadlbox *aadlbox, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Element *elem;
real x, y, w, h;
Point points[9];
assert(aadlbox != NULL);
assert(renderer != NULL);
elem = &aadlbox->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, AADLBOX_BORDERWIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
points[0].x = x; points[0].y = y;
points[1].x = x + 0.03 * w ; points[1].y = y;
points[2].x = x + 0.08 * w ; points[2].y = y - AADL_PORT_MAX_OUT;
points[3].x = x + 0.40 * w ; points[3].y = y - AADL_PORT_MAX_OUT;
points[4].x = x + 0.45 * w ; points[4].y = y;
points[5].x = x + w - 0.05 * w; points[5].y = y;
points[6].x = x + w; points[6].y = y + 0.05 * h;
points[7].x = x + w; points[7].y = y + h;
points[8].x = x ; points[8].y = y + h;
renderer_ops->draw_polygon(renderer, points, 9, &aadlbox->fill_color, &aadlbox->line_color);
}
示例7: newgroup_draw
static void
newgroup_draw(NewGroup *group, DiaRenderer *renderer)
{
Point lr_corner;
Element *elem;
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
assert(group != NULL);
assert(renderer != NULL);
elem = &group->element;
lr_corner.x = elem->corner.x + elem->width;
lr_corner.y = elem->corner.y + elem->height;
renderer_ops->set_linewidth(renderer, 0.01);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
renderer_ops->draw_rect(renderer,
&elem->corner,
&lr_corner,
&color_black);
}
示例8: normal_render
/*! The default object renderer.
* @param obj An object to render.
* @param renderer The renderer to render on.
* @param active_layer The layer containing the object.
* @param data The diagram containing the layer.
* \ingroup DiagramStructure
*/
static void
normal_render(DiaObject *obj, DiaRenderer *renderer,
int active_layer,
gpointer data)
{
DIA_RENDERER_GET_CLASS(renderer)->draw_object(renderer, obj, NULL);
}
示例9: zigzagline_draw
static void
zigzagline_draw(Zigzagline *zigzagline, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
OrthConn *orth = &zigzagline->orth;
Point *points;
int n;
points = &orth->points[0];
n = orth->numpoints;
renderer_ops->set_linewidth(renderer, zigzagline->line_width);
renderer_ops->set_linestyle(renderer, zigzagline->line_style);
renderer_ops->set_dashlength(renderer, zigzagline->dashlength);
renderer_ops->set_linejoin(renderer, zigzagline->line_join);
renderer_ops->set_linecaps(renderer, zigzagline->line_caps);
renderer_ops->draw_rounded_polyline_with_arrows(renderer,
points, n,
zigzagline->line_width,
&zigzagline->line_color,
&zigzagline->start_arrow,
&zigzagline->end_arrow,
zigzagline->corner_radius);
}
示例10: polyline_draw
static void
polyline_draw(Polyline *polyline, DiaRenderer *renderer)
{
Point gap_endpoints[2];
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
PolyConn *poly = &polyline->poly;
Point *points;
int n;
points = &poly->points[0];
n = poly->numpoints;
renderer_ops->set_linewidth(renderer, polyline->line_width);
renderer_ops->set_linestyle(renderer, polyline->line_style, polyline->dashlength);
renderer_ops->set_linejoin(renderer, polyline->line_join);
renderer_ops->set_linecaps(renderer, polyline->line_caps);
polyline_calculate_gap_endpoints(polyline, gap_endpoints);
polyline_exchange_gap_points(polyline, gap_endpoints);
renderer_ops->draw_rounded_polyline_with_arrows(renderer,
points, n,
polyline->line_width,
&polyline->line_color,
&polyline->start_arrow,
&polyline->end_arrow,
polyline->corner_radius);
polyline_exchange_gap_points(polyline, gap_endpoints);
}
示例11: assert
// specialized draw_rounded_polyline() for renderers with an own concept of Arrow
void
dia::Renderer::draw_rounded_polyline_with_arrows (Point *points, int num_points, real line_width, Color *color,
Arrow *start_arrow, Arrow *end_arrow, real radius)
{
assert (self);
DIA_RENDERER_GET_CLASS(self)->draw_rounded_polyline_with_arrows (self, points, num_points, line_width, color, start_arrow, end_arrow, radius);
}
示例12: line_draw
static void
line_draw(Line *line, DiaRenderer *renderer)
{
Point gap_endpoints[2];
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
assert(line != NULL);
assert(renderer != NULL);
renderer_ops->set_linewidth(renderer, line->line_width);
renderer_ops->set_linestyle(renderer, line->line_style, line->dashlength);
renderer_ops->set_linecaps(renderer, line->line_caps);
if (line->absolute_start_gap || line->absolute_end_gap ) {
line_adjust_for_absolute_gap(line, gap_endpoints);
renderer_ops->draw_line_with_arrows(renderer,
&gap_endpoints[0], &gap_endpoints[1],
line->line_width,
&line->line_color,
&line->start_arrow,
&line->end_arrow);
} else {
renderer_ops->draw_line_with_arrows(renderer,
&line->connection.endpoints[0],
&line->connection.endpoints[1],
line->line_width,
&line->line_color,
&line->start_arrow,
&line->end_arrow);
}
}
示例13: draw_dot
static void draw_dot(DiaRenderer *renderer,
Point *end, Point *vect, Color *col)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Point vv,vp,vt,pt;
real vlen;
vv = *end;
point_sub(&vv,vect);
vlen = distance_point_point(vect,end);
if (vlen < 1E-7) return;
point_scale(&vv,1/vlen);
vp.y = vv.x;
vp.x = -vv.y;
pt = *end;
vt = vp;
point_scale(&vt,ARROW_DOT_WOFFSET);
point_add(&pt,&vt);
vt = vv;
point_scale(&vt,-ARROW_DOT_LOFFSET);
point_add(&pt,&vt);
renderer_ops->set_fillstyle(renderer,FILLSTYLE_SOLID);
renderer_ops->fill_ellipse(renderer,&pt,
ARROW_DOT_RADIUS,ARROW_DOT_RADIUS,
col);
}
示例14: state_draw
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);
}
示例15: aadlsubprogram_draw_borders
static void aadlsubprogram_draw_borders(Aadlbox *aadlbox, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Element *elem;
real x, y, w, h;
Point center;
assert(aadlbox != NULL);
assert(renderer != NULL);
elem = &aadlbox->element;
x = elem->corner.x;
y = elem->corner.y;
w = elem->width;
h = elem->height;
center.x = x + 0.5*w;
center.y = y + 0.5*h;
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, AADLBOX_BORDERWIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID);
renderer_ops->fill_ellipse(renderer, ¢er, w, h, &aadlbox->fill_color);
renderer_ops->draw_ellipse(renderer, ¢er, w, h, &aadlbox->line_color);
}