Free Electron
ImageRaw.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __image_ImageRaw_h__
8 #define __image_ImageRaw_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Image handling using raw buffers
17 
18  @ingroup image
19 
20  Currently, no file IO is supported.
21  A raw byte dump might be added later.
22 *//***************************************************************************/
23 class FE_DL_EXPORT ImageRaw: public ImageCommon
24 {
25  public:
26  ImageRaw(void);
27 virtual ~ImageRaw(void);
28 
29  //* As ImageI
30 virtual I32 createSelect(void);
31 virtual void select(I32 id);
32 virtual I32 selected(void) const { return m_selected; }
33 virtual void unload(I32 id);
34 
35 virtual void setFormat(ImageI::Format format);
36 virtual ImageI::Format format(void) const
37  { return m_selected<m_buffers.size()?
38  m_buffers[m_selected].m_format: ImageI::e_none; }
39 
40 virtual void resize(U32 width,U32 height,U32 depth);
41 virtual void replaceRegion(U32 x,U32 y,U32 z,
42  U32 width,U32 height,U32 depth,void* data);
43 
44 virtual U32 width(void) const
45  { return m_selected<m_buffers.size()?
46  m_buffers[m_selected].m_width: 0; }
47 virtual U32 height(void) const
48  { return m_selected<m_buffers.size()?
49  m_buffers[m_selected].m_height: 0; }
50 virtual U32 depth(void) const
51  { return m_selected<m_buffers.size()?
52  m_buffers[m_selected].m_depth: 0; }
53 virtual void* raw(void) const
54  { return m_selected<m_buffers.size()?
55  m_buffers[m_selected].m_pData: NULL; }
56 
57  private:
58  class Buffer
59  {
60  public:
61 
62  Buffer(void):
63  m_created(FALSE),
64  m_pData(NULL)
65  { reset(); }
66  ~Buffer(void)
67  {
68  if(m_pData)
69  {
70  deallocate(m_pData);
71  }
72  }
73  void reset(void)
74  {
75  if(m_pData)
76  {
77  deallocate(m_pData);
78  }
79  m_pData=NULL;
80  m_width=0;
81  m_height=0;
82  m_depth=0;
83  m_format=ImageI::e_none;
84  }
85 
86  BWORD m_created;
87  U32 m_width;
88  U32 m_height;
89  U32 m_depth;
90  ImageI::Format m_format;
91  void* m_pData;
92  };
93 
94  Array<ImageRaw::Buffer> m_buffers;
95  I32 m_selected;
96 
97 static
98 const U32 m_bytes[4];
99 };
100 
101 } /* namespace ext */
102 } /* namespace fe */
103 
104 #endif /* __image_ImageRaw_h__ */
Image handling using raw buffers.
Definition: ImageRaw.h:23
kernel
Definition: namespace.dox:3
virtual U32 depth(void) const
return the Z dimension of the image
Definition: ImageRaw.h:50
virtual ImageI::Format format(void) const
return the format for the selected image
Definition: ImageRaw.h:36
General functionality for image support.
Definition: ImageCommon.h:20
virtual I32 selected(void) const
return the selected image ID
Definition: ImageRaw.h:32
virtual U32 width(void) const
return the X dimension of the image
Definition: ImageRaw.h:44
virtual void * raw(void) const
return the raw byte buffer of the image
Definition: ImageRaw.h:53
virtual U32 height(void) const
return the Y dimension of the image
Definition: ImageRaw.h:47