本文整理汇总了C++中geom::OptRect::left方法的典型用法代码示例。如果您正苦于以下问题:C++ OptRect::left方法的具体用法?C++ OptRect::left怎么用?C++ OptRect::left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geom::OptRect
的用法示例。
在下文中一共展示了OptRect::left方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void
sp_gradient_pattern_common_setup(cairo_pattern_t *cp,
SPGradient *gr,
Geom::OptRect const &bbox,
double opacity)
{
// set spread type
switch (gr->getSpread()) {
case SP_GRADIENT_SPREAD_REFLECT:
cairo_pattern_set_extend(cp, CAIRO_EXTEND_REFLECT);
break;
case SP_GRADIENT_SPREAD_REPEAT:
cairo_pattern_set_extend(cp, CAIRO_EXTEND_REPEAT);
break;
case SP_GRADIENT_SPREAD_PAD:
default:
cairo_pattern_set_extend(cp, CAIRO_EXTEND_PAD);
break;
}
// add stops
for (std::vector<SPGradientStop>::iterator i = gr->vector.stops.begin();
i != gr->vector.stops.end(); ++i)
{
// multiply stop opacity by paint opacity
cairo_pattern_add_color_stop_rgba(cp, i->offset,
i->color.v.c[0], i->color.v.c[1], i->color.v.c[2], i->opacity * opacity);
}
// set pattern matrix
Geom::Affine gs2user = gr->gradientTransform;
if (gr->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX && bbox) {
Geom::Affine bbox2user(bbox->width(), 0, 0, bbox->height(), bbox->left(), bbox->top());
gs2user *= bbox2user;
}
ink_cairo_pattern_set_matrix(cp, gs2user.inverse());
}
示例2: LoadGlyph
//.........这里部分代码省略.........
POINTFX const *p=polyCurve->apfx;
POINTFX const *endp=p+polyCurve->cpfx;
switch (polyCurve->wType) {
case TT_PRIM_LINE:
while ( p != endp )
path_builder.lineTo(pointfx_to_nrpoint(*p++, scale));
break;
case TT_PRIM_QSPLINE:
{
g_assert(polyCurve->cpfx >= 2);
// The list of points specifies one or more control points and ends with the end point.
// The intermediate points (on the curve) are the points between the control points.
Geom::Point this_control = pointfx_to_nrpoint(*p++, scale);
while ( p+1 != endp ) { // Process all "midpoints" (all points except the last)
Geom::Point new_control = pointfx_to_nrpoint(*p++, scale);
path_builder.quadTo(this_control, (new_control+this_control)/2);
this_control = new_control;
}
Geom::Point end = pointfx_to_nrpoint(*p++, scale);
path_builder.quadTo(this_control, end);
}
break;
case 3: // TT_PRIM_CSPLINE
g_assert(polyCurve->cpfx % 3 == 0);
while ( p != endp ) {
path_builder.curveTo(pointfx_to_nrpoint(p[0], scale),
pointfx_to_nrpoint(p[1], scale),
pointfx_to_nrpoint(p[2], scale));
p += 3;
}
break;
}
curveOffset += sizeof(TTPOLYCURVE)+sizeof(POINTFX)*(polyCurve->cpfx-1);
}
}
polyOffset += polyHeader->cb;
}
doAdd=true;
}
delete [] buffer;
}
#else
if (FT_Load_Glyph (theFace, glyph_id, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP)) {
// shit happened
} else {
if ( FT_HAS_HORIZONTAL(theFace) ) {
n_g.h_advance=((double)theFace->glyph->metrics.horiAdvance)/((double)theFace->units_per_EM);
n_g.h_width=((double)theFace->glyph->metrics.width)/((double)theFace->units_per_EM);
} else {
n_g.h_width=n_g.h_advance=((double)(theFace->bbox.xMax-theFace->bbox.xMin))/((double)theFace->units_per_EM);
}
if ( FT_HAS_VERTICAL(theFace) ) {
n_g.v_advance=((double)theFace->glyph->metrics.vertAdvance)/((double)theFace->units_per_EM);
n_g.v_width=((double)theFace->glyph->metrics.height)/((double)theFace->units_per_EM);
} else {
n_g.v_width=n_g.v_advance=((double)theFace->height)/((double)theFace->units_per_EM);
}
if ( theFace->glyph->format == ft_glyph_format_outline ) {
FT_Outline_Funcs ft2_outline_funcs = {
ft2_move_to,
ft2_line_to,
ft2_conic_to,
ft2_cubic_to,
0, 0
};
FT2GeomData user(path_builder, 1.0/((double)theFace->units_per_EM));
FT_Outline_Decompose (&theFace->glyph->outline, &ft2_outline_funcs, &user);
}
doAdd=true;
}
#endif
path_builder.finish();
if ( doAdd ) {
Geom::PathVector pv = path_builder.peek();
// close all paths
for (Geom::PathVector::iterator i = pv.begin(); i != pv.end(); ++i) {
i->close();
}
if ( !pv.empty() ) {
n_g.pathvector = new Geom::PathVector(pv);
Geom::OptRect bounds = bounds_exact(*n_g.pathvector);
if (bounds) {
n_g.bbox[0] = bounds->left();
n_g.bbox[1] = bounds->top();
n_g.bbox[2] = bounds->right();
n_g.bbox[3] = bounds->bottom();
}
}
glyphs[nbGlyph]=n_g;
id_to_no[glyph_id]=nbGlyph;
nbGlyph++;
}
} else {
}
}