Harlinn.Windows 0.1
|
Represents a single group of sprites with their associated drawing properties. More...
#include <HWGraphics.h>
Private Member Functions | |
void | AddSprites (UINT32 spriteCount, const D2D1_RECT_F *destinationRectangles, const D2D1_RECT_U *sourceRectangles=nullptr, const D2D1_COLOR_F *colors=nullptr, const D2D1_MATRIX_3X2_F *transforms=nullptr, UINT32 destinationRectanglesStride=sizeof(D2D1_RECT_F), UINT32 sourceRectanglesStride=sizeof(D2D1_RECT_U), UINT32 colorsStride=sizeof(D2D1_COLOR_F), UINT32 transformsStride=sizeof(D2D1_MATRIX_3X2_F)) const |
Adds the given sprites to the end of this sprite batch. | |
void | SetSprites (UINT32 startIndex, UINT32 spriteCount, const D2D1_RECT_F *destinationRectangles=nullptr, const D2D1_RECT_U *sourceRectangles=nullptr, const D2D1_COLOR_F *colors=nullptr, const D2D1_MATRIX_3X2_F *transforms=nullptr, UINT32 destinationRectanglesStride=sizeof(D2D1_RECT_F), UINT32 sourceRectanglesStride=sizeof(D2D1_RECT_U), UINT32 colorsStride=sizeof(D2D1_COLOR_F), UINT32 transformsStride=sizeof(D2D1_MATRIX_3X2_F)) const |
Updates the properties of the specified sprites in this sprite batch. Providing a null value for any property will leave that property unmodified for that sprite. | |
void | GetSprites (UINT32 startIndex, UINT32 spriteCount, D2D1_RECT_F *destinationRectangles=nullptr, D2D1_RECT_U *sourceRectangles=nullptr, D2D1_COLOR_F *colors=nullptr, D2D1_MATRIX_3X2_F *transforms=nullptr) const |
Retrieves the specified subset of sprites from this sprite batch. For the best performance, use nullptr for properties that you do not need to retrieve. | |
UINT32 | GetSpriteCount () const |
Retrieves the number of sprites in the sprite batch. | |
void | Clear () const |
Removes all sprites from this sprite batch. | |
Additional Inherited Members | |
![]() | |
typedef IUnknown | InterfaceType |
![]() | |
template<typename T = Factory> requires std::is_base_of_v< Factory, T> | |
T | GetFactory () |
![]() | |
constexpr | Unknown () noexcept |
Unknown (IUnknown *unknown, bool addref=false) noexcept | |
Unknown (REFIID iid, const Unknown &unknown, bool throwIfNoInterface=true) | |
Unknown (const Unknown &other) noexcept | |
Unknown (Unknown &&other) noexcept | |
~Unknown () noexcept | |
constexpr | operator bool () const noexcept |
Unknown & | operator= (const Unknown &other) noexcept |
Unknown & | operator= (Unknown &&other) noexcept |
void | swap (Unknown &other) noexcept |
void | ResetPtr (IUnknown *other=nullptr, bool addRef=false) noexcept |
Unknown & | operator= (nullptr_t) |
IUnknown * | Detach () |
template<typename T > requires std::is_base_of_v<Unknown, T > | |
T | As () const |
template<typename T > requires std::is_base_of_v<Unknown, T> | |
bool | Is () const noexcept |
template<typename T > requires std::is_base_of_v<IUnknown, T> | |
ComPtr< T > | As () const |
template<typename T > requires std::is_base_of_v<IUnknown, T> | |
bool | Is () const noexcept |
This function can be used to detect if an object supports a particular COM interface derived from IUnknown. | |
template<typename T = IUnknown> | |
T * | GetInterfacePointer () const noexcept |
bool | QueryInterface (REFIID riid, void **itf) const |
Queries a COM object for a pointer to one of its interface; identifying the interface by a reference to its interface identifier (IID). If the COM object implements the interface, then it returns a pointer to that interface after calling IUnknown::AddRef on it. | |
template<typename T > requires std::is_base_of_v<IUnknown, T> | |
bool | QueryInterface (T **itf) const |
constexpr bool | operator== (const Unknown &other) const noexcept |
constexpr bool | operator!= (const Unknown &other) const noexcept |
constexpr bool | operator== (const IUnknown *other) const noexcept |
constexpr bool | operator!= (const IUnknown *other) const noexcept |
![]() | |
template<typename T > requires std::is_base_of_v<Unknown, T> | |
static T | CoCreateInstanceFromClassId (const CLSID &clsid, DWORD classContext=CLSCTX_INPROC_SERVER) |
template<typename T > requires std::is_base_of_v<Unknown, T> | |
static T | CoCreateInstanceFromClassId (const wchar_t *clsid, DWORD classContext=CLSCTX_INPROC_SERVER) |
template<typename T > requires std::is_base_of_v<Unknown, T> | |
static T | CoCreateInstanceFromClassId (const WideString &clsid, DWORD classContext=CLSCTX_INPROC_SERVER) |
template<typename T > requires std::is_base_of_v<Unknown, T> | |
static T | CoCreateInstanceFromProgId (const wchar_t *progId, DWORD classContext=CLSCTX_INPROC_SERVER) |
template<typename T > requires std::is_base_of_v<Unknown, T> | |
static T | CoCreateInstanceFromProgId (const WideString &progId, DWORD classContext=CLSCTX_INPROC_SERVER) |
template<typename T > requires std::is_base_of_v<Unknown, T> | |
static T | CoCreateInstanceFromDll (const ModuleHandle &dll, const CLSID &clsid) |
![]() | |
IUnknown * | unknown_ |
Represents a single group of sprites with their associated drawing properties.
|
inlineprivate |
Adds the given sprites to the end of this sprite batch.
spriteCount | The number of sprites to be added. This determines how many strides into each given array Direct2D will read. |
destinationRectangles | A pointer to an array containing the destination rectangles specifying where to draw the sprites on the destination device context. |
sourceRectangles | A pointer to an array containing the source rectangles specifying the regions of the source bitmap to draw as sprites. Direct2D will use the entire source bitmap for sprites that are assigned a null value or the InfiniteRectU. If this parameter is omitted entirely or set to a null value, then Direct2D will use the entire source bitmap for all the added sprites. |
colors |
A pointer to an array containing the colors to apply to each sprite. The output color is the result of component-wise multiplication of the source bitmap color and the provided color. The output color is not clamped.
Direct2D will not change the color of sprites that are assigned a null value. If this parameter is omitted entirely or set to a null value, then Direct2D will not change the color of any of the added sprites.
transforms |
A pointer to an array containing the transforms to apply to each sprite’s destination rectangle.
Direct2D will not transform the destination rectangle of any sprites that are assigned a null value. If this parameter is omitted entirely or set to a null value, then Direct2D will not transform the destination rectangle of any of the added sprites.
destinationRectanglesStride | Specifies the distance, in bytes, between each rectangle in the destinationRectangles array. If you provide a stride of 0, then the same destination rectangle will be used for each added sprite. |
sourceRectanglesStride | Specifies the distance, in bytes, between each rectangle in the sourceRectangles array (if that array is given). If you provide a stride of 0, then the same source rectangle will be used for each added sprite. |
colorsStride | Specifies the distance, in bytes, between each color in the colors array (if that array is given). If you provide a stride of 0, then the same color will be used for each added sprite. |
transformsStride | Specifies the distance, in bytes, between each transform in the transforms array (if that array is given). If you provide a stride of 0, then the same transform will be used for each added sprite. |
In Direct2D, a sprite is defined by four properties: a destination rectangle, a source rectangle, a color, and a transform. Destination rectangles are mandatory, but the remaining properties are optional.
Always omit or pass a null value for properties you do not wish to use. This allows Direct2D to avoid storing values for those properties and to skip their handling entirely, which improves drawing speed. For example, suppose you have a batch of 500 sprites, and you do not wish to transform any of their destination rectangles. Rather than passing an array of identity matrices, simply omit the transforms parameter. This allows Direct2D to avoid storing any transforms and will yield the fastest drawing performance. On the other hand, if any sprite in the batch has any value set for a property, then internally Direct2D must allocate space for that property array and assign every sprite a value for that property (even if it’s just the default value).
|
inlineprivate |
Removes all sprites from this sprite batch.
|
inlineprivate |
Retrieves the number of sprites in the sprite batch.
|
inlineprivate |
Retrieves the specified subset of sprites from this sprite batch. For the best performance, use nullptr for properties that you do not need to retrieve.
startIndex | The index of the first sprite in this sprite batch to retrieve. |
spriteCount | The number of sprites to retrieve. |
destinationRectangles | When this method returns, contains a pointer to an array containing the destination rectangles for the retrieved sprites. |
sourceRectangles |
When this method returns, contains a pointer to an array containing the source rectangles for the retrieved sprites.
The InfiniteRectU is returned for any sprites that were not assigned a source rectangle.
colors |
When this method returns, contains a pointer to an array containing the colors to be applied to the retrieved sprites.
The color {1.0f, 1.0f, 1.0f, 1.0f} is returned for any sprites that were not assigned a color.
transforms |
When this method returns, contains a pointer to an array containing the transforms to be applied to the retrieved sprites.
The identity matrix is returned for any sprites that were not assigned a transform.
|
inlineprivate |
Updates the properties of the specified sprites in this sprite batch. Providing a null value for any property will leave that property unmodified for that sprite.
startIndex | The index of the first sprite in this sprite batch to update. |
spriteCount | The number of sprites to update with new properties. This determines how many strides into each given array Direct2D will read. |
destinationRectangles | A pointer to an array containing the destination rectangles specifying where to draw the sprites on the destination device context. |
sourceRectangles |
A pointer to an array containing the source rectangles specifying the regions of the source bitmap to draw as sprites.
Direct2D will use the entire source bitmap for sprites that are assigned a null value or the InfiniteRectU. If this parameter is omitted entirely or set to a null value, then Direct2D will use the entire source bitmap for all the updated sprites.
colors |
A pointer to an array containing the colors to apply to each sprite. The output color is the result of component-wise multiplication of the source bitmap color and the provided color. The output color is not clamped.
Direct2D will not change the color of sprites that are assigned a null value. If this parameter is omitted entirely or set to a null value, then Direct2D will not change the color of any of the updated sprites.
transforms |
A pointer to an array containing the transforms to apply to each sprite’s destination rectangle.
Direct2D will not transform the destination rectangle of any sprites that are assigned a null value. If this parameter is omitted entirely or set to a null value, then Direct2D will not transform the destination rectangle of any of the updated sprites.
destinationRectanglesStride | Specifies the distance, in bytes, between each rectangle in the destinationRectangles array. If you provide a stride of 0, then the same destination rectangle will be used for each updated sprite. |
sourceRectanglesStride | Specifies the distance, in bytes, between each rectangle in the sourceRectangles array (if that array is given). If you provide a stride of 0, then the same source rectangle will be used for each updated sprite. |
colorsStride | Specifies the distance, in bytes, between each color in the colors array (if that array is given). If you provide a stride of 0, then the same color will be used for each updated sprite. |
transformsStride | Specifies the distance, in bytes, between each transform in the transforms array (if that array is given). If you provide a stride of 0, then the same transform will be used for each updated sprite. |