本文整理汇总了C++中Transformer::identity方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformer::identity方法的具体用法?C++ Transformer::identity怎么用?C++ Transformer::identity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformer
的用法示例。
在下文中一共展示了Transformer::identity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read_idraw_graphic
//.........这里部分代码省略.........
glyph = nil;
} else if (strcmp(fig.name, "Text") == 0) {
skip(file);
fscanf(file, "%s", buffer);
getc(file);
PolyGlyph* col = layout.vbox_first_aligned();
PolyGlyph* line = layout.hbox_first_aligned();
FontBoundingBox bbox;
f->font_bbox(bbox);
Coord lineheight = bbox.font_ascent() + bbox.font_descent();
if (_idraw_font_metrics) {
lineheight /= fixtextscale;
}
int c;
while ((c = getc(file)) != ']') {
if (c == '\n') {
line->append(layout.strut(f));
col->append(
layout.v_fixed_span(line, lineheight)
);
line = layout.hbox();
} else if (c == ' ') {
if (_idraw_font_metrics) {
line->append(
layout.shape_of(new Character(' ', f, fg))
);
} else {
line->append(new Character(' ', f, fg));
}
} else if (c != ')' && c != '(') {
if (c == '\\') {
c = getc(file);
if (isdigit(c)) {
c -= '0';
c = (c * 8) + getc(file) - '0';
c = (c * 8) + getc(file) - '0';
}
}
line->append(new Character(c, f, fg));
}
}
Transformer fixtext;
if (_idraw_font_metrics) {
fixtext.scale(fixtextscale, fixtextscale);
}
fixtext.translate(0, bbox.font_descent() - lineheight);
glyph = new TransformSetter(col, fixtext);
} else {
skip(file);
int c = fig.coords;
if (c == -1) {
fscanf(file, "%d", &c);
}
Coord xx, yy;
Coord* x = new Coord[c];
Coord* y = new Coord[c];
for (int i = 0; i < c; ++i) {
fscanf(file, "%g %g", &xx, &yy);
x[i] = xx;
y[i] = yy;
}
const Brush* brush = (b != no_brush) ? b : nil;
const Color* stroke = fg;
const Color* fill = (
(s != no_stipple) ? dither_color(fg, bg, s->_dither) : nil
);
if (strcmp(fig.name, "Line") == 0) {
glyph = new Line(brush, stroke, fill, x[0], y[0], x[1], y[1]);
} else if (strcmp(fig.name, "BSpl") == 0) {
glyph = new Open_BSpline(brush, stroke, fill, x, y, c);
} else if (strcmp(fig.name, "CBSpl") == 0) {
glyph = new Closed_BSpline(brush, stroke, fill, x, y, c);
} else if (strcmp(fig.name, "MLine") == 0) {
glyph = new Polyline(brush, stroke, fill, x, y, c);
} else if (strcmp(fig.name, "Poly") == 0) {
glyph = new Polygon(brush, stroke, fill, x, y, c);
} else if (strcmp(fig.name, "Rect") == 0) {
glyph = new Rectangle(brush, stroke, fill,x[0],y[0],x[1],y[1]);
} else if (strcmp(fig.name, "Circ") == 0) {
fscanf(file, "%f", &xx);
glyph = new Circle(brush, stroke, fill, x[0], y[0], xx);
} else if (strcmp(fig.name, "Elli") == 0) {
fscanf(file, "%f %f", &xx, &yy);
glyph = new Ellipse(brush, stroke, fill, x[0], y[0], xx, yy);
} else {
glyph = nil;
}
delete x;
delete y;
}
for (int extra = fig.skip; extra > 0; --extra) {
skip(file);
}
}
if (glyph != nil && !tx.identity()) {
glyph = new TransformSetter(glyph, tx);
}
return glyph;
}