21#define _WIN32_WINNT 0x0A00
28#define WIN32_LEAN_AND_MEAN
42#include <d2d1helper.h>
52template<
class Interface>
55 Interface **ppInterfaceToRelease
58 if (*ppInterfaceToRelease != NULL)
60 (*ppInterfaceToRelease)->Release();
62 (*ppInterfaceToRelease) = NULL;
67#if defined( DEBUG ) || defined( _DEBUG )
68#define Assert(b) do {if (!(b)) {OutputDebugStringA("Assert: " #b "\n");}} while(0)
75#ifndef HINST_THISCOMPONENT
77#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
80#define WM_2DVIEWER_CLOSED (WM_USER + 0x0001)
117 HRESULT Initialize( HWND hWndParent );
124 HRESULT loadBitmap();
125 HRESULT CreateDeviceIndependentResources();
126 HRESULT CreateDeviceResources();
127 void DiscardDeviceResources();
133 static LRESULT CALLBACK WndProc(
139 void CalcCursorPos();
141 void DrawVerticalLine(
142 D2D1_POINT_2F startPoint,
146 void DrawHorizontalLine(
147 D2D1_POINT_2F startPoint,
152 D2D1_POINT_2F location,
155 void Scale_setSkipLines(
160 ID2D1Factory *m_pD2DFactory;
161 IWICImagingFactory *m_pWICFactory;
162 IDWriteFactory *m_pDWriteFactory;
163 ID2D1HwndRenderTarget *m_pRenderTarget;
164 IDWriteTextFormat *m_pTextFormat;
165 IDWriteTextFormat *m_pTextFormat_scale;
166 ID2D1SolidColorBrush *m_pBlackBrush;
167 ID2D1Bitmap *m_pBitmap;
172 FLOAT distance_x = 10;
173 FLOAT distance_y = 10;
181 UINT16 white = 0xFFFF;
void SafeRelease(Interface **ppInterfaceToRelease)
Definition Direct2dViewer.h:54
EXTERN_C IMAGE_DOS_HEADER __ImageBase
Definition Direct2dViewer.h:76
void showNewBitmap(void *addr, UINT width, UINT height)
Show a new bitmap in 2d viewer.
Definition Direct2dViewer.cpp:565
~Direct2dViewer()
Release resources.
Definition Direct2dViewer.cpp:29
Direct2dViewer()
Initialize members.
Definition Direct2dViewer.cpp:13
HWND getWindowHandler()
Returns the window handler of 2d viewer.
Definition Direct2dViewer.cpp:506
UINT16 GetGammaBlack()
return gamma value black
Definition Direct2dViewer.cpp:537
HRESULT start2dViewer(HWND hWndParent, void *bitmapAddr, UINT width, UINT height)
Starts 2d viewer with a initial bitmap. Use this to start 2d viewer. Call constructor before.
Definition Direct2dViewer.cpp:550
UINT16 GetGammaWhite()
return gamma value white
Definition Direct2dViewer.cpp:529
void repaintWindow()
Reload the displayed bitmap in 2d viewer.
Definition Direct2dViewer.cpp:577
void SetGammaValue(UINT16 white, UINT16 black)
Set gamma value.
Definition Direct2dViewer.cpp:516