Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. #ifndef _WINDEF_
  21. class HWND__; // Forward or never
  22. typedef HWND__* HWND;
  23. #endif
  24. class Direct2DLowLevelGraphicsContext : public LowLevelGraphicsContext
  25. {
  26. public:
  27. Direct2DLowLevelGraphicsContext (HWND);
  28. ~Direct2DLowLevelGraphicsContext();
  29. //==============================================================================
  30. bool isVectorDevice() const override { return false; }
  31. void setOrigin (Point<int>) override;
  32. void addTransform (const AffineTransform&) override;
  33. float getPhysicalPixelScaleFactor() override;
  34. bool clipToRectangle (const Rectangle<int>&) override;
  35. bool clipToRectangleList (const RectangleList<int>&) override;
  36. void excludeClipRectangle (const Rectangle<int>&) override;
  37. void clipToPath (const Path&, const AffineTransform&) override;
  38. void clipToImageAlpha (const Image&, const AffineTransform&) override;
  39. bool clipRegionIntersects (const Rectangle<int>&) override;
  40. Rectangle<int> getClipBounds() const override;
  41. bool isClipEmpty() const override;
  42. //==============================================================================
  43. void saveState() override;
  44. void restoreState() override;
  45. void beginTransparencyLayer (float opacity) override;
  46. void endTransparencyLayer() override;
  47. //==============================================================================
  48. void setFill (const FillType&) override;
  49. void setOpacity (float) override;
  50. void setInterpolationQuality (Graphics::ResamplingQuality) override;
  51. //==============================================================================
  52. void fillRect (const Rectangle<int>&, bool replaceExistingContents) override;
  53. void fillRect (const Rectangle<float>&) override;
  54. void fillRectList (const RectangleList<float>&) override;
  55. void fillPath (const Path&, const AffineTransform&) override;
  56. void drawImage (const Image& sourceImage, const AffineTransform&) override;
  57. //==============================================================================
  58. void drawLine (const Line<float>&) override;
  59. void setFont (const Font&) override;
  60. const Font& getFont() override;
  61. void drawGlyph (int glyphNumber, const AffineTransform&) override;
  62. bool drawTextLayout (const AttributedString&, const Rectangle<float>&) override;
  63. void resized();
  64. void clear();
  65. void start();
  66. void end();
  67. //==============================================================================
  68. private:
  69. struct SavedState;
  70. HWND hwnd;
  71. SavedState* currentState;
  72. OwnedArray<SavedState> states;
  73. Rectangle<int> bounds;
  74. struct Pimpl;
  75. std::unique_ptr<Pimpl> pimpl;
  76. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Direct2DLowLevelGraphicsContext)
  77. };
  78. } // namespace juce