Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cImageBase.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cImageBase_H
7 #define _INC_cImageBase_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cSurfaceBase.h"
13 #include "../System/cAppRes.h"
14 #include "GrayCore/include/cFile.h"
17 
18 namespace GrayLib
19 {
21  {
26 
27  typedef cSurfaceBase SUPER_t;
28 
29  public:
30  cImageBase() noexcept
31  {
32  }
33  virtual ~cImageBase()
34  {
35  }
36 
37  virtual bool isValidImage() const noexcept
38  {
41  return isValidPixelData();
42  }
43 
44  virtual HRESULT ReadStream(cStreamInput& strIn) = 0;
45  virtual HRESULT WriteStream(cStreamOutput* pFile) const
46  {
49  return E_NOTIMPL;
50  }
51 
52  virtual HRESULT LoadFile(const FILECHAR_t* pszFileName);
53  virtual HRESULT SaveFile(const FILECHAR_t* pszFileName) const;
54 
55 #ifdef _WIN32
56  HRESULT LoadResource(const GChar_t* pResName, const void* pResType = RT_RCDATA, HMODULE hInst = HMODULE_NULL);
57  HRESULT LoadResource(RESOURCEID_t id, const void* pResType = RT_RCDATA, HMODULE hInst = HMODULE_NULL)
58  {
59  return LoadResource(cAppRes::MakeIntResource(id), pResType, hInst);
60  }
61 #endif
62  };
63 
65 
66  MIDL_INTERFACE("0C3E2E71-B93C-11d2-AAD0-006007348453") IImageCreator
67  {
72 
74  virtual bool IsFileExt(const FILECHAR_t * pszFileExt) const = 0;
75  virtual cImageBasePtr CreateObject() const = 0;
76  };
77 }
78 #endif
#define IGNORE_WARN_INTERFACE(c)
Definition: GrayCore.h:79
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define UNREFERENCED_PARAMETER(P)
< _WIN32 type thing. get rid of stupid warning.
Definition: SysTypes.h:299
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define HMODULE_NULL
Definition: cOSModule.h:31
Definition: cImageBase.h:21
virtual HRESULT ReadStream(cStreamInput &strIn)=0
cImageBase() noexcept
Definition: cImageBase.h:30
virtual HRESULT WriteStream(cStreamOutput *pFile) const
Definition: cImageBase.h:45
virtual ~cImageBase()
Definition: cImageBase.h:33
virtual bool isValidImage() const noexcept
Definition: cImageBase.h:37
Definition: cSurfaceBase.h:26
static constexpr const GChar_t * MakeIntResource(RESOURCEID_t id) noexcept
Definition: cWinResource.h:45
Definition: cRefPtr.h:22
Definition: cRefPtr.h:225
Definition: cStream.h:306
Definition: cStream.h:126
Definition: cImageBase.h:66
Definition: cMesh.h:22
cRefPtr< cImageBase > cImageBasePtr
Definition: cImageBase.h:64
MIDL_INTERFACE("0C3E2E71-B93C-11d2-AAD0-006007654304") IScriptableObj
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
WORD RESOURCEID_t
A resource in .RC attached to a file/module. like MAKEINTRESOURCE(). https://docs....
Definition: cResourceBase.h:19
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26