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.

97 lines
3.4KB

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