Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::Windows::Graphics::Bitmap1 Class Reference

Represents a bitmap that can be used as a surface for a DeviceContext or mapped into system memory, and can contain additional color context information. More...

#include <HWGraphics.h>

Inheritance diagram for Harlinn::Windows::Graphics::Bitmap1:
[legend]
Collaboration diagram for Harlinn::Windows::Graphics::Bitmap1:
[legend]

Public Types

using Base = Bitmap
 
- Public Types inherited from Harlinn::Common::Core::Unknown
typedef IUnknown InterfaceType
 

Public Member Functions

void GetColorContext (ID2D1ColorContext **colorContext) const
 Retrieves the color context information associated with the bitmap.
 
ColorContext GetColorContext () const
 
D2D1_BITMAP_OPTIONS GetOptions () const
 Retrieves the bitmap options used when creating the API.
 
void GetSurface (IDXGISurface **dxgiSurface) const
 Retrieves the DXGI surface from the corresponding bitmap, if the bitmap was created from a device derived from a D3D device.
 
DXGI::Surface GetSurface () const
 
void Map (D2D1_MAP_OPTIONS options, D2D1_MAPPED_RECT *mappedRect) const
 Maps the given bitmap into memory. The bitmap must have been created with the D2D1_BITMAP_OPTIONS_CPU_READ flag.
 
void Unmap () const
 Unmaps the given bitmap from memory.
 
- Public Member Functions inherited from Harlinn::Windows::Graphics::Bitmap
D2D1_SIZE_F GetSize () const
 
D2D1_SIZE_U GetPixelSize () const
 
D2D1_PIXEL_FORMAT GetPixelFormat () const
 
void GetDpi (FLOAT *dpiX, FLOAT *dpiY) const
 
void GetDpi (FLOAT &dpiX, FLOAT &dpiY) const
 
D2D1_SIZE_F GetDpi () const
 
void CopyFromBitmap (const D2D1_POINT_2U *destPoint, ID2D1Bitmap *bitmap, const D2D1_RECT_U *srcRect) const
 
void CopyFromRenderTarget (const D2D1_POINT_2U *destPoint, ID2D1RenderTarget *renderTarget, const D2D1_RECT_U *srcRect) const
 
void CopyFromMemory (const D2D1_RECT_U *dstRect, const void *srcData, UINT32 pitch) const
 
- Public Member Functions inherited from Harlinn::Windows::Graphics::Resource
template<typename T = Factory>
requires std::is_base_of_v< Factory, T>
T GetFactory ()
 
- Public Member Functions inherited from Harlinn::Common::Core::Unknown
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
 
Unknownoperator= (const Unknown &other) noexcept
 
Unknownoperator= (Unknown &&other) noexcept
 
void swap (Unknown &other) noexcept
 
void ResetPtr (IUnknown *other=nullptr, bool addRef=false) noexcept
 
Unknownoperator= (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< TAs () 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>
TGetInterfacePointer () 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
 

Additional Inherited Members

- Static Public Member Functions inherited from Harlinn::Common::Core::Unknown
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)
 
- Protected Attributes inherited from Harlinn::Common::Core::Unknown
IUnknown * unknown_
 

Detailed Description

Represents a bitmap that can be used as a surface for a DeviceContext or mapped into system memory, and can contain additional color context information.

Member Typedef Documentation

◆ Base

Member Function Documentation

◆ GetColorContext() [1/2]

ColorContext Harlinn::Windows::Graphics::Bitmap1::GetColorContext ( ) const
inline

◆ GetColorContext() [2/2]

void Harlinn::Windows::Graphics::Bitmap1::GetColorContext ( ID2D1ColorContext ** colorContext) const
inline

Retrieves the color context information associated with the bitmap.

Parameters
colorContextWhen this method returns, contains the address of a pointer to the color context interface associated with the bitmap.

◆ GetOptions()

D2D1_BITMAP_OPTIONS Harlinn::Windows::Graphics::Bitmap1::GetOptions ( ) const
inline

Retrieves the bitmap options used when creating the API.

Returns
The options used when creating the bitmap.

◆ GetSurface() [1/2]

DXGI::Surface Harlinn::Windows::Graphics::Bitmap1::GetSurface ( ) const
inline

◆ GetSurface() [2/2]

void Harlinn::Windows::Graphics::Bitmap1::GetSurface ( IDXGISurface ** dxgiSurface) const
inline

Retrieves the DXGI surface from the corresponding bitmap, if the bitmap was created from a device derived from a D3D device.

Parameters
dxgiSurfaceThe underlying DXGI surface for the bitmap.

The bitmap used must have been created from a DXGI surface render target, a derived render target, or a device context created from an ID2D1Device.

The returned surface can be used with Microsoft Direct3D or any other API that interoperates with shared surfaces. The application must transitively ensure that the surface is usable on the Direct3D device that is used in this context. For example, if using the surface with Direct2D then the Direct2D render target must have been created through Graphics::Factory::CreateDxgiSurfaceRenderTarget or on a device context created on the same device.

◆ Map()

void Harlinn::Windows::Graphics::Bitmap1::Map ( D2D1_MAP_OPTIONS options,
D2D1_MAPPED_RECT * mappedRect ) const
inline

Maps the given bitmap into memory. The bitmap must have been created with the D2D1_BITMAP_OPTIONS_CPU_READ flag.

Parameters
optionsThe options used in mapping the bitmap into memory.
mappedRectWhen this method returns, contains a reference to the rectangle that is mapped into memory.

You can't use bitmaps for some purposes while mapped. Particularly, the Bitmap::CopyFromBitmap method doesn't work if either the source or destination bitmap is mapped.

The bitmap must have been created with the D2D1_BITMAP_OPTIONS_CPU_READ flag specified.

◆ Unmap()

void Harlinn::Windows::Graphics::Bitmap1::Unmap ( ) const
inline

Unmaps the given bitmap from memory.

Any memory returned from the Map call is now invalid and may be reclaimed by the operating system or used for other purposes.

The bitmap must have been previously mapped.


The documentation for this class was generated from the following file: