Free Electron
ImageSDL.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 __sdl_ImageSDL_h__
8 #define __sdl_ImageSDL_h__
9 namespace fe
10 {
11 namespace ext
12 {
13 
14 /**************************************************************************//**
15  @brief Image handling using SDL
16 
17  @ingroup sdl
18 
19  http://www.libsdl.org
20 *//***************************************************************************/
21 class FE_DL_EXPORT ImageSDL: public ImageCommon,
22  public Initialize<ImageSDL>
23 {
24  public:
25  ImageSDL(void);
26 virtual ~ImageSDL(void);
27 
28  void initialize(void);
29 
30  //* As ImageI
31 virtual I32 createSelect(void);
32 virtual I32 loadSelect(String filename);
33 virtual I32 interpretSelect(void* data,U32 size) { return 0; }
34 virtual I32 interpretSelect(String a_source) { return 0; }
35 virtual BWORD save(String filename);
36 virtual void select(I32 id);
37 virtual I32 selected(void) const { return m_selected; }
38 virtual void unload(I32 id);
39 
40 virtual void setFormat(ImageI::Format set);
41 virtual ImageI::Format format(void) const;
42 
43 virtual void resize(U32 width,U32 height,U32 depth);
44 virtual void replaceRegion(U32 x,U32 y,U32 z,
45  U32 width,U32 height,U32 depth,void* data);
46 
47 virtual U32 width(void) const;
48 virtual U32 height(void) const;
49 virtual U32 depth(void) const;
50 virtual void* raw(void) const;
51 
52 virtual U32 regionCount(void) const { return 0; }
53 virtual String regionName(U32 a_regionIndex) const { return ""; }
54 virtual Box2i regionBox(String a_regionName) const { return Box2i(); }
55 virtual String pickRegion(I32 a_x,I32 a_y) const { return ""; }
56 
57 
58  private:
59  void createSurface(ImageI::Format format,U32 width,U32 height);
60 
61  sp<Component> m_spContextSDL;
62 
63  SDL_Surface* m_pCurrentSurface;
64  I32 m_selected;
65 
66  U32 m_nextID;
67  std::map<U32,SDL_Surface*> m_surfaceMap;
68 };
69 
70 } /* namespace ext */
71 } /* namespace fe */
72 
73 #endif /* __sdl_ImageSDL_h__ */
virtual I32 interpretSelect(String a_source)
create an image from text, returning its ID
Definition: ImageSDL.h:34
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
General functionality for image support.
Definition: ImageCommon.h:20
Automatically reference-counted string container.
Definition: String.h:128
virtual I32 interpretSelect(void *data, U32 size)
create an image from raw bytes, returning its ID
Definition: ImageSDL.h:33
virtual I32 selected(void) const
return the selected image ID
Definition: ImageSDL.h:37
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
Image handling using SDL.
Definition: ImageSDL.h:21