Scope
d2d::D2ChannelRender Class Reference

#include <D2ChannelRender.h>

Public Member Functions

 ~D2ChannelRender ()
 
virtual void Create (const HWND &_hwnd, const uint32_t &_xres, const uint32_t &_yres)
 
virtual void Render ()
 
ID2D1Bitmap * Bitmap () const
 
bool ResizeBitmap (const uint32_t &_xres, const uint32_t &_yres)
 
void DrawBitmap ()
 
virtual bool Resize (const uint32_t &_xres, const uint32_t &_yres)
 
D2D1_SIZE_F GetSize (void) const
 
virtual void UpdateScaleText (const std::wstring &_text)
 

Protected Member Functions

void DiscardDeviceResources ()
 

Protected Attributes

std::mutex mutex
 
std::unique_ptr< RenderTargetrender_target
 
ID2D1Bitmap * bitmap
 
ID2D1SolidColorBrush * text_brush
 
IDWriteTextFormat * text_format
 
HWND hwnd
 
std::wstring scaletext
 

Detailed Description

Handles all Direct2D rendering in a CChannelView.

Renders and resizes a bitmap. All mutex protected.

Definition at line 9 of file D2ChannelRender.h.

Constructor & Destructor Documentation

d2d::D2ChannelRender::~D2ChannelRender ( )

Discard resources and delete the render_target.

Definition at line 16 of file D2ChannelRender.cpp.

Member Function Documentation

void d2d::D2ChannelRender::DiscardDeviceResources ( )
protected

Safely release all Direct2D resources.

Definition at line 20 of file D2ChannelRender.cpp.

void d2d::D2ChannelRender::Create ( const HWND &  _hwnd,
const uint32_t &  _xres,
const uint32_t &  _yres 
)
virtual

Creates the render target for a hwnd, a bitmap with the desired resolution, a brushes for painting , and a text format for µm text.

Definition at line 26 of file D2ChannelRender.cpp.

void d2d::D2ChannelRender::Render ( )
virtual

Renders the bitmap and the scale text.

Definition at line 49 of file D2ChannelRender.cpp.

ID2D1Bitmap* d2d::D2ChannelRender::Bitmap ( ) const
inline
Returns
pointer to current Direct2D bitmap

Definition at line 51 of file D2ChannelRender.h.

bool d2d::D2ChannelRender::ResizeBitmap ( const uint32_t &  _xres,
const uint32_t &  _yres 
)

Resizes the bitmap.

Parameters
[in]_xres,_yresnew size
Returns
true if successful

Definition at line 42 of file D2ChannelRender.cpp.

void d2d::D2ChannelRender::DrawBitmap ( )
inline

Draws current bitmap in render target.

Definition at line 59 of file D2ChannelRender.h.

bool d2d::D2ChannelRender::Resize ( const uint32_t &  _xres,
const uint32_t &  _yres 
)
virtual

Resizes the render target.

Parameters
[in]_xres,_yresnew size
Returns
true if successful

Definition at line 36 of file D2ChannelRender.cpp.

D2D1_SIZE_F d2d::D2ChannelRender::GetSize ( void  ) const
inline
Returns
current size of render target

Definition at line 67 of file D2ChannelRender.h.

void d2d::D2ChannelRender::UpdateScaleText ( const std::wstring &  _text)
virtual

Update the scale text.

Definition at line 73 of file D2ChannelRender.cpp.

Member Data Documentation

std::mutex d2d::D2ChannelRender::mutex
mutableprotected

mutex for protection

Definition at line 13 of file D2ChannelRender.h.

std::unique_ptr<RenderTarget> d2d::D2ChannelRender::render_target
protected

Direct2D render target.

Definition at line 16 of file D2ChannelRender.h.

ID2D1Bitmap* d2d::D2ChannelRender::bitmap
protected

Direct2D bitmap (do not use a unique_ptr for COM interfaces)

Definition at line 19 of file D2ChannelRender.h.

ID2D1SolidColorBrush* d2d::D2ChannelRender::text_brush
protected

Direct2D brush for text (do not use a unique_ptr for COM interfaces)

Definition at line 22 of file D2ChannelRender.h.

IDWriteTextFormat* d2d::D2ChannelRender::text_format
protected

Direct2D text format (do not use a unique_ptr for COM interfaces)

Definition at line 25 of file D2ChannelRender.h.

HWND d2d::D2ChannelRender::hwnd
protected

Window handle.

Definition at line 28 of file D2ChannelRender.h.

std::wstring d2d::D2ChannelRender::scaletext
protected

String with the scale information, ala L"9.5 µm".

Definition at line 31 of file D2ChannelRender.h.


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