Free Electron
ImageI.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_ImageI_h__
8 #define __image_ImageI_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Image and texture handling
17 
18  @ingroup image
19 
20  For functions without an id argument, the currently selected image
21  is affected.
22 
23  Depth refers to 3D images, such as with voxels,
24  Bit planes refer to the magnitude of storage per element.
25 *//***************************************************************************/
26 class FE_DL_EXPORT ImageI:
27  virtual public Component,
28  public CastableAs<ImageI>
29 {
30  public:
31  enum Format
32  {
33  e_none,
34  e_colorindex,
35  e_rgb,
36  e_rgba
37  };
38 
39  /// @brief create an empty image, returning its ID
40 virtual I32 createSelect(void) =0;
41 
42  /// @brief load an image from file, returning its ID
43 virtual I32 loadSelect(String filename) =0;
44 
45  /// @brief create an image from raw bytes, returning its ID
46 virtual I32 interpretSelect(void* data,U32 size) =0;
47 
48  /// @brief create an image from text, returning its ID
49 virtual I32 interpretSelect(String a_source) =0;
50 
51  /// @brief save the selected image to file
52 virtual BWORD save(String filename) =0;
53 
54  /// @brief select an image for further access
55 virtual void select(I32 id) =0;
56 
57  /// @brief return the selected image ID
58 virtual I32 selected(void) const =0;
59 
60  /// @brief remove an image from memory
61 virtual void unload(I32 id) =0;
62 
63  /// @brief choose a format for the selected image
64 virtual void setFormat(ImageI::Format format) =0;
65 
66  /// @brief return the format for the selected image
67 virtual ImageI::Format format(void) const =0;
68 
69  /// @brief change the dimensions of the selcted image
70 virtual void resize(U32 width,U32 height,U32 depth) =0;
71 
72  /// @brief replace data in part of the image
73 virtual void replaceRegion(U32 x,U32 y,U32 z,
74  U32 width,U32 height,U32 depth,void* data) =0;
75 
76  /// @brief return the X dimension of the image
77 virtual U32 width(void) const =0;
78 
79  /// @brief return the Y dimension of the image
80 virtual U32 height(void) const =0;
81 
82  /// @brief return the Z dimension of the image
83 virtual U32 depth(void) const =0;
84 
85  /// @brief return the raw byte buffer of the image
86 virtual void* raw(void) const =0;
87 
88  /** @brief return the change serial number
89 
90  This number should increment each time the selected image
91  is change. */
92 virtual I32 serial(void) const =0;
93 
94 virtual U32 regionCount(void) const =0;
95 virtual String regionName(U32 a_regionIndex) const =0;
96 virtual Box2i regionBox(String a_regionName) const =0;
97 virtual String pickRegion(I32 a_x,I32 a_y) const =0;
98 };
99 
100 } /* namespace ext */
101 } /* namespace fe */
102 
103 #endif /* __image_ImageI_h__ */
Image and texture handling.
Definition: ImageI.h:26
kernel
Definition: namespace.dox:3
Automatically reference-counted string container.
Definition: String.h:128
Base for all interfacable components.
Definition: Component.h:20
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192