/** * @file XTPMarkupGdiPlusImage.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(__XTPMARKUPGDIPLUSIMAGE_H__) # define __XTPMARKUPGDIPLUSIMAGE_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" namespace Gdiplus { class GpImage; class PropertyItem; } // namespace Gdiplus class CXTPGdiPlus; class CXTPImageManager; class CXTPImageManagerIcon; struct XTP_URI; struct IXTPMarkupDeviceDependentImageSite; /** * @brief * Implements an abstract GDI+ device dependent image. */ class _XTP_EXT_CLASS CXTPMarkupGdiPlusImage : public CXTPMarkupDeviceDependentImage { /** @cond */ DECLARE_DYNAMIC(CXTPMarkupGdiPlusImage); /** @endcond */ public: /** * @brief * Constructs a device dependent image object. * @param pReserved Reserved. Not used. * @param pSite Valid pointer to an image site interface. */ CXTPMarkupGdiPlusImage(CXTPGdiPlus* pReserved, IXTPMarkupDeviceDependentImageSite* pSite); /** * @brief * Handles device dependent image object deallocation. */ virtual ~CXTPMarkupGdiPlusImage(); public: /** * @brief * Loads an image from a specified resource. * @param lpszSource Pointer to a string that indicates the image source. Can * be a relative or full file path, file:// path, res:// * path, or an integer in decimal representation that indicates * the icon index. * @param nWidth Width of the image to be loaded. Used only for icons. Can * be 0 if not relevant. * @param nHeight Width of the image to be loaded. Used only for XAML and SVG icons. * @return * TRUE if the image is loaded successfully. */ virtual BOOL Load(LPCWSTR lpszSource, int nWidth, int nHeight = 0); /** * @brief * Obtains the GDI+ wrapped image pointer. * @return * The GDI+ wrapped image pointer if successful, otherwise NULL. */ Gdiplus::GpImage* GetGpImage(); /** * @brief * Obtains the icon wrapped image pointer. * @return * The icon wrapped image pointer if successful, otherwise NULL. */ CXTPImageManagerIcon* GetIcon(); private: typedef CMap AnimationTimerData; static AnimationTimerData& AFX_CDECL GetAnimationTimerData(); static BOOL AFX_CDECL ParseIconSource(LPCWSTR lpszSource, UINT& nIconId); BOOL LoadIcon(UINT nIconId, int nWidth); BOOL LoadIcon(const XTP_URI& uri, int nWidth); BOOL LoadImage(const XTP_URI& uri); BOOL LoadXamlImage(const XTP_URI& uri, int nWidth, int nHeight); BOOL LoadSvgImage(const XTP_URI& uri, int nWidth, int nHeight); void Cleanup(); void LoadAnimationData(); void RenderAnimation(); void StopAnimation(); static void CALLBACK OnAnimationTimer(HWND hWnd, UINT uMsg, UINT_PTR nTimerId, DWORD dwTime); Gdiplus::GpImage* m_pImage; UINT m_nFrameCount; UINT m_nCurrentFrame; Gdiplus::PropertyItem* m_pDelayProperty; UINT_PTR m_nTimerId; CXTPImageManager* m_pImageManager; CXTPImageManagerIcon* m_pIcon; CXTPMarkupContext* m_pMarkupContext; }; AFX_INLINE Gdiplus::GpImage* CXTPMarkupGdiPlusImage::GetGpImage() { return m_pImage; } AFX_INLINE CXTPImageManagerIcon* CXTPMarkupGdiPlusImage::GetIcon() { return m_pIcon; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif /*__XTPMARKUPGDIPLUSIMAGE_H__*/ /** @endcond */