本文整理汇总了C++中AffineTransform::scaled方法的典型用法代码示例。如果您正苦于以下问题:C++ AffineTransform::scaled方法的具体用法?C++ AffineTransform::scaled怎么用?C++ AffineTransform::scaled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AffineTransform
的用法示例。
在下文中一共展示了AffineTransform::scaled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcTransform
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: calcTransform
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: getTransform
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: paintContents
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);
}
}
}
}
}