/** * @file XTPFlowGraphDrawContextGdiPlus.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPFLOWGRAPHDRAWCONTEXTGDIPLUS_H__) # define __XTPFLOWGRAPHDRAWCONTEXTGDIPLUS_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPFlowGraphControl; class CXTPFlowGraphImage; namespace Gdiplus { class Brush; class Pen; class Graphics; class GraphicsPath; } // namespace Gdiplus class _XTP_EXT_CLASS CXTPFlowGraphDrawContextGdiPlus : public CXTPFlowGraphDrawContext { public: /** * @brief * Constructs a CXTPFlowGraphDrawContextGdiPlus object. */ CXTPFlowGraphDrawContextGdiPlus(HDC hDC, HDC hAttribDC = NULL, BOOL bPrinting = FALSE); /** * @brief * Destroys a CXTPFlowGraphDrawContextGdiPlus object, handles cleanup * and deallocation. */ virtual ~CXTPFlowGraphDrawContextGdiPlus(); public: /** * @brief * Obsolete. */ static void AFX_CDECL Register(BOOL bReserved); public: /** * @brief * Call this function to get the GDI+ graphics class. * @return * A pointer to a GpGraphics object. */ virtual Gdiplus::Graphics* GetGraphics() const; public: virtual CSize MeasureMarkupElement(CXTPMarkupUIElement* pMarkupUIElement); virtual void DrawMarkupElement(CXTPMarkupUIElement* pMarkupUIElement, LPCRECT lpRect, UINT uFormat); virtual CSize MeasureString(const CString& str); virtual void SetClipRect(CRect rc); virtual CRect GetClipRect() const; virtual void DrawGrid(CRect rc, CPoint ptScrollOffset, double dZoomLevel, COLORREF clrGridColor); virtual void SetSmoothingMode(int nMode); public: virtual void FillSolidRect(LPCRECT lpRect, COLORREF clr); virtual void FillSolidRect(int x, int y, int cx, int cy, COLORREF clr); virtual void GradientFill(CRect rc, COLORREF clrFrom, COLORREF clrTo, BOOL bHoriz); virtual void Draw3dRect(int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight); virtual void Draw3dRect(LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight); virtual void DrawFrame(int x, int y, int cx, int cy, int sz, COLORREF clr); virtual void DrawText(LPCTSTR lpszText, LPCRECT lpRect, UINT uFormat); virtual void DrawCurve(Gdiplus::GraphicsPath* pPath); virtual void Clear(COLORREF clr); using CXTPFlowGraphDrawContext::Line; virtual void Line(float x1, float y1, float x2, float y2); virtual void Ellipse(LPCRECT lpRect); virtual void SetWorldTransform(CPoint ptOffset, double dZoomLevel); virtual void SetBrush(COLORREF clr); virtual void SetPen(COLORREF clrPen, int nWidth, BOOL bDashed = FALSE); virtual void SetFont(LOGFONT* lf); virtual void SetTextColor(COLORREF clr); virtual void DrawImage(CXTPFlowGraphImage* pImage, CRect rc); virtual void FillPolygon(const POINT* pts, int nCount); public: Gdiplus::Brush* CreateBrush(COLORREF clr); static DWORD AFX_CDECL ColorRefToARGB(COLORREF clr); # ifdef _XTP_DEMOMODE virtual void CXTPFlowGraphDrawContextGdiPlus::DrawWatermarkBackground(CRect rc); # endif protected: Gdiplus::Brush* m_pActiveBrush; Gdiplus::Brush* m_pActiveTextBrush; Gdiplus::Pen* m_pActivePen; Gdiplus::Font* m_pActiveFont; LOGFONT m_lfActiveFont; COLORREF m_clrTextColor; Gdiplus::Graphics* m_pGraphics; struct BRUSHREC { COLORREF clr; Gdiplus::Brush* pBrush; }; enum { MAX_BRUSH = 6 }; int m_nBrushCount; BRUSHREC m_arrBrushes[MAX_BRUSH]; }; AFX_INLINE Gdiplus::Graphics* CXTPFlowGraphDrawContextGdiPlus::GetGraphics() const { return m_pGraphics; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPFLOWGRAPHDRAWCONTEXTGDIPLUS_H__) /** @endcond */