Simple Image Loading LibrarY 0.1.0
SILLYImage.h
1
2/***********************************************************************
3 filename: SILLYImage.h
4 created: 10 Jun 2006
5 author: Olivier Delannoy
6
7 purpose: Image class definition
8*************************************************************************/
9/***************************************************************************
10 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining
13 * a copy of this software and associated documentation files (the
14 * "Software"), to deal in the Software without restriction, including
15 * without limitation the rights to use, copy, modify, merge, publish,
16 * distribute, sublicense, and/or sell copies of the Software, and to
17 * permit persons to whom the Software is furnished to do so, subject to
18 * the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be
21 * included in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29 * OTHER DEALINGS IN THE SOFTWARE.
30 ***************************************************************************/
31#ifndef _SILLYImage_h_
32#define _SILLYImage_h_
33#include "SILLYBase.h"
34#include "SILLYImageContext.h"
35#include "SILLYDataSource.h"
36#include "SILLYImageLoader.h"
37
38// Start of section namespace SILLY
39namespace SILLY
40{
41
46class SILLY_EXPORT Image
47{
48public:
55 Image(DataSource& data);
56
62
67 bool isValid() const;
68
69
76 bool loadImageHeader();
77
91 bool loadImageData(PixelFormat resultFormat = PF_RGBA, PixelOrigin origin = PO_TOP_LEFT);
92
97 size_t getWidth() const;
98
103 size_t getHeight() const;
104
110
116
120 const byte* getPixelsDataPtr() const;
125 size_t getPixelsDataSize() const;
130 const char* getLoaderIdentifierString() const;
131private:
132 bool allocate();
133
134private:
135
136 size_t d_bpp;
137 PixelFormat d_pfSource;
138 byte* d_pixels;
139 DataSource* d_data;
140 ImageContext* d_imageContext;
141 ImageLoader* d_imageLoader;
142
143 // Disabled operation
144 Image(Image&);
145 Image& operator=(Image&);
146};
147
148} // End of section namespace SILLY
149
150// Inclue inline function when needed
151#ifdef SILLY_OPT_INLINE
152#include "SILLYImage.icpp"
153#endif
154
155#endif // end of guard _SILLYImage_h_
Simple Image Loading LibrarY namespace.
PixelFormat
List all pixel format supported.
Definition SILLYBase.h:60
PixelOrigin
List all pixel origin supported.
Definition SILLYBase.h:71
This is an abstract class used to provide data to the loader.
Image is the main user class of the library.
Definition SILLYImage.h:47
PixelFormat getSourcePixelFormat() const
Retrieve the pixel format used for the image storage.
const char * getLoaderIdentifierString() const
Get Image loader identifier string.
const byte * getPixelsDataPtr() const
Get a pointer to the pixels data.
bool isValid() const
Return true if the image is valid after its loading.
size_t getPixelsDataSize() const
Get the size of the pixel buffer.
~Image()
Destructor.
size_t getWidth() const
Retrieve the width of the image.
PixelFormat getPixelFormat() const
Retrieve the pixel format of the resulting image.
size_t getHeight() const
Retrieve the height of the image.
Store the data needed by an ImageLoader object during the parsing of an image.
This is an abstract class that define the interface of all image loader.