34 #include "loaders/SILLYPNGImageContext.h" 36 #ifndef SILLY_OPT_INLINE 38 #include "loaders/SILLYPNGImageContext.icpp" 46 int PNGImageContext::read(png_bytep data, png_size_t length)
51 if (d_offset + length > d_data->
getSize())
53 memcpy(data, d_data->
getDataPtr() + d_offset, length);
59 PNGImageContext::PNGImageContext(DataSource* data)
60 :
ImageContext(0,0), d_offset(0), d_data(data), d_png_ptr(0), d_info_ptr(0)
65 PNGImageContext::~PNGImageContext()
68 png_destroy_read_struct(&d_png_ptr, &d_info_ptr, 0);
70 png_destroy_read_struct(&d_png_ptr, 0, 0);
74 void PNGImageContext::setImageSize()
76 setWidth(png_get_image_width(d_png_ptr, d_info_ptr));
77 setHeight(png_get_image_height(d_png_ptr, d_info_ptr));
virtual size_t getSize() const =0
Return the size of the data.
ImageContext(size_t width, size_t height)
Constructor.
Simple Image Loading LibrarY namespace.
virtual const byte * getDataPtr() const =0
Get raw access to the image data.