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.

juce_win32_Direct2DGraphicsContext.h 3.8KB

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