mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-28 02:30:05 +00:00
Previously, drawing a mirrored image would produce incorrect results.
Scaling transforms were applied correctly, but mirroring was not. The
following code is an example of a drawing routine that previously
produced incorrect results.
g.fillAll (juce::Colours::grey);
juce::Image image { juce::Image::PixelFormat::ARGB, 512, 512, false };
{
juce::Graphics h { image };
h.setGradientFill (juce::ColourGradient { juce::Colours::cyan,
{},
juce::Colours::magenta,
{ 512, 512 },
false });
h.fillAll();
}
const auto cy = getHeight() / 2;
g.drawImageWithin (image,
0,
0,
getWidth(),
cy,
juce::RectanglePlacement::stretchToFit);
const auto transform = juce::AffineTransform::verticalFlip ((float) cy)
.translated (0, (float) cy);
g.addTransform (transform);
g.drawImageWithin (image,
0,
0,
getWidth(),
cy,
juce::RectanglePlacement::stretchToFit);
|
||
|---|---|---|
| .. | ||
| colour | ||
| contexts | ||
| detail | ||
| effects | ||
| fonts | ||
| geometry | ||
| image_formats | ||
| images | ||
| native | ||
| placement | ||
| unicode | ||
| juce_graphics.cpp | ||
| juce_graphics.h | ||
| juce_graphics.mm | ||
| juce_graphics_Harfbuzz.cpp | ||
| juce_graphics_Sheenbidi.c | ||