예제 #1
0
파일: ShapesWidget.C 프로젝트: 913862627/wt
void ShapesWidget::drawEmwebLogo(WPainter& painter)
{
  painter.save();
  painter.setPen(NoPen);

  /*
   * The emweb logo can be drawn as 3 e's, and one combined m/w
   */

  // Emweb
  painter.setBrush(black);
  drawEmwebE(painter);

  // emwEb
  painter.save();
  painter.translate(397, 0);
  drawEmwebE(painter);

  // emweB
  painter.translate(210, 0);
  painter.scale(-1, 1);
  drawEmwebE(painter);

  painter.restore();

  // eMWeb
  painter.setBrush(emweb);
  drawEmwebMW(painter);

  painter.restore();
}
예제 #2
0
파일: ShapesWidget.C 프로젝트: 913862627/wt
void ShapesWidget::drawEmwebE(WPainter& painter)
{
  WPainterPath p;

  /* Path copied from our SVG for half of the E */

  p.moveTo(46.835084,58.783624);
  p.cubicTo(45.700172,58.783624,35.350098,58.911502,24.656354,63.283309);
  p.cubicTo(8.7595992,69.78907,0,82.38499,0,98.809238);
  p.cubicTo(0,115.20152,08.7595992,127.82141,24.656354,134.31119);
  p.cubicTo(35.350098,138.69099,45.700172,138.81088,46.835084,138.81088);
  p.lineTo(94.509362,138.81088);
  p.lineTo(94.509362,117.58323);
  p.lineTo(46.835084,117.58323);
  p.cubicTo(46.811106,117.58323,39.466151,117.47134,32.608727,114.53815);
  p.cubicTo(25.095932,111.34122,21.747144,106.47389,21.747144,98.809238);
  p.cubicTo(21.747144,91.120612,25.095932,86.269265,32.608727,83.064338);
  p.cubicTo(39.466151,80.123159,46.811106,80.027251,46.89103,80.027251);
  p.lineTo(94.509362,80.027251);
  p.lineTo(94.509362,58.783624);
  p.lineTo(46.835084,58.783624);

  painter.drawPath(p);

  painter.save();
  painter.translate(0,-58.783624);
  painter.drawPath(p);
  painter.restore();
}
예제 #3
0
void WCartesianChart::renderLegendItem(WPainter& painter,
				       const WPointF& pos,
				       const WDataSeries& series) const
{
  WPen fontPen = painter.pen();

  renderLegendIcon(painter, pos, series);

  painter.setPen(fontPen);
  painter.drawText(pos.x() + 17, pos.y() - 10, 100, 20,
		   AlignLeft | AlignMiddle,
		   asString(model()->headerData(series.modelColumn())));
}
예제 #4
0
void WCartesianChart::paint(WPainter& painter, const WRectF& rectangle) const
{
  if (!painter.isActive())
    throw WException("WCartesianChart::paint(): painter is not active.");

  WRectF rect = rectangle;

  if (rect.isEmpty())
    rect = painter.window();

  WChart2DRenderer *renderer = createRenderer(painter, rect);
  renderer->render();
  delete renderer;
}
예제 #5
0
void PaintBrush::drawActions(WPainter& painter)
{
    for(std::vector< WPainterPath >::iterator it = actions_.begin(); it != actions_.end(); ++it)
    {
        WPainterPath p = *it;
        painter.drawPath(p);
    }

}
예제 #6
0
파일: WSlider.C 프로젝트: kdeforche/wt
void WSlider::paintTick(WPainter& painter, int value, int x, int y)
{
  if (!tickPosition_.empty()) {
    int h = 0;

    if (orientation_ == Orientation::Horizontal)
      h = (int)painter.device()->height().toPixels();
    else
      h = (int)painter.device()->width().toPixels();

    WPen pen;
    pen.setColor(WColor(0xd7, 0xd7, 0xd7));
    pen.setCapStyle(PenCapStyle::Flat);
    pen.setWidth(1);
    painter.setPen(pen);

    int y1 = h / 4;
    int y2 = h / 2 - 4;
    int y3 = h / 2 + 4;
    int y4 = h - h/4;

    switch (orientation_) {
    case Orientation::Horizontal:
      if (tickPosition_.test(WSlider::TickPosition::TicksAbove))
	painter.drawLine(x + 0.5, y1, x + 0.5, y2);
      if (tickPosition_.test(WSlider::TickPosition::TicksBelow))
	painter.drawLine(x + 0.5, y3, x + 0.5, y4);

      break;
    case Orientation::Vertical:
      if (tickPosition_.test(WSlider::TickPosition::TicksAbove))
	painter.drawLine(y1, y + 0.5, y2, y + 0.5);
      if (tickPosition_.test(WSlider::TickPosition::TicksBelow))
	painter.drawLine(y3, y + 0.5, y4, y + 0.5);
    }
  }
}
예제 #7
0
파일: ShapesWidget.C 프로젝트: 913862627/wt
void ShapesWidget::drawEmwebMW(WPainter& painter)
{
  WPainterPath p;

  /* Path copied from our SVG for one fourth of the MW */

  p.moveTo(120.59634,24.072913);
  p.cubicTo(116.12064,34.518895,115.98477,44.605222,115.98477,45.732141);
  p.lineTo(115.98477,138.81088);
  p.lineTo(137.7399,138.81088);
  p.lineTo(137.7399,45.732141);
  p.cubicTo(137.7399,45.708164,137.83581,38.53904,140.84892,31.841463);
  p.cubicTo(144.14176,24.512492,149.113,21.235634,156.98545,21.235634);
  p.cubicTo(164.8499,21.235634,169.81314,24.512492,173.10599,31.841463);
  p.cubicTo(176.10311,38.53904,176.215,45.708164,176.215,45.780095);
  p.lineTo(176.215,70.41343);
  p.lineTo(197.97014,70.41343);
  p.lineTo(197.97014,45.732141);
  p.cubicTo(197.97014,44.605222,197.83427,34.518895,193.35057,24.072913);
  p.cubicTo(186.70894,8.5517985,173.77734,0,156.99344,0);
  p.cubicTo(140.17756,0,127.25396,8.5517985,120.59634,24.072913);

  /*
   * Paint it four times, translated and inverted
   */

  painter.drawPath(p);

  const double dx = 176. - 115.98477;

  painter.save();

  painter.translate(dx, 0);
  painter.drawPath(p);

  painter.translate(dx, 0);

  painter.scale(-1, -1);
  painter.translate(0, -138.81088);
  painter.translate(-115.98477 - 197.95 - dx, 0);
  painter.drawPath(p);

  painter.translate(dx, 0);
  painter.drawPath(p);

  painter.restore();
}
예제 #8
0
void WCartesianChart::renderLegendIcon(WPainter& painter,
				       const WPointF& pos,
				       const WDataSeries& series) const
{
  switch (series.type()) {
  case BarSeries: {
    WPainterPath path;
    path.moveTo(-6, 8);
    path.lineTo(-6, -8);
    path.lineTo(6, -8);
    path.lineTo(6, 8);
    painter.setPen(series.pen());
    painter.setBrush(series.brush());
    painter.translate(pos.x() + 7.5, pos.y());  
    painter.drawPath(path);
    painter.translate(-(pos.x() + 7.5), -pos.y());
    break;
  }
  case LineSeries:
  case CurveSeries: {
    painter.setPen(series.pen());
    double offset = (series.pen().width() == 0 ? 0.5 : 0);
    painter.drawLine(pos.x(), pos.y() + offset, pos.x() + 16, pos.y() + offset);
  }
    // no break;
  case PointSeries: {
    WPainterPath path;
    drawMarker(series, path);
    if (!path.isEmpty()) {
      painter.translate(pos.x() + 8, pos.y());  
      painter.setPen(series.markerPen());
      painter.setBrush(series.markerBrush());
      painter.drawPath(path);
      painter.translate(- (pos.x() + 8), -pos.y());
    }

    break;
  }
  }
}