예제 #1
0
AffineTransform BrickWallChart::calcTransform ()
{
  const Rectangle<int> bounds = getLocalBounds ();
  const Rectangle<int> r = bounds.reduced (4, 4);

  AffineTransform t;

  // scale x from 0..1 to 0..getWidth(), and flip vertical
  t = AffineTransform::scale (float(r.getWidth()), -1.f);

  // scale y from gain to 0..1 bounds in r
  t = t.scaled (1.f, m_scale_y);

  // scale y from 0..1 to getHeight()
  t = t.scaled (1.f, float(r.getHeight()));

  // translate
  t = t.translated (float(r.getX()), float(r.getBottom()));

  return t;
}
예제 #2
0
AffineTransform PhaseChart::calcTransform ()
{
  const Rectangle<int> bounds = getLocalBounds ();
  const Rectangle<int> r = bounds.reduced (4, 4);

  AffineTransform t;

  // scale x from 0..1 to 0..getWidth(), and flip vertical
  t = AffineTransform::scale (float(r.getWidth()), -1.f);

  // move y down so 120 is at the top
  t = t.translated (0.f, 120.f);

  // scale y from phase to 0..1 bounds in r
  t = t.scaled (1.f, 1.f/(maxPhase - -maxPhase));

  // scale y from 0..1 to getHeight()
  t = t.scaled (1.f, float(r.getHeight()));

  // translate
  t = t.translated (float(r.getX()), float(r.getY()));

  return t;
}
예제 #3
0
    AffineTransform getTransform()
    {
        const float hw = 0.5f * getWidth();
        const float hh = 0.5f * getHeight();

        AffineTransform t;

        if (controls.animateRotation.getToggleState())
            t = t.rotated (rotation.getValue() * float_Pi * 2.0f);

        if (controls.animateSize.getToggleState())
            t = t.scaled (0.3f + size.getValue() * 2.0f);

        if (controls.animatePosition.getToggleState())
            t = t.translated (hw + hw * (offsetX.getValue() - 0.5f),
                              hh + hh * (offsetY.getValue() - 0.5f));
        else
            t = t.translated (hw, hh);

        if (controls.animateShear.getToggleState())
            t = t.sheared (shear.getValue() * 2.0f - 1.0f, 0.0f);

        return t;
    }
예제 #4
0
void PoleZeroChart::paintContents (Graphics& g)
{
  Colour cPole (0xd0ff0000);
  Colour cZero (0xd02020ff);
	
  Rectangle<int> bounds = getLocalBounds();

  short size = short ((jmin (getWidth(), getHeight()) + 2) / 3);

  // scale the graph down if the pole/zeroes lie outside the unit disc
  AffineTransform t = AffineTransform::identity;

  {
    float margin = 0.2f;
    if (m_max > 1 + margin)
    {
      t = t.scaled (float(1/(m_max-margin)), float(1/(m_max-margin)));
    }
  }

  t = t.scaled (float(size), -float(size));
  t = t.translated (float(bounds.getCentreX()), float(bounds.getCentreY()));

	g.setColour (m_cAxis);
  {
    Point<float> p = Point<float>(100000, 0).transformedBy (t);
    g.drawLine (-p.getX(), p.getY(), p.getX(), p.getY(), 1);
  }
  {
    Point<float> p = Point<float>(0, 100000).transformedBy (t);
    g.drawLine (p.getX(), -p.getY(), p.getX(), p.getY(), 1);
  }
  {
    Point<float> p0 = Point<float>(-1, -1).transformedBy (t);
    Point<float> p1 = Point<float>( 1,  1).transformedBy (t);
    g.drawEllipse (p0.getX(), p0.getY(),
                   p1.getX()-p0.getX(), p1.getY()-p0.getY(), 1);
  }

  const float r = 3.5f;

  for (size_t i = 0; i < m_vpz.size(); ++i)
  {
    const Dsp::PoleZeroPair& pzp = m_vpz[i];

    if (!pzp.is_nan())
    {
      {
        Point<float> p (float(pzp.poles.first.real()),
                        float(pzp.poles.first.imag()));
        p = p.transformedBy (t);
        g.setColour (cPole);
        g.drawLine (p.getX()-r, p.getY()-r, p.getX()+r, p.getY()+r);
        g.drawLine (p.getX()+r, p.getY()-r, p.getX()-r, p.getY()+r);
      }

      {
        Point<float> p (float(pzp.zeros.first.real()),
                        float(pzp.zeros.first.imag()));
        p = p.transformedBy (t);
        g.setColour (cZero);
    	  g.drawEllipse (p.getX()-r, p.getY()-r, 2*r, 2*r, 1);
      }

      if (!pzp.isSinglePole())
      {
        {
          Point<float> p (float(pzp.poles.second.real()),
                          float(pzp.poles.second.imag()));
          p = p.transformedBy (t);
          g.setColour (cPole);
          g.drawLine (p.getX()-r, p.getY()-r, p.getX()+r, p.getY()+r);
          g.drawLine (p.getX()+r, p.getY()-r, p.getX()-r, p.getY()+r);
        }

        {
          Point<float> p (float(pzp.zeros.second.real()),
                          float(pzp.zeros.second.imag()));
          p = p.transformedBy (t);
          g.setColour (cZero);
    	    g.drawEllipse (p.getX()-r, p.getY()-r, 2*r, 2*r, 1);
        }
      }
    }
  }
}