Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cSurfaceIcon.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cSurfaceIcon_H
7 #define _INC_cSurfaceIcon_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cSurface.h"
13 #include "../Geometry/cPoint2.h"
16 
18 
19 namespace GrayLib
20 {
22 
23  class GRAYLIB_LINK cSurfaceIcon // : public cImageBase
24  {
28 
29  public:
30  bool m_bCursor;
34 
35  protected:
36  HRESULT ReadStreamNH(cStreamInput& stmIn);
37  static HRESULT GRAYCALL ReadStreamH(cStreamInput& stmIn, OUT tagICONDIR& icondir);
38 
39  public:
40  cSurfaceIcon(bool bCursor = false) noexcept;
41  ~cSurfaceIcon();
42 
43  bool isValid() const noexcept
44  {
45  return m_SurfMask.isValidPixelData();
46  }
47  PIXELS_t get_Width() const noexcept
48  {
50  return m_SurfMask.get_Width();
51  }
52  PIXELS_t get_Height() const noexcept
53  {
55  return m_SurfMask.get_Height();
56  }
57  size_t get_SizeImage() const;
58 
59 #if defined(_WIN32) && ! defined(UNDER_CE)
60  bool SetWindowsIcon(HCURSOR hCursor);
61 #endif
62  bool SetScaleIcon(const cSurfaceIcon& src, float fx, float fy);
63  bool DrawIconX(cSurfaceBase& dst, PIXELS_t dx, PIXELS_t dy);
64 
65  HRESULT ReadStream1(cStreamInput& file, int nIconIndex = 0);
66  static HRESULT GRAYCALL ReadStreamAll(cStreamInput& file, OUT cArrayNew<cSurfaceIcon>& a);
67 
68  HRESULT WriteStream1(cStreamOutput* pFile) const;
69  static HRESULT GRAYCALL WriteStreamAll(cStreamOutput* pFile, const cArrayNew<cSurfaceIcon>& a);
70 
72  };
73 }
74 #endif
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define CATTR_PACKED
Definition: GrayCore.h:87
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
struct CATTR_PACKED tagICONDIR
Definition: cSurfaceIcon.h:17
Definition: cPoint2.h:20
Definition: cSurfaceBase.h:26
PIXELS_t get_Height() const noexcept
Definition: cSurfaceBase.h:88
PIXELS_t get_Width() const noexcept
Definition: cSurfaceBase.h:83
bool isValidPixelData() const noexcept
basic attributes.
Definition: cSurfaceBase.h:103
Definition: cSurfaceIcon.h:24
cSurface m_SurfColor
XOR mask image.
Definition: cSurfaceIcon.h:33
PIXELS_t get_Width() const noexcept
Definition: cSurfaceIcon.h:47
cSurface m_SurfMask
AND mask image.
Definition: cSurfaceIcon.h:32
UNITTEST_FRIEND(cSurfaceIcon)
PIXELS_t get_Height() const noexcept
Definition: cSurfaceIcon.h:52
bool m_bCursor
The m_ptHotspot is set/used.
Definition: cSurfaceIcon.h:30
cPoint2i m_ptHotspot
m_bCursor support this but Icons do not. PIXELS_t
Definition: cSurfaceIcon.h:31
Definition: cSurface.h:21
Definition: cArrayNew.h:19
Definition: cStream.h:306
Definition: cStream.h:126
Definition: cMesh.h:22
UNITTEST2_PREDEF(cQuadtree)
int PIXELS_t
Count of pixels in a dimension of some image/surface.
Definition: cSurfaceInfo.h:20
Definition: cDebugAssert.h:29