Пример #1
0
void pMixLookAndFeel::drawLasso (Graphics& g, Component& lassoComp)
{
  g.fillAll (lassoComp.findColour (0x1000440 /*lassoFillColourId*/));
  g.setColour (lassoComp.findColour (0x1000441 /*lassoOutlineColourId*/));
  
  Rectangle<int> bounds = lassoComp.getLocalBounds();
  Path linePath;
  linePath.addRectangle(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
  
  PathStrokeType stroke (2.5f);
  float dashes[2] = { 4, 4 };
  stroke.createDashedStroke(linePath, linePath, dashes, 2);
  
  g.fillPath (linePath);
}
Пример #2
0
void ConnectorComponent::resized()
{
  float x1, y1, x2, y2;
  getPoints (x1, y1, x2, y2);
  
  lastInputX = x1;
  lastInputY = y1;
  lastOutputX = x2;
  lastOutputY = y2;
  
  x1 -= getX();
  y1 -= getY();
  x2 -= getX();
  y2 -= getY();
  
  linePath.clear();
  linePath.startNewSubPath (x1, y1);
  //linePath.lineTo(x2, y2);
  linePath.cubicTo (x1, y1 + (y2 - y1) * 0.33f,
                    x2, y1 + (y2 - y1) * 0.66f,
                    x2, y2);
  
  PathStrokeType wideStroke (8.0f);
  wideStroke.createStrokedPath (hitPath, linePath);
  
  PathStrokeType stroke (1.5f);
  //stroke.createStrokedPath (linePath, linePath);
  float dashes[2] = { 4, 4 };
  stroke.createDashedStroke(linePath, linePath, dashes, 2);
  
  const float arrowW = 3.0f;
  const float arrowL = 2.0f;
  
  Path arrow;
  arrow.addTriangle (-arrowL, arrowW,
                     -arrowL, -arrowW,
                     arrowL, 0.0f);
  
  arrow.applyTransform (AffineTransform::identity
                        .rotated (float_Pi * 0.5f - (float) atan2 (x2 - x1, y2 - y1))
                        .translated ((x1 + x2) * 0.5f,
                                     (y1 + y2) * 0.5f));
  
  linePath.addPath (arrow);
  linePath.setUsingNonZeroWinding (true);
}
Пример #3
0
void ComponentOverlay::paint (Graphics& g)
{

    Colour c = Colours::white;

    if (interest == "selected")
    {
        Path selectedRect;
        selectedRect.addRectangle (getLocalBounds().reduced (2));
        g.setColour (c);


        const float dashLengths[] = { 10.0f, 10.0f };
        PathStrokeType stroke (1.0, PathStrokeType::mitered);
        stroke.createDashedStroke (selectedRect, selectedRect, dashLengths, 2);
        g.strokePath (selectedRect, stroke);
    }

    g.setColour (c);
    g.drawRect (0, 0, getWidth(), getHeight(), 1);
}
void InterpolationSpacePreset::paint (Graphics& g)
{
  g.setColour(colour);
  g.setOpacity(opacity);
  g.fillEllipse (5.f, 5.f, getWidth()-10.f, getHeight()-10.f);
  
  g.setColour(colour);
  g.fillEllipse ((getWidth()/2.f) - 5.f, (getHeight()/2.f)  - 5.f, 10.f, 10.f);
  g.setColour(Colours::black);
  g.drawEllipse((getWidth()/2.f) - 5.f, (getHeight()/2.f)  - 5.f, 10.f, 10.f, 1.f);
  
  if (dynamic_cast<PMixInterpolationSpaceLayout*>(getParentComponent())->getLassoSelection().isSelected(this))
  {
    Path linePath;
    linePath.addEllipse (2, 2, getWidth()-4, getHeight()-4);
    PathStrokeType stroke (2.5f);
    float dashes[2] = { 4, 4 };
    stroke.createDashedStroke(linePath, linePath, dashes, 2);
    g.setColour(Colours::lightgrey);
    g.fillPath (linePath);
  }
}