#include <juce_Direct2DImage_windows.h>
Public Types | |
| using | BackupExtensions = ImagePixelDataBackupExtensions |
| using | NativeExtensions = ImagePixelDataNativeExtensions |
| using | Page = Direct2DPixelDataPage |
| using | Pages = Direct2DPixelDataPages |
| using | Ptr = ReferenceCountedObjectPtr< Direct2DPixelData > |
Public Member Functions | |
| Direct2DPixelData (ComSmartPtr< ID2D1Device1 >, ComSmartPtr< ID2D1Bitmap1 >) | |
| Direct2DPixelData (Image::PixelFormat, int, int, bool) | |
| ~Direct2DPixelData () override | |
| void | applyGaussianBlurEffect (float radius) |
| void | applyGaussianBlurEffectInArea (Rectangle< int >, float) override |
| Applies a native blur effect to this image, if available. | |
| void | applySingleChannelBoxBlurEffect (int radius) |
| void | applySingleChannelBoxBlurEffectInArea (Rectangle< int >, int) override |
| Applies a native blur effect to this image, if available. | |
| ImagePixelData::Ptr | clone () override |
| Creates a copy of this image. | |
| std::unique_ptr< LowLevelGraphicsContext > | createLowLevelContext () override |
| Creates a context that will draw into this image. | |
| std::unique_ptr< ImageType > | createType () const override |
| Creates an instance of the type of this image. | |
| void | decReferenceCount () noexcept |
| Decreases the object's reference count. | |
| bool | decReferenceCountWithoutDeleting () noexcept |
| Decreases the object's reference count. | |
| void | desaturate () |
| void | desaturateInArea (Rectangle< int >) override |
| Changes all the colours to be shades of grey, based on their current luminosity. | |
| const BackupExtensions * | getBackupExtensions () const override |
| BackupExtensions * | getBackupExtensions () override |
| Returns a raw pointer to an instance of ImagePixelDataBackupExtensions if this ImagePixelData provides this extension, or nullptr otherwise. | |
| ComSmartPtr< ID2D1Bitmap1 > | getFirstPageForDevice (ComSmartPtr< ID2D1Device1 > device) |
| ImagePixelDataNativeExtensions | getNativeExtensions () override |
| Span< const Page > | getPagesForDevice (ComSmartPtr< ID2D1Device1 >) |
| int | getReferenceCount () const noexcept |
| Returns the object's current reference count. | |
| virtual int | getSharedCount () const noexcept |
| Returns the number of Image objects which are currently referring to the same internal shared image data. | |
| void | incReferenceCount () noexcept |
| Increments the object's reference count. | |
| void | initialiseBitmapData (Image::BitmapData &, int, int, Image::BitmapData::ReadWriteMode) override |
| Initialises a BitmapData object. | |
| void | moveImageSection (Point< int > destTopLeft, Rectangle< int > sourceRect) |
| Copies a section of the image to somewhere else within itself. | |
| void | multiplyAllAlphas (float amount) |
| void | multiplyAllAlphasInArea (Rectangle< int >, float) override |
| Multiples all alpha-channel values in the image by the specified amount. | |
| void | sendDataChangeMessage () |
Public Attributes | |
| const int | height |
| ListenerList< Listener > | listeners |
| const Image::PixelFormat | pixelFormat |
| The pixel format of the image data. | |
| NamedValueSet | userData |
| User-defined settings that are attached to this image. | |
| const int | width |
Protected Member Functions | |
| void | resetReferenceCount () noexcept |
| Resets the reference count to zero without deleting the object. | |
Private Types | |
| enum class | State { initiallyUndefined , initiallyCleared , drawing , drawn , outdated } |
Private Member Functions | |
| Direct2DPixelData (ImagePixelData::Ptr, State) | |
| void | adapterCreated (DxgiAdapter::Ptr) override |
| void | adapterRemoved (DxgiAdapter::Ptr adapter) override |
| template<typename Fn > | |
| bool | applyEffectInArea (Rectangle< int >, Fn &&) |
| bool | backupNow () override |
| This function will attempt to make the image resilient to graphics device disconnection by copying from graphics memory to main memory. | |
| bool | canBackup () const override |
| Returns if there is an up-to-date copy of this image in graphics memory, or false otherwise. | |
| std::unique_ptr< Context > | createNativeContext () |
| bool | createPersistentBackup (ComSmartPtr< ID2D1Device1 > deviceHint) |
| auto | getIteratorForDevice (ComSmartPtr< ID2D1Device1 >) |
| ComSmartPtr< ID2D1Device1 > | getMostRelevantDevice () |
| Direct2DPixelDataPages & | getPagesStructForDevice (ComSmartPtr< ID2D1Device1 >) |
| bool | isBackupEnabled () const override |
| void | moveValidatedImageSection (Point< int > destTopLeft, Rectangle< int > sourceRect) override |
| bool | needsBackup () const override |
| Returns true if the main-memory copy of the image is out-of-date, false if it's up-to-date. | |
| void | setBackupEnabled (bool) override |
| The automatic image backup mechanism can be disabled by passing false to this function, or enabled by passing true. | |
Static Private Member Functions | |
| static void | copyPages (ComSmartPtr< ID2D1Device1 >, Direct2DPixelData &, Direct2DPixelData &, Point< int >, Rectangle< int >) |
Private Attributes | |
| ImagePixelData::Ptr | backingData |
| SharedResourcePointer< DirectX > | directX |
| ComSmartPtr< ID2D1Device1 > | mostRecentDevice |
| std::map< ComSmartPtr< ID2D1Device1 >, Pages > | pagesForDevice |
| Atomic< int > | refCount { 0 } |
| State | state |
| bool | sync = true |
|
inherited |
|
inherited |
|
strongprivate |
| juce::Direct2DPixelData::Direct2DPixelData | ( | ComSmartPtr< ID2D1Device1 > | , |
| ComSmartPtr< ID2D1Bitmap1 > | |||
| ) |
| juce::Direct2DPixelData::Direct2DPixelData | ( | Image::PixelFormat | , |
| int | , | ||
| int | , | ||
| bool | |||
| ) |
|
override |
|
private |
|
inlineoverrideprivatevirtual |
Implements juce::DxgiAdapterListener.
|
inlineoverrideprivatevirtual |
Implements juce::DxgiAdapterListener.
References mostRecentDevice, and pagesForDevice.
|
private |
|
inlineinherited |
|
overridevirtual |
Applies a native blur effect to this image, if available.
This blur applies to all channels of the input image. It may be more expensive to calculate than a box blur, but should produce higher-quality results.
The default implementation will modify the image pixel-by-pixel on the CPU, which will be slow. Native image types may provide optimised implementations.
Reimplemented from juce::ImagePixelData.
|
inlineinherited |
|
overridevirtual |
Applies a native blur effect to this image, if available.
This is intended for blurring single-channel images, which is useful when rendering drop shadows. This is implemented as several box-blurs in series. The results should be visually similar to a Gaussian blur, but less accurate.
The default implementation will modify the image pixel-by-pixel on the CPU, which will be slow. Native image types may provide optimised implementations.
Reimplemented from juce::ImagePixelData.
|
overrideprivatevirtual |
This function will attempt to make the image resilient to graphics device disconnection by copying from graphics memory to main memory.
By default, backups happen automatically, so there's no need to call this function unless auto-backup has been disabled on this image.
Flushing may fail if the graphics device goes away before its memory can be read. If needsBackup() returns false, then backupNow() will always return true without doing any work.
Implements juce::ImagePixelDataBackupExtensions.
|
overrideprivatevirtual |
Returns if there is an up-to-date copy of this image in graphics memory, or false otherwise.
Implements juce::ImagePixelDataBackupExtensions.
|
overridevirtual |
Creates a copy of this image.
Implements juce::ImagePixelData.
|
staticprivate |
|
overridevirtual |
Creates a context that will draw into this image.
Implements juce::ImagePixelData.
|
private |
|
private |
|
inlineoverridevirtual |
Creates an instance of the type of this image.
Implements juce::ImagePixelData.
|
inlinenoexceptinherited |
Decreases the object's reference count.
If the count gets to zero, the object will be deleted.
References jassert.
|
inlinenoexceptinherited |
Decreases the object's reference count.
If the count gets to zero, the object will not be deleted, but this method will return true, allowing the caller to take care of deletion.
References jassert.
|
inlineinherited |
|
overridevirtual |
Changes all the colours to be shades of grey, based on their current luminosity.
The default implementation will modify the image pixel-by-pixel on the CPU, which will be slow. Native image types may provide optimised implementations.
Reimplemented from juce::ImagePixelData.
|
inlineoverridevirtual |
Reimplemented from juce::ImagePixelData.
|
inlineoverridevirtual |
Returns a raw pointer to an instance of ImagePixelDataBackupExtensions if this ImagePixelData provides this extension, or nullptr otherwise.
Reimplemented from juce::ImagePixelData.
|
inline |
References getPagesForDevice().
|
private |
|
private |
|
overridevirtual |
intentionally not callable from user code
Reimplemented from juce::ImagePixelData.
| Span< const Page > juce::Direct2DPixelData::getPagesForDevice | ( | ComSmartPtr< ID2D1Device1 > | ) |
Referenced by getFirstPageForDevice().
|
private |
|
inlinenoexceptinherited |
Returns the object's current reference count.
|
virtualnoexceptinherited |
Returns the number of Image objects which are currently referring to the same internal shared image data.
This is different to the reference count as an instance of ImagePixelData can internally depend on another ImagePixelData via it's member variables.
|
inlinenoexceptinherited |
Increments the object's reference count.
This is done automatically by the smart pointer, but is public just in case it's needed for nefarious purposes.
|
overridevirtual |
Initialises a BitmapData object.
Implements juce::ImagePixelData.
|
overrideprivatevirtual |
Implements juce::ImagePixelDataBackupExtensions.
|
inherited |
Copies a section of the image to somewhere else within itself.
|
overrideprivatevirtual |
Reimplemented from juce::ImagePixelData.
|
inlineinherited |
|
overridevirtual |
Multiples all alpha-channel values in the image by the specified amount.
The default implementation will modify the image pixel-by-pixel on the CPU, which will be slow. Native image types may provide optimised implementations.
Reimplemented from juce::ImagePixelData.
|
overrideprivatevirtual |
Returns true if the main-memory copy of the image is out-of-date, false if it's up-to-date.
Implements juce::ImagePixelDataBackupExtensions.
|
inlineprotectednoexceptinherited |
Resets the reference count to zero without deleting the object.
You should probably never need to use this!
|
inherited |
|
overrideprivatevirtual |
The automatic image backup mechanism can be disabled by passing false to this function, or enabled by passing true.
If you disable automatic backup for a particular image, make sure you test that your software behaves as expected when graphics devices are disconnected. One easy way to test this on Windows is to use your program over a remote desktop session, and to end and re-start the session while the image is being displayed.
The most common scenario where this flag is useful is when drawing single-use images. e.g. for a drop shadow or other effect, the following series of steps might be carried out on each paint call:
In this case, where the image is created, modified, used, and destroyed in quick succession, there's no need to keep a resilient backup of the image around, so it's reasonable to call setBackupEnabled(false) after constructing the image.
Implements juce::ImagePixelDataBackupExtensions.
|
private |
|
private |
|
inherited |
|
inherited |
|
private |
Referenced by adapterRemoved().
|
private |
Referenced by adapterRemoved().
|
inherited |
The pixel format of the image data.
|
privateinherited |
|
private |
|
private |
|
inherited |
User-defined settings that are attached to this image.
|
inherited |