本文整理汇总了C++中ORORect::weight方法的典型用法代码示例。如果您正苦于以下问题:C++ ORORect::weight方法的具体用法?C++ ORORect::weight怎么用?C++ ORORect::weight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORORect
的用法示例。
在下文中一共展示了ORORect::weight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderPage
//.........这里部分代码省略.........
QPointF ps = p->backgroundPosition();
QSizeF sz = p->backgroundSize();
QRectF rc = QRectF(ps.x() * resolution, ps.y() * resolution, sz.width() * resolution, sz.height() * resolution);
renderBackground(image, p->backgroundImage(), rc.toRect(),
p->backgroundScale(), p->backgroundScaleMode(),
p->backgroundAlign(), p->backgroundOpacity());
}
// Render Watermark
if((!p->watermarkText().isEmpty()) && (p->watermarkOpacity() != 0))
{
doBgWm = true;
renderWatermark(image, p->watermarkText(), p->watermarkFont(), p->watermarkOpacity(),
((pDocument->pageOptions().getMarginLeft() + pDocument->pageOptions().getMarginRight()) * resolution),
((pDocument->pageOptions().getMarginTop() + pDocument->pageOptions().getMarginBottom()) * resolution),
pDocument->pageOptions().getMarginLeft() * resolution, pDocument->pageOptions().getMarginTop() * resolution);
}
if(doBgWm)
{
QRectF target(-printMarginWidth, -printMarginHeight, (painter->viewport().width() + printMarginWidth + printMarginWidth), (painter->viewport().height() + printMarginHeight + printMarginHeight));
QRectF source(0, 0, image.width(), image.height());
painter->drawImage(target, image, source);
}
}
// Render Page Objects
for(int i = 0; i < p->primitives(); i++)
{
OROPrimitive * prim = p->primitive(i);
QPen pen(prim->pen());
painter->save();
painter->setPen(pen);
painter->setBrush(prim->brush());
QPointF ps = prim->position();
if(prim->rotationAxis().isNull()) {
painter->translate(ps.x() * xDpi, ps.y() * yDpi);
painter->rotate(prim->rotation()); // rotation around the origin of the primitive (not the center)
}
else { // rotation around the defined axis
qreal xRot = prim->rotationAxis().x();
qreal yRot = prim->rotationAxis().y();
painter->translate(xRot * xDpi, yRot * yDpi);
painter->rotate(prim->rotation());
painter->translate((ps.x() - xRot) * xDpi, (ps.y() - yRot) * yDpi);
}
if(prim->type() == OROTextBox::TextBox)
{
OROTextBox * tb = (OROTextBox*)prim;
painter->setFont(tb->font());
QSizeF sz = tb->size();
QRectF rc = QRectF(0, 0, sz.width() * xDpi, sz.height() * yDpi);
painter->drawText(rc, tb->flags(), tb->text());
}
else if(prim->type() == OROLine::Line)
{
OROLine * ln = (OROLine*)prim;
QPointF s = ln->startPoint();
QPointF e = ln->endPoint();
pen.setWidthF((ln->weight() / 100) * printResolution);
painter->setPen(pen);
painter->drawLine(QLineF(0, 0, (e.x()-s.x()) * xDpi, (e.y()-s.y()) * yDpi));
}
else if(prim->type() == OROImage::Image)
{
OROImage * im = (OROImage*)prim;
QSizeF sz = im->size();
QRectF rc = QRectF(0, 0, sz.width() * xDpi, sz.height() * yDpi);
QImage img = im->image();
if(im->scaled())
img = img.scaled(rc.size().toSize(), (Qt::AspectRatioMode)im->aspectRatioMode(), (Qt::TransformationMode)im->transformationMode());
QRectF sr = QRectF(QPointF(0.0, 0.0), rc.size().boundedTo(img.size()));
painter->drawImage(rc.topLeft(), img, sr);
}
else if(prim->type() == ORORect::Rect)
{
ORORect * re = (ORORect*)prim;
QSizeF sz = re->size();
QRectF rc = QRectF(0, 0, sz.width() * xDpi, sz.height() * yDpi);
pen.setWidthF((re->weight() / 100) * printResolution);
painter->setPen(pen);
painter->drawRect(rc);
}
else
{
qDebug("unrecognized primitive type");
}
painter->restore();
}
}