本文整理汇总了C++中FPointArray类的典型用法代码示例。如果您正苦于以下问题:C++ FPointArray类的具体用法?C++ FPointArray怎么用?C++ FPointArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FPointArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawGlyph
void ScreenPainter::drawGlyphOutline(const GlyphLayout gl, bool fill)
{
if (fill)
drawGlyph(gl);
m_painter->save();
bool fr = m_painter->fillRule();
m_painter->setFillRule(false);
setupState(false);
m_painter->translate(0, -(fontSize() * gl.scaleV));
FPointArray outline = font().glyphOutline(gl.glyph);
double scaleHv = gl.scaleH * fontSize() / 10.0;
double scaleVv = gl.scaleV * fontSize() / 10.0;
QTransform trans;
trans.scale(scaleHv, scaleVv);
outline.map(trans);
m_painter->setupPolygon(&outline, true);
if (outline.size() > 3)
{
m_painter->setLineWidth(strokeWidth());
m_painter->strokePath();
}
m_painter->setFillRule(fr);
m_painter->restore();
}
示例2: QLineF
void CanvasMode_EditArc::mouseMoveEvent(QMouseEvent *m)
{
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
m->accept();
double newX = mousePointDoc.x();
double newY = mousePointDoc.y();
if (m_canvas->m_viewMode.m_MouseButtonPressed && m_view->moveTimerElapsed())
{
PageItem *currItem = m_doc->m_Selection->itemAt(0);
QTransform itemMatrix = currItem->getTransform();
QPointF sPoint = currItem->PoLine.pointQF(0);
QPointF smPoint = itemMatrix.map(sPoint);
QLineF stLinA = QLineF(smPoint, QPointF(m_Mxp, m_Myp));
QLineF stLinM = QLineF(smPoint, QPointF(newX, newY));
double deltaAngle = stLinM.angle() - stLinA.angle();
QPainterPath pp;
if (m_arcPoint == useControlStart)
m_startAngle += deltaAngle;
else if (m_arcPoint == useControlSweep)
m_endAngle += deltaAngle;
else if (m_arcPoint == useControlHeight)
m_heightPoint = QPointF(m_heightPoint.x(), m_heightPoint.y() + (newY - m_Myp));
else if (m_arcPoint == useControlWidth)
m_widthPoint = QPointF(m_widthPoint.x() + (newX - m_Mxp), m_widthPoint.y());
double nSweep = m_endAngle - m_startAngle;
if (nSweep < 0)
nSweep += 360;
double nWidth = sPoint.x() - m_widthPoint.x();
double nHeight = sPoint.y() - m_heightPoint.y();
if ((nWidth > 0) && (nHeight > 0))
{
pp.moveTo(sPoint);
pp.arcTo(QRectF(sPoint.x() - nWidth, sPoint.y() - nHeight, nWidth * 2, nHeight * 2), m_startAngle, nSweep);
pp.closeSubpath();
FPointArray ar;
ar.fromQPainterPath(pp);
if (m_arcPoint == useControlStart)
{
m_startPoint = ar.pointQF(2);
QLineF stLinA = QLineF(smPoint, itemMatrix.map(m_startPoint));
m_canvas->displayRotHUD(m->globalPos(), 360.0 - stLinA.angle());
}
else if (m_arcPoint == useControlSweep)
{
m_endPoint = ar.pointQF(ar.size() - 4);
QLineF stLinA = QLineF(smPoint, itemMatrix.map(m_endPoint));
m_canvas->displayRotHUD(m->globalPos(), 360.0 - stLinA.angle());
}
QLineF res = QLineF(m_centerPoint, m_startPoint);
QLineF swe = QLineF(m_centerPoint, m_endPoint);
vectorDialog->setValues(res.angle(), swe.angle(), nHeight * 2, nWidth * 2);
blockUpdateFromItem(true);
currItem->update();
blockUpdateFromItem(false);
m_doc->regionsChanged()->update(itemMatrix.mapRect(QRectF(0, 0, currItem->width(), currItem->height())).adjusted(-nWidth, -nHeight, nWidth, nHeight));
}
}
m_Mxp = newX;
m_Myp = newY;
}
示例3: while
void KCurve::keyPressEvent(QKeyEvent *e)
{
if(e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace)
{
if (m_points.size() > 2)
{
FPoint closest_point = m_points.point(0);
FPoint p = m_points.point(0);
int pos = 0;
int cc = 0;
double distance = 1000; // just a big number
while(cc < m_points.size())
{
p = m_points.point(cc);
if (fabs (m_grab_point.x() - p.x()) < distance)
{
distance = fabs(m_grab_point.x() - p.x());
closest_point = p;
m_pos = pos;
}
cc++;
pos++;
}
FPointArray cli;
cli.putPoints(0, m_pos, m_points);
cli.putPoints(cli.size(), m_points.size()-m_pos-1, m_points, m_pos+1);
m_points.resize(0);
m_points = cli.copy();
m_grab_point = closest_point;
repaint();
emit modified();
QWidget::keyPressEvent(e);
}
}
}
示例4: LensDialog
bool LensEffectsPlugin::run(ScribusDoc* doc, QString)
{
ScribusDoc* currDoc = doc;
if (currDoc == 0)
currDoc = ScCore->primaryMainWindow()->doc;
if (currDoc->m_Selection->count() > 0)
{
LensDialog *dia = new LensDialog(currDoc->scMW(), currDoc);
if (dia->exec())
{
for (int a = 0; a < dia->origPathItem.count(); a++)
{
PageItem *currItem = currDoc->m_Selection->itemAt(a);
if (currItem->itemType() == PageItem::Line)
continue;
QPainterPath path = dia->origPathItem[a]->path();
FPointArray points;
points.fromQPainterPath(path);
currItem->PoLine = points;
currItem->Frame = false;
currItem->ClipEdited = true;
currItem->FrameType = 3;
currDoc->AdjustItemSize(currItem);
currItem->OldB2 = currItem->width();
currItem->OldH2 = currItem->height();
currItem->updateClip();
currItem->ContourLine = currItem->PoLine.copy();
}
currDoc->changed();
}
delete dia;
}
return true;
}
示例5: zp
void NodePalette::ToggleAbsMode()
{
if (doc==0)
return;
FPoint zp(0.0, 0.0);
disconnect(XSpin, SIGNAL(valueChanged(double)), this, SLOT(MovePoint()));
disconnect(YSpin, SIGNAL(valueChanged(double)), this, SLOT(MovePoint()));
FPointArray Clip;
FPoint np(0.0, 0.0);
if (EditCont->isChecked())
Clip = doc->m_Selection->itemAt(0)->ContourLine;
else
Clip = doc->m_Selection->itemAt(0)->PoLine;
if (doc->nodeEdit.SelNode.count() != 0)
np = Clip.point(doc->nodeEdit.SelNode.at(0));
if (AbsMode->isChecked())
{
XSpin->setMinimum(-16777215);
YSpin->setMinimum(-16777215);
if (absToCanvas->isChecked())
zp = FPoint(doc->m_Selection->itemAt(0)->xPos(), doc->m_Selection->itemAt(0)->yPos());
else
zp = FPoint(doc->m_Selection->itemAt(0)->xPos() - doc->currentPage()->xOffset(), doc->m_Selection->itemAt(0)->yPos() - doc->currentPage()->yOffset());
}
else
{
XSpin->setMinimum(0);
YSpin->setMinimum(0);
}
XSpin->setValue((np.x() + zp.x())*doc->unitRatio());
YSpin->setValue((np.y() + zp.y())*doc->unitRatio());
connect(XSpin, SIGNAL(valueChanged(double)), this, SLOT(MovePoint()));
connect(YSpin, SIGNAL(valueChanged(double)), this, SLOT(MovePoint()));
}
示例6: doInvert
void CurveWidget::doInvert()
{
FPointArray curve = cDisplay->getCurve();
for (int a = 0; a < curve.size(); a++)
{
FPoint p = curve.point(a);
curve.setPoint(a, p.x(), 1.0 - p.y());
}
cDisplay->setCurve(curve);
}
示例7: LensDialog
bool LensEffectsPlugin::run(ScribusDoc* doc, QString)
{
ScribusDoc* currDoc = doc;
if (currDoc == 0)
currDoc = ScCore->primaryMainWindow()->doc;
if (currDoc->m_Selection->count() > 0)
{
LensDialog *dia = new LensDialog(currDoc->scMW(), currDoc);
if (dia->exec())
{
for (int a = 0; a < dia->origPathItem.count(); a++)
{
PageItem *currItem = dia->origPageItem[a];
if (currItem->itemType() == PageItem::Line)
continue;
QPainterPath path = dia->origPathItem[a]->path();
FPointArray points;
points.fromQPainterPath(path);
currItem->PoLine = points;
currItem->ClipEdited = true;
currItem->FrameType = 3;
double oW = currItem->width();
double oH = currItem->height();
currDoc->adjustItemSize(currItem, true);
currItem->OldB2 = currItem->width();
currItem->OldH2 = currItem->height();
if (currItem->isGroup())
{
currItem->groupWidth = currItem->groupWidth * (currItem->OldB2 / oW);
currItem->groupHeight = currItem->groupHeight * (currItem->OldH2 / oH);
}
currItem->updateClip();
if (currItem->isGroup())
{
currDoc->resizeGroupToContents(currItem);
currItem->SetRectFrame();
}
currItem->ContourLine = currItem->PoLine.copy();
}
if (currDoc->m_Selection->count() > 0)
{
PageItem *m_patternItem = currDoc->m_Selection->itemAt(0);
if (m_patternItem->isGroup())
{
currDoc->resizeGroupToContents(m_patternItem);
m_patternItem->SetRectFrame();
}
}
currDoc->changed();
currDoc->view()->DrawNew();
}
delete dia;
}
return true;
}
示例8: FPointArray
FPointArray ScFace::ScFaceData::glyphOutline(gid_type gl, qreal sz) const
{
if (gl >= CONTROL_GLYPHS)
return FPointArray();
else if (! m_glyphWidth.contains(gl)) {
loadGlyph(gl);
}
FPointArray res = m_glyphOutline[gl].Outlines.copy();
if (sz != 1.0)
res.scale(sz, sz);
return res;
}
示例9: setCurve
void KCurve::setCurve(FPointArray inlist)
{
m_points_back = m_points.copy();
m_points.resize(0);
m_points = inlist.copy();
repaint();
emit modified();
}
示例10: QDialog
: 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;
}
示例11: dia
void CurveWidget::doLoad()
{
QString fileName;
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString wdir = dirs->get("curves", ".");
CustomFDialog dia(this, wdir, tr("Open"), tr("Curve Files (*.scu *.SCU);;All Files (*)"), fdHidePreviewCheckBox | fdExistingFiles);
if (dia.exec() == QDialog::Accepted)
fileName = dia.selectedFile();
else
return;
if (!fileName.isEmpty())
{
dirs->set("curves", fileName.left(fileName.lastIndexOf("/")));
QFile f(fileName);
if (f.open(QIODevice::ReadOnly))
{
QTextStream fp(&f);
int numVals;
double xval, yval;
FPointArray curve;
curve.resize(0);
fp >> numVals;
for (int nv = 0; nv < numVals; nv++)
{
QString s;
fp >> s;
xval = ScCLocale::toDoubleC(s);
fp >> s;
yval = ScCLocale::toDoubleC(s);
curve.addPoint(xval, yval);
}
cDisplay->setCurve(curve);
int lin;
fp >> lin;
cDisplay->setLinear(lin);
}
示例12: clear
void ArrowChooser::rebuildList(QList<ArrowDesc> *arrowStyles)
{
clear();
FPointArray Path;
Path.resize(0);
addItem(CommonStrings::tr_None);
for (int a = 0; a < arrowStyles->count(); ++a)
{
QImage image(22, 22, QImage::Format_ARGB32);
ScPainter *painter = new ScPainter(&image, 22, 22);
painter->clear();
painter->setBrush(qRgb(0, 0, 0));
painter->setPen(qRgb(0, 0, 0));
painter->setFillMode(1);
painter->translate(3.0, 3.0);
Path.resize(0);
Path = arrowStyles->at(a).points.copy();
FPoint min = getMinClipF(&Path);
Path.translate(-min.x(), -min.y());
FPoint max = Path.WidthHeight();
QMatrix mm;
QMatrix mm2;
if (arrowDirection)
{
mm2.scale(-1, 1);
mm2.translate(-max.x(), 0);
}
mm.scale(16.0 / qMax(max.x(), max.y()), 16.0 / qMax(max.x(), max.y()));
Path.map(mm2 * mm);
painter->setupPolygon(&Path);
painter->setLineWidth(1.0);
painter->drawPolygon();
painter->drawPolyLine();
painter->end();
delete painter;
int wi = image.width();
int hi = image.height();
for( int yi=0; yi < hi; ++yi )
{
QRgb *s = (QRgb*)(image.scanLine( yi ));
for(int xi=0; xi < wi; ++xi )
{
if((*s) == 0xffffffff)
(*s) &= 0x00ffffff;
s++;
}
}
QPixmap Ico;
Ico=QPixmap::fromImage(image);
addItem(Ico, arrowStyles->at(a).name);
}
}
示例13: FPointArray
FPointArray ScFace::ScFaceData::glyphOutline(uint gl, qreal sz) const
{
if (gl >= CONTROL_GLYPHS)
return FPointArray();
else if (gl == 0) {
sz *= 10;
FPointArray sq;
sq.addQuadPoint(0,0,0,0,sz,0,sz,0);
sq.addQuadPoint(sz,0,sz,0,sz,sz,sz,sz);
sq.addQuadPoint(sz,sz,sz,sz,0,sz,0,sz);
sq.addQuadPoint(0,sz,0,sz,0,0,0,0);
return sq;
}
else if (! m_glyphWidth.contains(gl)) {
loadGlyph(gl);
}
FPointArray res = m_glyphOutline[gl].Outlines.copy();
if (sz != 1.0)
res.scale(sz, sz);
return res;
}
示例14: run
bool SubdividePlugin::run(ScribusDoc* doc, QString)
{
ScribusDoc* currDoc = doc;
if (currDoc == 0)
currDoc = ScCore->primaryMainWindow()->doc;
double nearT = 0.5;
uint docSelectionCount = currDoc->m_Selection->count();
if (docSelectionCount != 0)
{
for (uint aa = 0; aa < docSelectionCount; ++aa)
{
FPointArray points;
PageItem *currItem = currDoc->m_Selection->itemAt(aa);
if (currDoc->nodeEdit.isContourLine)
{
uint psize = currItem->ContourLine.size();
for (uint a = 0; a < psize-3; a += 4)
{
if (currItem->ContourLine.point(a).x() > 900000)
{
points.setMarker();
continue;
}
FPoint base = currItem->ContourLine.point(a);
FPoint c1 = currItem->ContourLine.point(a+1);
FPoint base2 = currItem->ContourLine.point(a+2);
FPoint c2 = currItem->ContourLine.point(a+3);
FPoint cn1 = (1.0 - nearT) * base + nearT * c1;
FPoint cn2 = (1.0 - nearT) * cn1 + nearT * ((1.0 - nearT) * c1 + nearT * c2);
FPoint cn3 = (1.0 - nearT) * ((1.0 - nearT) * c1 + nearT * c2) + nearT * ((1.0 - nearT) * c2 + nearT * base2);
FPoint cn4 = (1.0 - nearT) * c2 + nearT * base2;
FPoint bp1 = (1.0 - nearT) * cn2 + nearT * cn3;
if ((base == c1) && (base2 == c2))
{
points.addPoint(base);
points.addPoint(c1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(base2);
points.addPoint(c2);
}
else
{
points.addPoint(base);
points.addPoint(cn1);
points.addPoint(bp1);
points.addPoint(cn2);
points.addPoint(bp1);
points.addPoint(cn3);
points.addPoint(base2);
points.addPoint(cn4);
}
}
currItem->ContourLine = points;
}
else
{
uint psize = currItem->PoLine.size();
for (uint a = 0; a < psize-3; a += 4)
{
if (currItem->PoLine.point(a).x() > 900000)
{
points.setMarker();
continue;
}
FPoint base = currItem->PoLine.point(a);
FPoint c1 = currItem->PoLine.point(a+1);
FPoint base2 = currItem->PoLine.point(a+2);
FPoint c2 = currItem->PoLine.point(a+3);
FPoint cn1 = (1.0 - nearT) * base + nearT * c1;
FPoint cn2 = (1.0 - nearT) * cn1 + nearT * ((1.0 - nearT) * c1 + nearT * c2);
FPoint cn3 = (1.0 - nearT) * ((1.0 - nearT) * c1 + nearT * c2) + nearT * ((1.0 - nearT) * c2 + nearT * base2);
FPoint cn4 = (1.0 - nearT) * c2 + nearT * base2;
FPoint bp1 = (1.0 - nearT) * cn2 + nearT * cn3;
if ((base == c1) && (base2 == c2))
{
points.addPoint(base);
points.addPoint(c1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(bp1);
points.addPoint(base2);
points.addPoint(c2);
}
else
{
points.addPoint(base);
points.addPoint(cn1);
points.addPoint(bp1);
points.addPoint(cn2);
points.addPoint(bp1);
points.addPoint(cn3);
points.addPoint(base2);
points.addPoint(cn4);
}
}
currItem->PoLine = points;
//.........这里部分代码省略.........
示例15: UndoTransaction
bool PathFinderPlugin::run(ScribusDoc* doc, QString)
{
ScribusDoc* currDoc = doc;
if (currDoc == 0)
currDoc = ScCore->primaryMainWindow()->doc;
if (currDoc->m_Selection->count() <= 1)
return true;
//<<#9046
UndoTransaction* activeTransaction = NULL;
UndoManager* undoManager = UndoManager::instance();
if (UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IDocument, Um::PathOperation, "", Um::IPolygon));
//>>#9046
PageItem *Item1 = currDoc->m_Selection->itemAt(0);
PageItem *Item2 = currDoc->m_Selection->itemAt(1);
PathFinderDialog *dia = new PathFinderDialog(currDoc->scMW(), currDoc, Item1, Item2);
if (dia->exec())
{
int opMode=dia->opMode;
if (dia->keepItem1)
{
PageItem *newItem;
if (dia->swapped)
{
newItem = new PageItem_Polygon(*Item2);
newItem->setSelected(false);
currDoc->Items->insert(currDoc->Items->indexOf(Item2), newItem);
}
else
{
newItem = new PageItem_Polygon(*Item1);
newItem->setSelected(false);
currDoc->Items->insert(currDoc->Items->indexOf(Item1), newItem);
}
if (UndoManager::undoEnabled())
{
ScItemState<PageItem*> *is = new ScItemState<PageItem*>("Create PageItem");
is->set("CREATE_ITEM", "create_item");
is->setItem(newItem);
UndoObject *target = currDoc->Pages->at(Item1->OwnPage);
undoManager->action(target, is);
}
}
if (dia->keepItem2)
{
PageItem *newItem;
if (dia->swapped)
{
newItem = new PageItem_Polygon(*Item1);
newItem->setSelected(false);
currDoc->Items->insert(currDoc->Items->indexOf(Item1), newItem);
}
else
{
newItem = new PageItem_Polygon(*Item2);
newItem->setSelected(false);
currDoc->Items->insert(currDoc->Items->indexOf(Item2), newItem);
}
if (UndoManager::undoEnabled())
{
ScItemState<PageItem*> *is = new ScItemState<PageItem*>("Create PageItem");
is->set("CREATE_ITEM", "create_item");
is->setItem(newItem);
UndoObject *target = currDoc->Pages->at(Item1->OwnPage);
undoManager->action(target, is);
}
}
if (opMode != 4)
{
PageItem *currItem;
QPainterPath path;
FPointArray points;
if (dia->targetColor == 0)
{
currItem = Item1;
if (dia->swapped)
{
currItem = Item2;
currItem->setXYPos(Item1->xPos(), Item1->yPos());
currItem->setRotation(0.0);
}
}
else
{
if (dia->swapped)
currItem = Item1;
else
{
currItem = Item2;
currItem->setXYPos(Item1->xPos(), Item1->yPos());
currItem->setRotation(0.0);
}
}
path = dia->result;
points.fromQPainterPath(path);
//<<#9046
FPointArray oldPOLine=currItem->PoLine;
//.........这里部分代码省略.........