コード例 #1
0
void ToolbarButton::updateDrawable()
{
    if (currentImage != nullptr)
    {
        currentImage->setTransformToFit (getContentArea().toFloat(), RectanglePlacement::centred);
        currentImage->setAlpha (isEnabled() ? 1.0f : 0.5f);
    }
}
コード例 #2
0
void DrawableComposite::recalculateCoordinates (Expression::Scope* scope)
{
    Point<float> resolved[3];
    bounds.resolveThreePoints (resolved, scope);

    const Rectangle<float> content (getContentArea().resolve (scope));

    AffineTransform t (AffineTransform::fromTargetPoints (content.getX(),     content.getY(),      resolved[0].x, resolved[0].y,
                       content.getRight(), content.getY(),      resolved[1].x, resolved[1].y,
                       content.getX(),     content.getBottom(), resolved[2].x, resolved[2].y));

    if (t.isSingularity())
        t = AffineTransform::identity;

    setTransform (t);
}