示例#1
0
// drawing glyphs (same path, many places)    
void ScenePainter::drawGlyphs(const QPainterPath &path, double *x, double *y,
                              double *size, QColor *stroke, QColor *fill, int n)
{
  if (indexMode()) {
    drawPoints(x, y, n);
  } else if (!rasterize()) { 
    QTransform tform = transform();
    double curSize = glyphSize();
    for (int i = 0; i < n; i++) {
      if (stroke) setStrokeColor(stroke[i]);
      if (fill) setFillColor(fill[i]);
      QGraphicsItem *item = STORE_INDEX(_scene->addPath(path, pen(), brush()));
      item->setPos(tform.map(QPointF(x[i], y[i])));
      item->setFlag(QGraphicsItem::ItemIgnoresTransformations);
      if (size) curSize = size[i];
      item->scale(curSize, curSize);
    }
  } else QtBasePainter::drawGlyphs(path, x, y, size, stroke, fill, n);
}