2 ==============================================================================
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
7 JUCE is an open source library subject to commercial or open-source
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
23 ==============================================================================
30 class HWND__
; // Forward or never
34 class Direct2DLowLevelGraphicsContext
: public LowLevelGraphicsContext
37 Direct2DLowLevelGraphicsContext (HWND
);
38 ~Direct2DLowLevelGraphicsContext();
40 //==============================================================================
41 bool isVectorDevice() const override
{ return false; }
43 void setOrigin (Point
<int>) override
;
44 void addTransform (const AffineTransform
&) override
;
45 float getPhysicalPixelScaleFactor() override
;
46 bool clipToRectangle (const Rectangle
<int>&) override
;
47 bool clipToRectangleList (const RectangleList
<int>&) override
;
48 void excludeClipRectangle (const Rectangle
<int>&) override
;
49 void clipToPath (const Path
&, const AffineTransform
&) override
;
50 void clipToImageAlpha (const Image
&, const AffineTransform
&) override
;
51 bool clipRegionIntersects (const Rectangle
<int>&) override
;
52 Rectangle
<int> getClipBounds() const override
;
53 bool isClipEmpty() const override
;
55 //==============================================================================
56 void saveState() override
;
57 void restoreState() override
;
58 void beginTransparencyLayer (float opacity
) override
;
59 void endTransparencyLayer() override
;
61 //==============================================================================
62 void setFill (const FillType
&) override
;
63 void setOpacity (float) override
;
64 void setInterpolationQuality (Graphics::ResamplingQuality
) override
;
66 //==============================================================================
67 void fillRect (const Rectangle
<int>&, bool replaceExistingContents
) override
;
68 void fillRect (const Rectangle
<float>&) override
;
69 void fillRectList (const RectangleList
<float>&) override
;
70 void fillPath (const Path
&, const AffineTransform
&) override
;
71 void drawImage (const Image
& sourceImage
, const AffineTransform
&) override
;
73 //==============================================================================
74 void drawLine (const Line
<float>&) override
;
75 void setFont (const Font
&) override
;
76 const Font
& getFont() override
;
77 void drawGlyph (int glyphNumber
, const AffineTransform
&) override
;
78 bool drawTextLayout (const AttributedString
&, const Rectangle
<float>&) override
;
86 //==============================================================================
92 SavedState
* currentState
;
93 OwnedArray
<SavedState
> states
;
95 Rectangle
<int> bounds
;
98 std::unique_ptr
<Pimpl
> pimpl
;
100 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Direct2DLowLevelGraphicsContext
)