#pragma once #include #include #include #include class FrameDrawer { public: static std::unique_ptr Create(HWND window); FrameDrawer(HWND window); FrameDrawer(FrameDrawer&& other) = default; bool Init(); void Show(); void Hide(); void SetBorderRect(RECT windowRect, COLORREF color, float thickness); private: bool CreateRenderTargets(const RECT& clientRect); struct DrawableRect { D2D1_RECT_F rect; D2D1_COLOR_F borderColor; float thickness; }; static ID2D1Factory* GetD2DFactory(); static IDWriteFactory* GetWriteFactory(); static D2D1_COLOR_F ConvertColor(COLORREF color); static D2D1_RECT_F ConvertRect(RECT rect); void Render(); HWND m_window = nullptr; size_t m_renderTargetSizeHash = {}; winrt::com_ptr m_renderTarget; winrt::com_ptr m_borderBrush; DrawableRect m_sceneRect = {}; };