本文整理汇总了C++中FPointArray::map方法的典型用法代码示例。如果您正苦于以下问题:C++ FPointArray::map方法的具体用法?C++ FPointArray::map怎么用?C++ FPointArray::map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPointArray
的用法示例。
在下文中一共展示了FPointArray::map方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pix
: QDialog( parent, Qt::FramelessWindowHint)
#endif
{
int base = 48;
int size = base + qRound(-face.descent() * base) + 3;
int sizex = size + 2, sizey = size + 20;
resize(sizex, sizey);
setMinimumSize(sizex, sizey);
setMaximumSize(sizex, sizey);
pixm = QPixmap(size, size);
QImage pix(size, size, QImage::Format_ARGB32_Premultiplied);
ScPainter *p = new ScPainter(&pix, size, size);
p->clear();
pixm.fill(Qt::white);
QTransform chma;
chma.scale(4.8, 4.8);
uint gl = face.char2CMap(currentChar);
FPointArray gly = face.glyphOutline(gl);
double ww = size - face.glyphWidth(gl, base);
if (gly.size() > 4)
{
gly.map(chma);
p->translate(ww / 2, 1);
p->setBrush(Qt::black);
p->setFillMode(1);
p->setupPolygon(&gly);
p->fillPath();
p->end();
}
delete p;
pixm=QPixmap::fromImage(pix);
QString tmp;
tmp.sprintf("%04X", currentChar);
valu = "0x"+tmp;
}
示例2: data
QVariant CharTableModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || m_doc == 0)
return QVariant();
int ix = index.row() * m_cols + index.column();
uint currentChar;
QString currentFont = m_fontInUse;
if (ix < m_characters.count())
{
currentChar = m_characters[ix];
currentFont = m_fonts[ix];
}
else
return QVariant();
// for mimeData()
if (role == CharTableModel::CharTextRole)
return QString("%1").arg(QChar(currentChar));
if (role == CharTableModel::CharTextAndFontRole)
return QString("%1#%2").arg(currentChar).arg(currentFont);
// tooltip
if (role == Qt::ToolTipRole)
return QString("Unicode:\n0x%1").arg(currentChar, 4, 16, QChar('0'));
// status tip
if ( role == Qt::StatusTipRole )
{
QString tmp = QString("%1").arg(currentChar, 4, 16, QChar('0')).toUpper();
QStringList lst;
lst << tmp << currentFont;
return lst;
}
// pixmap
if (role == Qt::DecorationRole)
{
// m_cols should not become 0. Never.
int baseSize = m_viewWidth / m_cols;
QTransform chma;
chma.scale(baseSize/10, baseSize/10);
ScFace face = (*m_doc->AllFonts)[currentFont];
uint gl = face.char2CMap(currentChar);
int size = baseSize + qRound(-face.descent() * baseSize) + 1;
double ww = baseSize - face.glyphWidth(gl, baseSize);
QImage pix(baseSize, size, QImage::Format_ARGB32_Premultiplied);
ScPainter *p = new ScPainter(&pix, baseSize, size);
p->clear();
FPointArray gly = face.glyphOutline(gl, 1);
if (gly.size() > 4)
{
gly.map(chma);
p->translate(ww / 2, 1);
p->setBrush(Qt::black);
p->setFillMode(1);
p->setupPolygon(&gly);
p->fillPath();
p->end();
}
delete p;
return QVariant(QPixmap::fromImage(pix));
}
// trash
return QVariant();
}
示例3: processArrows
void XfigPlug::processArrows(int forward_arrow, QString fArrowData, int backward_arrow, QString bArrowData, int depth, PageItem *ite)
{
int arrow_typeAF; // (enumeration type)
int arrow_styleAF; // (enumeration type)
float arrow_thicknessAF; // (1/80 inch)
float arrow_widthAF; // (Fig units)
float arrow_heightAF; // (Fig units)
int arrow_typeAB; // (enumeration type)
int arrow_styleAB; // (enumeration type)
float arrow_thicknessAB; // (1/80 inch)
float arrow_widthAB; // (Fig units)
float arrow_heightAB; // (Fig units)
FPointArray arrow;
int z = -1;
PageItem::ItemType iteType;
if (forward_arrow == 1)
{
arrow.resize(0);
ScTextStream CodeAF(&fArrowData, QIODevice::ReadOnly);
CodeAF >> arrow_typeAF >> arrow_styleAF >> arrow_thicknessAF >> arrow_widthAF >> arrow_heightAF;
arrow_widthAF = fig2Pts(arrow_widthAF);
arrow_heightAF = fig2Pts(arrow_heightAF);
arrow_thicknessAF = arrow_thicknessAF / 80.0 * 72.0;
FPoint End = ite->PoLine.point(ite->PoLine.size()-2);
for (uint xx = ite->PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = ite->PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
QTransform arrowTrans;
if (arrow_typeAF == 0)
arrow.parseSVG("M -1, -0.5 L 0, 0 L -1, 0.5");
else if (arrow_typeAF == 1)
arrow.parseSVG("M -1, -0.5 L 0, 0 L -1, 0.5 z");
else if (arrow_typeAF == 2)
arrow.parseSVG("M -1, -0.5 L 0, 0 L -1, 0.5 L -0.7 0 z");
else if (arrow_typeAF == 3)
arrow.parseSVG("M -0.7, -0.5 L 0, 0 L -0.7, 0.5 L -1 0 z");
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(r);
arrowTrans.scale(arrow_heightAF, arrow_widthAF);
arrow.map(arrowTrans);
break;
}
}
QString fillC = "White";
if (arrow_styleAF == 1)
fillC = CurrColorStroke;
if (arrow_typeAF == 0)
{
fillC = CommonStrings::None;
iteType = PageItem::PolyLine;
}
else
iteType = PageItem::Polygon;
z = m_Doc->itemAdd(iteType, PageItem::Unspecified, ite->xPos(), ite->yPos(), 10, 10, arrow_thicknessAF, fillC, CurrColorStroke);
if (z >= 0)
{
PageItem *item = m_Doc->Items->at(z);
item->PoLine = arrow.copy();
item->ClipEdited = true;
item->FrameType = 3;
item->setFillShade(CurrFillShade);
item->setLineShade(CurrStrokeShade);
FPoint wh = getMaxClipF(&item->PoLine);
item->setWidthHeight(wh.x(),wh.y());
item->setTextFlowMode(PageItem::TextFlowDisabled);
m_Doc->adjustItemSize(item);
item->setWidthHeight(qMax(item->width(), 1.0), qMax(item->height(), 1.0));
depthMap.insert(999 - depth, currentItemNr);
currentItemNr++;
}
}
示例4: drawGlyph
//.........这里部分代码省略.........
else
gid = 32;
QTransform chma, chma4;
FPointArray outline;
if (gid == SpecialChars::TAB.unicode())
{
outline = m_item->doc()->symTab.copy();
chma4.translate(gl.xadvance - fontSize() * gl.scaleH * 0.7, -fontSize() * gl.scaleV * 0.5);
}
else if (gid == SpecialChars::COLBREAK.unicode())
{
outline = m_item->doc()->symNewCol.copy();
chma4.translate(0, -fontSize() * gl.scaleV * 0.6);
}
else if (gid == SpecialChars::FRAMEBREAK.unicode())
{
outline = m_item->doc()->symNewFrame.copy();
chma4.translate(0, -fontSize() * gl.scaleV * 0.6);
}
else if (gid == SpecialChars::PARSEP.unicode())
{
outline = m_item->doc()->symReturn.copy();
chma4.translate(0, -fontSize() * gl.scaleV * 0.8);
}
else if (gid == SpecialChars::LINEBREAK.unicode())
{
outline = m_item->doc()->symNewLine.copy();
chma4.translate(0, -fontSize() * gl.scaleV * 0.4);
}
else if (gid == SpecialChars::NBSPACE.unicode() || gid == 32)
{
stroke = (gid == 32);
outline = m_item->doc()->symNonBreak.copy();
chma4.translate(0, -fontSize() * gl.scaleV * 0.4);
}
else if (gid == SpecialChars::NBHYPHEN.unicode())
{
outline = font().glyphOutline(font().char2CMap(QChar('-')), fontSize());
chma4.translate(0, -fontSize() * gl.scaleV);
}
else if (gid == SpecialChars::SHYPHEN.unicode())
{
outline.resize(0);
outline.addQuadPoint(0, -10, 0, -10, 0, -6, 0, -6);
stroke = true;
}
else if (gid == SpecialChars::OBJECT.unicode())
{
//for showing marks entries as control chars
outline.resize(0);
outline.addQuadPoint(0, -8, 1, -8, 0, -6, 1, -6);
stroke = true;
}
else // ???
{
outline.resize(0);
outline.addQuadPoint(0, -10, 0, -10, 0, -9, 0, -9);
outline.addQuadPoint(0, -9, 0, -9, 1, -9, 1, -9);
outline.addQuadPoint(1, -9, 1, -9, 1, -10, 1, -10);
outline.addQuadPoint(1, -10, 1, -10, 0, -10, 0, -10);
}
chma.scale(gl.scaleH * fontSize() / 10.0, gl.scaleV * fontSize() / 10.0);
outline.map(chma * chma4);
m_painter->setupPolygon(&outline, true);
QColor oldBrush = m_painter->brush();
// FIXME
/* p->setBrush( (flags & ScLayout_SuppressSpace) ? Qt::green
: PrefsManager::instance()->appPrefs.displayPrefs.controlCharColor);*/
m_painter->setBrush(PrefsManager::instance()->appPrefs.displayPrefs.controlCharColor);
if (stroke)
{
QColor tmp = m_painter->pen();
m_painter->setStrokeMode(1);
m_painter->setPen(m_painter->brush(), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
m_painter->setLineWidth(fontSize() * gl.scaleV / 20.0);
m_painter->strokePath();
m_painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
}
else
{
m_painter->setFillMode(1);
m_painter->fillPath();
}
m_painter->setBrush(oldBrush);
}
else
{
m_painter->translate(0, -(fontSize() * gl.scaleV));
double scaleH = gl.scaleH * fontSize() / 10.0;
double scaleV = gl.scaleV * fontSize() / 10.0;
m_painter->scale(scaleH, scaleV);
FPointArray outline = font().glyphOutline(gid);
m_painter->setupPolygon(&outline, true);
if (outline.size() > 3)
m_painter->fillPath();
}
m_painter->setFillRule(fr);
m_painter->restore();
}
示例5: run
bool PathStrokerPlugin::run(ScribusDoc* doc, QString)
{
ScribusDoc* currDoc = doc;
if (currDoc == 0)
currDoc = ScCore->primaryMainWindow()->doc;
if (currDoc->m_Selection->count() > 0)
{
QVector<double> m_array;
PageItem *currItem = currDoc->m_Selection->itemAt(0);
FPointArray path = currItem->PoLine;
QPainterPath pp;
if (currItem->itemType() == PageItem::PolyLine)
pp = path.toQPainterPath(false);
else
pp = path.toQPainterPath(true);
if (currItem->NamedLStyle.isEmpty())
{
QPainterPathStroker stroke;
stroke.setCapStyle(currItem->lineEnd());
stroke.setJoinStyle(currItem->lineJoin());
if (currItem->lineStyle() == Qt::SolidLine)
stroke.setDashPattern(currItem->lineStyle());
else
{
getDashArray(currItem->lineStyle(), 1, m_array);
stroke.setDashPattern(m_array);
}
stroke.setWidth(currItem->lineWidth());
QPainterPath result = stroke.createStroke(pp).simplified();
if (currItem->startArrowIndex() != 0)
{
FPoint Start = currItem->PoLine.point(0);
for (uint xx = 1; xx < currItem->PoLine.size(); xx += 2)
{
FPoint Vector = currItem->PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
QMatrix arrowTrans;
FPointArray arrow = currDoc->arrowStyles.at(currItem->startArrowIndex()-1).points.copy();
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(r);
arrowTrans.scale(currItem->lineWidth(), currItem->lineWidth());
arrow.map(arrowTrans);
result.addPath(arrow.toQPainterPath(true));
break;
}
}
}
if (currItem->endArrowIndex() != 0)
{
FPoint End = currItem->PoLine.point(currItem->PoLine.size()-2);
for (uint xx = currItem->PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = currItem->PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
QMatrix arrowTrans;
FPointArray arrow = currDoc->arrowStyles.at(currItem->endArrowIndex()-1).points.copy();
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(r);
arrowTrans.scale(currItem->lineWidth(), currItem->lineWidth());
arrow.map(arrowTrans);
result.addPath(arrow.toQPainterPath(true));
break;
}
}
}
currDoc->m_Selection->clear();
PageItem* newItem = currDoc->convertItemTo(currItem, PageItem::Polygon);
newItem->setLineWidth(0);
newItem->setLineStyle(Qt::SolidLine);
newItem->setFillColor(newItem->lineColor());
newItem->setFillShade(newItem->lineShade());
newItem->setFillTransparency(newItem->lineTransparency());
newItem->setFillBlendmode(newItem->lineBlendmode());
FPointArray points;
points.fromQPainterPath(result);
newItem->PoLine = points;
newItem->Frame = false;
newItem->ClipEdited = true;
newItem->FrameType = 3;
currDoc->AdjustItemSize(newItem);
newItem->OldB2 = newItem->width();
newItem->OldH2 = newItem->height();
newItem->updateClip();
newItem->ContourLine = newItem->PoLine.copy();
newItem->setFillEvenOdd(true);
currDoc->m_Selection->addItem(newItem);
}
else
{
currDoc->m_Selection->clear();
multiLine ml = currDoc->MLineStyles[currItem->NamedLStyle];
bool first = true;
for (int it = ml.size()-1; it > -1; it--)
{
if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
{
//.........这里部分代码省略.........
示例6: getVisualBoundingRect
void PageItem_Line::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
{
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
double maxx = -std::numeric_limits<double>::max();
double maxy = -std::numeric_limits<double>::max();
double extraSpace = 0.0;
if (NamedLStyle.isEmpty())
{
if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0))
{
extraSpace = m_lineWidth / 2.0;
if ((extraSpace == 0) && m_Doc->view()) // Hairline case
extraSpace = 0.5 / m_Doc->view()->scale();
}
if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)) && (patternStrokePath))
{
ScPattern *pat = &m_Doc->docPatterns[patternStrokeVal];
QTransform mat;
mat.rotate(patternStrokeRotation);
mat.scale(patternStrokeScaleX / 100.0, patternStrokeScaleY / 100.0);
QRectF p1R = QRectF(0, 0, pat->width / 2.0, pat->height / 2.0);
QRectF p2R = mat.map(p1R).boundingRect();
extraSpace = p2R.height();
}
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
const SingleLine& sl = ml.last();
if (sl.Color != CommonStrings::None)
{
extraSpace = sl.Width / 2.0;
if ((extraSpace == 0) && m_Doc->view()) // Hairline case
extraSpace = 0.5 / m_Doc->view()->scale();
}
}
if (m_rotation != 0)
{
FPointArray pb;
pb.resize(0);
pb.addPoint(FPoint(0.0, -extraSpace, xPos(), yPos(), m_rotation, 1.0, 1.0));
pb.addPoint(FPoint(visualWidth(), -extraSpace, xPos(), yPos(), m_rotation, 1.0, 1.0));
pb.addPoint(FPoint(visualWidth(), +extraSpace, xPos(), yPos(), m_rotation, 1.0, 1.0));
pb.addPoint(FPoint(0.0, +extraSpace, xPos(), yPos(), m_rotation, 1.0, 1.0));
for (uint pc = 0; pc < 4; ++pc)
{
minx = qMin(minx, pb.point(pc).x());
miny = qMin(miny, pb.point(pc).y());
maxx = qMax(maxx, pb.point(pc).x());
maxy = qMax(maxy, pb.point(pc).y());
}
*x1 = minx;
*y1 = miny;
*x2 = maxx;
*y2 = maxy;
}
else
{
*x1 = m_xPos;
*y1 = m_yPos - extraSpace;
*x2 = m_xPos + visualWidth();
*y2 = m_yPos + extraSpace;
}
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(0, 0);
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrowTrans.scale(-1,1);
arrow.map(arrowTrans);
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(m_width, 0);
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
//.........这里部分代码省略.........
示例7: getBoundingRect
void PageItem_Line::getBoundingRect(double *x1, double *y1, double *x2, double *y2) const
{
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
double maxx = -std::numeric_limits<double>::max();
double maxy = -std::numeric_limits<double>::max();
if (m_rotation != 0)
{
FPointArray pb;
pb.resize(0);
pb.addPoint(FPoint(0, -m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
pb.addPoint(FPoint(m_width, -m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
pb.addPoint(FPoint(m_width, +m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
pb.addPoint(FPoint(0, +m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
for (uint pc = 0; pc < 4; ++pc)
{
minx = qMin(minx, pb.point(pc).x());
miny = qMin(miny, pb.point(pc).y());
maxx = qMax(maxx, pb.point(pc).x());
maxy = qMax(maxy, pb.point(pc).y());
}
*x1 = minx;
*y1 = miny;
*x2 = maxx;
*y2 = maxy;
}
else
{
*x1 = m_xPos;
*y1 = m_yPos - qMax(1.0, m_lineWidth) / 2.0;
*x2 = m_xPos + m_width;
*y2 = m_yPos + qMax(1.0, m_lineWidth) / 2.0;
}
QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(0, 0);
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrowTrans.scale(-1,1);
arrow.map(arrowTrans);
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(m_width, 0);
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
示例8: getVisualBoundingRect
void PageItem_Spiral::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
{
PageItem::getVisualBoundingRect(x1, y1, x2, y2);
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0 && !PoLine.empty())
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint Start = PoLine.point(0);
for (int xx = 1; xx < PoLine.size(); xx += 2)
{
FPoint Vector = PoLine.point(xx);
if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
{
arrowTrans.translate(Start.x(), Start.y());
arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
if (m_endArrowIndex != 0 && PoLine.size() >= 2)
{
QTransform arrowTrans;
FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
FPoint End = PoLine.point(PoLine.size()-2);
for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
{
FPoint Vector = PoLine.point(xx);
if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
{
arrowTrans.translate(End.x(), End.y());
arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
if (NamedLStyle.isEmpty())
{
if (m_lineWidth != 0.0)
arrowTrans.scale(m_lineWidth, m_lineWidth);
}
else
{
multiLine ml = m_Doc->MLineStyles[NamedLStyle];
if (ml[ml.size()-1].Width != 0.0)
arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
}
arrow.map(arrowTrans);
break;
}
}
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
}
totalRect.getCoords(x1, y1, x2, y2);
}
示例9: run
bool PathCutPlugin::run(ScribusDoc* doc, QString)
{
QString vers = QString(qVersion()).left(5);
if (vers < "4.3.3")
{
QMessageBox::information(doc->scMW(), tr("Qt Version too old"), tr("This plugin requires at least version 4.3.3 of the Qt library"));
return true;
}
ScribusDoc* currDoc = doc;
if (currDoc == 0)
currDoc = ScCore->primaryMainWindow()->doc;
if (currDoc->m_Selection->count() > 1)
{
PageItem *Item1 = currDoc->m_Selection->itemAt(0);
PageItem *Item2 = currDoc->m_Selection->itemAt(1);
if (Item1->itemType() != PageItem::PolyLine)
{
Item1 = currDoc->m_Selection->itemAt(1);
Item2 = currDoc->m_Selection->itemAt(0);
}
FPointArray path = Item1->PoLine;
QPainterPathStroker stroke;
stroke.setWidth(Item1->lineWidth());
QPainterPath cutter = stroke.createStroke(path.toQPainterPath(false));
QMatrix ms;
ms.translate(Item1->xPos() - Item2->xPos(), Item1->yPos() - Item2->yPos());
ms.rotate(Item1->rotation());
cutter = ms.map(cutter);
path.map(ms);
FPoint start = path.point(0);
FPoint end = path.point(path.size()-2);
QMatrix mm;
mm.rotate(Item2->rotation());
QPainterPath objekt = mm.map(Item2->PoLine.toQPainterPath(true));
if ((objekt.contains(QPointF(start.x(), start.y()))) || (objekt.contains(QPointF(end.x(), end.y()))))
{
QMessageBox::information(doc->scMW(), tr("Error"), tr("The cutting line must cross the polygon and\nboth end points must lie outside of the polygon"));
return true;
}
QPainterPath result = objekt.subtracted(cutter);
FPointArray points;
points.fromQPainterPath(result);
Item2->PoLine = points;
Item2->Frame = false;
Item2->ClipEdited = true;
Item2->FrameType = 3;
currDoc->AdjustItemSize(Item2);
Item2->OldB2 = Item2->width();
Item2->OldH2 = Item2->height();
Item2->updateClip();
Item2->ContourLine = Item2->PoLine.copy();
currDoc->m_Selection->clear();
currDoc->m_Selection->addItem(Item1);
currDoc->itemSelection_DeleteItem();
currDoc->m_Selection->clear();
currDoc->m_Selection->addItem(Item2);
currDoc->itemSelection_SplitItems();
currDoc->changed();
}
return true;
}
示例10: pixm
//.........这里部分代码省略.........
layerTable->setColumnWidth(1, 40);
layerTable->setColumnWidth(0, 24);
}
layerTable->setSortingEnabled(false);
layerTable->setSelectionBehavior( QAbstractItemView::SelectRows );
QHeaderView *Header = layerTable->verticalHeader();
Header->setMovable(false);
Header->setResizeMode(QHeaderView::Fixed);
Header->hide();
FlagsSicht.clear();
int col2Width = 0;
int col1Width = 0;
if (info->layerInfo.count() != 0)
{
if ((info->isRequest) && (info->RequestProps.contains(0)))
{
opacitySpinBox->setValue(qRound(info->RequestProps[0].opacity / 255.0 * 100));
setCurrentComboItem(blendMode, blendModes[info->RequestProps[0].blend]);
}
else
{
opacitySpinBox->setValue(qRound(info->layerInfo[0].opacity / 255.0 * 100));
setCurrentComboItem(blendMode, blendModes[info->layerInfo[0].blend]);
}
opacitySpinBox->setEnabled(true);
blendMode->setEnabled(true);
QString tmp;
QList<PSDLayer>::iterator it2;
uint counter = 0;
for (it2 = info->layerInfo.begin(); it2 != info->layerInfo.end(); ++it2)
{
QCheckBox *cp = new QCheckBox((*it2).layerName, this);
cp->setPalette(palette);
QPixmap pm;
pm=QPixmap::fromImage((*it2).thumb);
col1Width = qMax(col1Width, pm.width());
cp->setIcon(pm);
FlagsSicht.append(cp);
connect(cp, SIGNAL(clicked()), this, SLOT(changedLayer()));
layerTable->setCellWidget(info->layerInfo.count()-counter-1, 0, cp);
if ((info->isRequest) && (info->RequestProps.contains(counter)))
cp->setChecked(info->RequestProps[counter].visible);
else
cp->setChecked(!((*it2).flags & 2));
if (!(*it2).thumb_mask.isNull())
{
QCheckBox *cp2 = new QCheckBox((*it2).layerName, this);
cp2->setPalette(palette);
QPixmap pm2;
pm2=QPixmap::fromImage((*it2).thumb_mask);
col2Width = qMax(col2Width, pm2.width());
cp2->setIcon(pm2);
connect(cp2, SIGNAL(clicked()), this, SLOT(changedLayer()));
layerTable->setCellWidget(info->layerInfo.count()-counter-1, 1, cp2);
if ((info->isRequest) && (info->RequestProps.contains(counter)))
cp2->setChecked(info->RequestProps[counter].useMask);
else
cp2->setChecked(true);
FlagsMask.append(cp2);
}
else
FlagsMask.append(0);
QTableWidgetItem *tW = new QTableWidgetItem((*it2).layerName);
tW->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
layerTable->setItem(info->layerInfo.count()-counter-1, 2, tW);
layerTable->setRowHeight(info->layerInfo.count()-counter-1, 40);