mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Direct2D: Set transform for tiled image brush
This commit is contained in:
parent
9ae52f3d7a
commit
0789048777
1 changed files with 35 additions and 24 deletions
|
|
@ -347,32 +347,32 @@ public:
|
|||
Point<float> translation{};
|
||||
AffineTransform transform{};
|
||||
|
||||
if ((flags & BrushTransformFlags::applyWorldTransform) != 0)
|
||||
{
|
||||
if (currentTransform.isOnlyTranslated)
|
||||
translation = currentTransform.offset.toFloat();
|
||||
else
|
||||
transform = currentTransform.getTransform();
|
||||
}
|
||||
|
||||
if ((flags & BrushTransformFlags::applyFillTypeTransform) != 0)
|
||||
{
|
||||
if (fillType.transform.isOnlyTranslation())
|
||||
translation += Point<float> (fillType.transform.getTranslationX(), fillType.transform.getTranslationY());
|
||||
else
|
||||
transform = transform.followedBy (fillType.transform);
|
||||
}
|
||||
|
||||
if ((flags & BrushTransformFlags::applyInverseWorldTransform) != 0)
|
||||
{
|
||||
if (currentTransform.isOnlyTranslated)
|
||||
translation -= currentTransform.offset.toFloat();
|
||||
else
|
||||
transform = transform.followedBy (currentTransform.getTransform().inverted());
|
||||
}
|
||||
|
||||
if (fillType.isGradient())
|
||||
{
|
||||
if ((flags & BrushTransformFlags::applyWorldTransform) != 0)
|
||||
{
|
||||
if (currentTransform.isOnlyTranslated)
|
||||
translation = currentTransform.offset.toFloat();
|
||||
else
|
||||
transform = currentTransform.getTransform();
|
||||
}
|
||||
|
||||
if ((flags & BrushTransformFlags::applyFillTypeTransform) != 0)
|
||||
{
|
||||
if (fillType.transform.isOnlyTranslation())
|
||||
translation += Point (fillType.transform.getTranslationX(), fillType.transform.getTranslationY());
|
||||
else
|
||||
transform = transform.followedBy (fillType.transform);
|
||||
}
|
||||
|
||||
if ((flags & BrushTransformFlags::applyInverseWorldTransform) != 0)
|
||||
{
|
||||
if (currentTransform.isOnlyTranslated)
|
||||
translation -= currentTransform.offset.toFloat();
|
||||
else
|
||||
transform = transform.followedBy (currentTransform.getTransform().inverted());
|
||||
}
|
||||
|
||||
const auto p1 = fillType.gradient->point1 + translation;
|
||||
const auto p2 = fillType.gradient->point2 + translation;
|
||||
|
||||
|
|
@ -389,6 +389,17 @@ public:
|
|||
linearGradient->SetEndPoint ({ p2.x, p2.y });
|
||||
}
|
||||
}
|
||||
else if (fillType.isTiledImage())
|
||||
{
|
||||
if ((flags & BrushTransformFlags::applyWorldTransform) != 0)
|
||||
transform = currentTransform.getTransform();
|
||||
|
||||
if ((flags & BrushTransformFlags::applyFillTypeTransform) != 0)
|
||||
transform = transform.followedBy (fillType.transform);
|
||||
|
||||
if ((flags & BrushTransformFlags::applyInverseWorldTransform) != 0)
|
||||
transform = transform.followedBy (currentTransform.getTransform().inverted());
|
||||
}
|
||||
|
||||
currentBrush->SetTransform (D2DUtilities::transformToMatrix (transform));
|
||||
currentBrush->SetOpacity (fillType.getOpacity());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue