Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ImageSourcePng.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010, The Barbarian Group
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification, are permitted provided that
6  the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and
9  the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
11  the following disclaimer in the documentation and/or other materials provided with the distribution.
12 
13  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
14  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
15  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
16  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
17  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
18  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
19  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20  POSSIBILITY OF SUCH DAMAGE.
21 */
22 
23 #pragma once
24 
25 #include "cinder/Cinder.h"
26 #include "cinder/ImageIo.h"
27 #include "cinder/Exception.h"
28 
29 struct png_struct_def;
30 typedef struct png_info_def png_info;
31 
32 namespace cinder {
33 
34 struct ci_png_info;
35 
36 typedef std::shared_ptr<class ImageSourcePng> ImageSourcePngRef;
37 
38 class ImageSourcePng : public ImageSource {
39  public:
41  static ImageSourceRef createSourceRef( DataSourceRef dataSourceRef, ImageSource::Options options = ImageSource::Options() ) { return createRef( dataSourceRef, options ); }
43 
44  virtual void load( ImageTargetRef target );
45 
46  static void registerSelf();
47 
48  protected:
49  ImageSourcePng( DataSourceRef dataSourceRef, ImageSource::Options options );
50  bool loadHeader();
51 
52  std::shared_ptr<ci_png_info> mCiInfoPtr;
53  png_struct_def *mPngPtr;
55 };
56 
58 
60  public:
61  ImageSourcePngException( const std::string &description ) : ImageIoException( description ) {}
62 };
63 
64 } // namespace cinder
ImageSourcePngException(const std::string &description)
Definition: ImageSourcePng.h:61
~ImageSourcePng()
Definition: ImageSourcePng.cpp:160
static ImageSourcePngRef createRef(DataSourceRef dataSourceRef, ImageSource::Options options=ImageSource::Options())
Definition: ImageSourcePng.cpp:72
static void registerSelf()
Definition: ImageSourcePng.cpp:64
GLsizei const GLchar ** string
Definition: GLee.h:2427
bool loadHeader()
Definition: ImageSourcePng.cpp:102
static ImageSourceRef createSourceRef(DataSourceRef dataSourceRef, ImageSource::Options options=ImageSource::Options())
Definition: ImageSourcePng.h:41
png_struct_def * mPngPtr
Definition: ImageSourcePng.h:53
GLenum target
Definition: GLee.h:13607
std::shared_ptr< class ImageTarget > ImageTargetRef
Definition: ImageIo.h:42
Definition: ImageIo.h:201
std::shared_ptr< class ImageSourcePng > ImageSourcePngRef
Definition: ImageSourcePng.h:34
Definition: ImageSourcePng.h:59
Optional parameters passed when creating an Image.
Definition: ImageIo.h:92
#define REGISTER_IMAGE_IO_FILE_HANDLER(TYPE)
Definition: ImageIo.h:289
ImageSourcePng(DataSourceRef dataSourceRef, ImageSource::Options options)
Definition: ImageSourcePng.cpp:77
std::shared_ptr< ci_png_info > mCiInfoPtr
Definition: ImageSourcePng.h:52
struct png_info_def png_info
Definition: ImageSourcePng.h:30
png_info * mInfoPtr
Definition: ImageSourcePng.h:54
std::shared_ptr< class ImageSource > ImageSourceRef
Definition: Channel.h:33
std::shared_ptr< class DataSource > DataSourceRef
Definition: DataSource.h:35
virtual void load(ImageTargetRef target)
Definition: ImageSourcePng.cpp:166
Definition: ImageIo.h:86
Definition: ImageSourcePng.h:38