CD2DBitmapBrush Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CD2DBitmapBrush Class.

A wrapper for ID2D1BitmapBrush.

class CD2DBitmapBrush : public CD2DBrush;  

Public Constructors

NameDescription
CD2DBitmapBrush::CD2DBitmapBrushOverloaded. Constructs a CD2DBitmapBrush object from file.
CD2DBitmapBrush::~CD2DBitmapBrushThe destructor. Called when a D2D bitmap brush object is being destroyed.

Public Methods

NameDescription
CD2DBitmapBrush::AttachAttaches existing resource interface to the object
CD2DBitmapBrush::CreateCreates a CD2DBitmapBrush. (Overrides CD2DResource::Create.)
CD2DBitmapBrush::DestroyDestroys a CD2DBitmapBrush object. (Overrides CD2DBrush::Destroy.)
CD2DBitmapBrush::DetachDetaches resource interface from the object
CD2DBitmapBrush::GetReturns ID2D1BitmapBrush interface
CD2DBitmapBrush::GetBitmapGets the bitmap source that this brush uses to paint
CD2DBitmapBrush::GetExtendModeXGets the method by which the brush horizontally tiles those areas that extend past its bitmap
CD2DBitmapBrush::GetExtendModeYGets the method by which the brush vertically tiles those areas that extend past its bitmap
CD2DBitmapBrush::GetInterpolationModeGets the interpolation method used when the brush bitmap is scaled or rotated
CD2DBitmapBrush::SetBitmapSpecifies the bitmap source that this brush uses to paint
CD2DBitmapBrush::SetExtendModeXSpecifies how the brush horizontally tiles those areas that extend past its bitmap
CD2DBitmapBrush::SetExtendModeYSpecifies how the brush vertically tiles those areas that extend past its bitmap
CD2DBitmapBrush::SetInterpolationModeSpecifies the interpolation mode used when the brush bitmap is scaled or rotated

Protected Methods

NameDescription
CD2DBitmapBrush::CommonInitInitializes the object

Public Operators

NameDescription
CD2DBitmapBrush::operator ID2D1BitmapBrush*Returns ID2D1BitmapBrush interface

Protected Data Members

NameDescription
CD2DBitmapBrush::m_pBitmapStores a pointer to a CD2DBitmap object.
CD2DBitmapBrush::m_pBitmapBrushStores a pointer to an ID2D1BitmapBrush object.
CD2DBitmapBrush::m_pBitmapBrushPropertiesBitmap brush properties.

CObject

CD2DResource

CD2DBrush

CD2DBitmapBrush

Header: afxrendertarget.h

The destructor. Called when a D2D bitmap brush object is being destroyed.

virtual ~CD2DBitmapBrush();

Attaches existing resource interface to the object

void Attach(ID2D1BitmapBrush* pResource);

Parameters

pResource
Existing resource interface. Cannot be NULL

Constructs a CD2DBitmapBrush object.

CD2DBitmapBrush(
    CRenderTarget* pParentTarget,  
    D2D1_BITMAP_BRUSH_PROPERTIES* pBitmapBrushProperties = NULL,  
    CD2DBrushProperties* pBrushProperties = NULL,  
    BOOL bAutoDestroy = TRUE);

 
CD2DBitmapBrush(
    CRenderTarget* pParentTarget,  
    UINT uiResID,  
    LPCTSTR lpszType = NULL,  
    CD2DSizeU sizeDest = CD2DSizeU(0, 0), 
    D2D1_BITMAP_BRUSH_PROPERTIES* pBitmapBrushProperties = NULL,  
    CD2DBrushProperties* pBrushProperties = NULL,  
    BOOL bAutoDestroy = TRUE);

 
CD2DBitmapBrush(
    CRenderTarget* pParentTarget,  
    LPCTSTR lpszImagePath,  
    CD2DSizeU sizeDest = CD2DSizeU(0, 0), 
    D2D1_BITMAP_BRUSH_PROPERTIES* pBitmapBrushProperties = NULL,  
    CD2DBrushProperties* pBrushProperties = NULL,  
    BOOL bAutoDestroy = TRUE);

Parameters

pParentTarget
A pointer to the render target.

pBitmapBrushProperties
A pointer to the extend modes and the interpolation mode of a bitmap brush.

pBrushProperties
A pointer to the opacity and transformation of a brush.

bAutoDestroy
Indicates that the object will be destroyed by owner (pParentTarget).

uiResID
The resource ID number of the resource.

lpszType
Pointer to a null-terminated string that contains the resource type.

sizeDest
Destination size of the bitmap.

lpszImagePath
Pointer to a null-terminated string that contains the name of file.

Initializes the object

void CommonInit(D2D1_BITMAP_BRUSH_PROPERTIES* pBitmapBrushProperties);

Parameters

pBitmapBrushProperties
A pointer to the bitmap brush properties.

Creates a CD2DBitmapBrush.

virtual HRESULT Create(CRenderTarget* pRenderTarget);

Parameters

pRenderTarget
A pointer to the render target.

Return Value

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Destroys a CD2DBitmapBrush object.

virtual void Destroy();

Detaches resource interface from the object

ID2D1BitmapBrush* Detach();

Return Value

Pointer to detached resource interface.

Returns ID2D1BitmapBrush interface

ID2D1BitmapBrush* Get();

Return Value

Pointer to an ID2D1BitmapBrush interface or NULL if object is not initialized yet.

Gets the bitmap source that this brush uses to paint

CD2DBitmap* GetBitmap();

Return Value

Pointer to an CD2DBitmap object or NULL if object is not initialized yet.

Gets the method by which the brush horizontally tiles those areas that extend past its bitmap

D2D1_EXTEND_MODE GetExtendModeX() const;  

Return Value

A value that specifies how the brush horizontally tiles those areas that extend past its bitmap

Gets the method by which the brush vertically tiles those areas that extend past its bitmap

D2D1_EXTEND_MODE GetExtendModeY() const;  

Return Value

A value that specifies how the brush vertically tiles those areas that extend past its bitmap

Gets the interpolation method used when the brush bitmap is scaled or rotated

D2D1_BITMAP_INTERPOLATION_MODE GetInterpolationMode() const;  

Return Value

The interpolation method used when the brush bitmap is scaled or rotated

Stores a pointer to a CD2DBitmap object.

CD2DBitmap* m_pBitmap;  

Stores a pointer to an ID2D1BitmapBrush object.

ID2D1BitmapBrush* m_pBitmapBrush;  

Bitmap brush properties.

D2D1_BITMAP_BRUSH_PROPERTIES* m_pBitmapBrushProperties;  

Returns ID2D1BitmapBrush interface

operator ID2D1BitmapBrush*();

Return Value

Pointer to an ID2D1BitmapBrush interface or NULL if object is not initialized yet.

Specifies the bitmap source that this brush uses to paint

void SetBitmap(CD2DBitmap* pBitmap);

Parameters

pBitmap
The bitmap source used by the brush

Specifies how the brush horizontally tiles those areas that extend past its bitmap

void SetExtendModeX(D2D1_EXTEND_MODE extendModeX);

Parameters

extendModeX
A value that specifies how the brush horizontally tiles those areas that extend past its bitmap

Specifies how the brush vertically tiles those areas that extend past its bitmap

void SetExtendModeY(D2D1_EXTEND_MODE extendModeY);

Parameters

extendModeY
A value that specifies how the brush vertically tiles those areas that extend past its bitmap

Specifies the interpolation mode used when the brush bitmap is scaled or rotated

void SetInterpolationMode(D2D1_BITMAP_INTERPOLATION_MODE interpolationMode);

Parameters

interpolationMode
The interpolation mode used when the brush bitmap is scaled or rotated

Classes

Show: