1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-28 02:30:05 +00:00
JUCE/modules/juce_graphics
reuk 0a1929944b
Direct2D: Draw images correctly when transformed with a vertical or horizontal flip
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);
2026-01-21 18:26:09 +00:00
..
colour tie: Hide tie implementations from public API 2025-12-22 09:54:33 +00:00
contexts Graphics: Hide rendering helpers from public API 2025-12-22 09:54:33 +00:00
detail tie: Hide tie implementations from public API 2025-12-22 09:54:33 +00:00
effects Effects: Use preferred temporary image type for DropShadow temporary image 2025-04-24 13:58:23 +01:00
fonts tie: Hide tie implementations from public API 2025-12-22 09:54:33 +00:00
geometry Formatting: Remove double-dots from comments and other strings 2025-11-18 15:47:42 +00:00
image_formats Formatting: Remove double-dots from comments and other strings 2025-11-18 15:47:42 +00:00
images Formatting: Remove double-dots from comments and other strings 2025-11-18 15:47:42 +00:00
native Direct2D: Draw images correctly when transformed with a vertical or horizontal flip 2026-01-21 18:26:09 +00:00
placement Update licensing information 2024-04-16 11:39:35 +01:00
unicode SheenBidi: Update internal include paths 2025-10-20 17:34:47 +01:00
juce_graphics.cpp Graphics: Hide rendering helpers from public API 2025-12-22 09:54:33 +00:00
juce_graphics.h Graphics: Hide rendering helpers from public API 2025-12-22 09:54:33 +00:00
juce_graphics.mm Update licensing information 2024-04-16 11:39:35 +01:00
juce_graphics_Harfbuzz.cpp HarfBuzz: Silence nontrivial-memcall warnings 2025-03-19 11:06:17 +00:00
juce_graphics_Sheenbidi.c SheenBidi: Update internal include paths 2025-10-20 17:34:47 +01:00