52 typedef enum ChannelOrder {
RGBA,
BGRA,
ARGB,
ABGR,
RGBX,
BGRX,
XRGB,
XBGR,
RGB,
BGR,
Y,
YA,
CUSTOM }
ChannelOrder;
129 template<
typename SD,
typename TD, ColorModel TCS>
131 template<
typename SD,
typename TD>
133 template<
typename SD>
136 template<
typename SD,
typename TD, ImageIo::ColorModel TCM,
bool ALPHA>
138 template<
typename SD,
typename TD, ColorModel TCM,
bool ALPHA>
182 #if defined( CINDER_WINRT )
185 void loadImageAsync(
const fs::path path, std::function<
void (
ImageSourceRef)> callback, ImageSource::Options options = ImageSource::Options(),
std::string extension =
"" );
262 std::map<std::string, std::multimap<int32_t,SourceCreationFunc> > mSources;
263 std::map<int32_t, SourceCreationFunc> mGenericSources;
264 std::map<std::string, std::multimap<int32_t,std::pair<TargetCreationFunc,std::string> > > mTargets;
267 static ImageIoRegistrar::Inst* instance();
275 (
void) register_object;
278 struct exec_register {
284 static exec_register register_object;
287 template<
typename D>
typename ImageIoRegistrant<D>::exec_register ImageIoRegistrant<D>::register_object;
289 #define REGISTER_IMAGE_IO_FILE_HANDLER( TYPE ) \
290 struct ImageIoRegisterT##TYPE : public ImageIoRegistrant<TYPE> { \
291 ImageIoRegisterT##TYPE() : ImageIoRegistrant<TYPE>() {} \
ImageIoException(const std::string &description="")
Definition: ImageIo.h:203
int8_t mRowFuncSourceGray
Definition: ImageIo.h:147
float mPixelAspectRatio
Definition: ImageIo.h:141
void writeImage(DataTargetRef dataTarget, const ImageSourceRef &imageSource, ImageTarget::Options options=ImageTarget::Options(), std::string extension="")
Writes imageSource to dataTarget. Optional extension parameter allows specification of a file type...
Definition: ImageIo.cpp:430
ImageIoExceptionUnknownExtension(const std::string &description="")
Definition: ImageIo.h:221
ChannelOrder
Definition: ImageIo.h:52
static void translateRgbColorModelToOffsets(ChannelOrder channelOrder, int8_t *red, int8_t *green, int8_t *blue, int8_t *alpha, int8_t *inc)
Definition: ImageIo.cpp:59
Options & throwOnFirstException(bool b=true)
If an exception occurs, enabling this will prevent any attempts at using other handlers to load the i...
Definition: ImageIo.h:99
Definition: ImageIo.h:240
int8_t mRowFuncTargetGreen
Definition: ImageIo.h:146
GLclampf green
Definition: GLee.h:951
ColorModel getColorModel() const
Definition: ImageIo.h:56
static int8_t channelOrderNumChannels(ChannelOrder channelOrder)
Definition: ImageIo.cpp:87
RowFunc setupRowFuncForTypes(ImageTargetRef target)
Definition: ImageIo.cpp:320
int8_t mRowFuncTargetRed
Definition: ImageIo.h:146
static void registerTargetType(std::string extension, TargetCreationFunc func, int32_t priority, const std::string &extensionData)
Definition: ImageIo.cpp:553
int8_t mRowFuncSourceBlue
Definition: ImageIo.h:145
Options & quality(float quality)
Definition: ImageIo.h:163
int32_t getWidth() const
Definition: ImageIo.h:54
int8_t mRowFuncSourceRed
Definition: ImageIo.h:145
Definition: ImageIo.h:229
GLsizei const GLchar ** string
Definition: GLee.h:2427
static void translateGrayColorModelToOffsets(ChannelOrder channelOrder, int8_t *gray, int8_t *alpha, int8_t *inc)
Definition: ImageIo.cpp:77
float getQuality() const
Definition: ImageIo.h:168
ImageIoExceptionIllegalChannelOrder(const std::string &description="")
Definition: ImageIo.h:236
ImageSourceRef loadImage(const fs::path &path, ImageSource::Options options=ImageSource::Options(), std::string extension="")
Loads an image from the file path path. Optional extension parameter allows specification of a file t...
Definition: ImageIo.cpp:405
int8_t mRowFuncTargetInc
Definition: ImageIo.h:148
bool mThrowOnFirstException
Definition: ImageIo.h:108
virtual ~ImageTarget()
Definition: ImageIo.h:153
GLenum GLsizei width
Definition: GLee.h:969
Definition: ImageIo.h:224
GLuint index
Definition: GLee.h:2259
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:1011
Options()
Definition: ImageIo.h:94
bool mIsPremultiplied
Definition: ImageIo.h:142
ChannelOrder getChannelOrder() const
Definition: ImageIo.h:58
void setChannelOrder(ChannelOrder aChannelOrder)
Definition: ImageIo.h:78
GLenum target
Definition: GLee.h:13607
typedef void(APIENTRYP GLEEPFNGLBLENDCOLORPROC)(GLclampf red
int32_t getHeight() const
Definition: ImageIo.h:55
Definition: ImageIo.h:151
std::shared_ptr< class ImageLoader > ImageLoaderRef
Definition: ImageIo.h:41
DataType getDataType() const
Definition: ImageIo.h:57
void setupRowFuncRgbSource(ImageTargetRef target)
Definition: ImageIo.cpp:269
bool mColorModelDefault
Definition: ImageIo.h:174
Definition: ImageIo.h:209
std::shared_ptr< class ImageTarget > ImageTargetRef
Definition: ImageIo.h:42
ImageIo()
Definition: ImageIo.cpp:54
ImageIo::ColorModel getColorModel() const
Definition: ImageIo.h:170
Definition: ImageIo.h:273
RowFunc setupRowFuncForSourceType(ImageTargetRef target)
Definition: ImageIo.cpp:336
RowFunc setupRowFunc(ImageTargetRef target)
Definition: ImageIo.cpp:354
int32_t mHeight
Definition: ImageIo.h:80
GLenum GLenum GLvoid * row
Definition: GLee.h:1089
void rowFuncSourceGray(ImageTargetRef target, int32_t row, const void *data)
Definition: ImageIo.cpp:218
virtual void setRow(int32_t row, const void *data)
Definition: ImageIo.h:156
DataType
Definition: ImageIo.h:48
static bool channelOrderHasAlpha(ChannelOrder channelOrder)
Definition: ImageIo.cpp:107
Definition: ImageIo.h:201
int8_t mRowFuncTargetBlue
Definition: ImageIo.h:146
virtual const char * what() const
Definition: ImageIo.h:204
ColorModel
Definition: ImageIo.h:47
GLclampf GLclampf blue
Definition: GLee.h:951
Definition: ImageIo.h:159
void setDataType(DataType aDataType)
Definition: ImageIo.h:77
ImageIo::ColorModel mColorModel
Definition: ImageIo.h:175
ImageSourceRef(* SourceCreationFunc)(DataSourceRef, ImageSource::Options options)
Definition: ImageIo.h:241
DataType mDataType
Definition: ImageIo.h:82
void setCustomPixelInc(int8_t customPixelInc)
Allows declaration of a pixel increment different from what its ColorModel would imply. For example a non-planar Channel.
Definition: ImageIo.h:124
int8_t mRowFuncSourceAlpha
Definition: ImageIo.h:145
virtual bool hasAlpha() const
Definition: ImageIo.h:59
GLenum GLsizei GLsizei height
Definition: GLee.h:1029
GLclampf GLclampf GLclampf alpha
Definition: GLee.h:951
std::shared_ptr< class ImageTargetFile > ImageTargetFileRef
Definition: ImageIo.h:43
int8_t mRowFuncSourceInc
Definition: ImageIo.h:148
float getPixelAspectRatio() const
Returns the aspect ratio of individual pixels to accommodate non-square pixels.
Definition: ImageIo.cpp:155
static void registerSourceType(std::string extension, SourceCreationFunc func, int32_t priority=2)
Definition: ImageIo.cpp:527
Options & colorModel(ImageIo::ColorModel cm)
Definition: ImageIo.h:164
static ImageTargetRef createTarget(DataTargetRef dataTarget, ImageSourceRef imageSource, ImageTarget::Options options, std::string extension)
Definition: ImageIo.cpp:467
int32_t mWidth
Definition: ImageIo.h:80
int8_t mRowFuncTargetGray
Definition: ImageIo.h:147
Definition: ImageIo.h:219
bool isPremultiplied() const
Returns whether the ImageSource's color data has been premultiplied by its alpha channel.
Definition: ImageIo.cpp:160
ColorModel mColorModel
Definition: ImageIo.h:81
ChannelOrder mChannelOrder
Definition: ImageIo.h:83
void rowFuncSourceRgb(ImageTargetRef target, int32_t row, const void *data)
Definition: ImageIo.cpp:167
void setupRowFuncGraySource(ImageTargetRef target)
Definition: ImageIo.cpp:278
ChannelType
Definition: ImageIo.h:49
std::string mDescription
Definition: ImageIo.h:206
static ImageSourceRef createSource(DataSourceRef dataSource, ImageSource::Options options, std::string extension)
Definition: ImageIo.cpp:486
Optional parameters passed when creating an Image.
Definition: ImageIo.h:92
virtual void finalize()
Definition: ImageIo.h:157
GLboolean GLboolean GLboolean b
Definition: GLee.h:2964
static void registerSourceGeneric(SourceCreationFunc func, int32_t priority=2)
Definition: ImageIo.cpp:574
int8_t mRowFuncSourceGreen
Definition: ImageIo.h:145
Definition: ImageIo.h:234
bool isColorModelDefault() const
Definition: ImageIo.h:169
virtual void load(ImageTargetRef target)=0
void(ImageSource::* RowFunc)(ImageTargetRef, int32_t, const void *)
Definition: ImageIo.h:118
Definition: ImageIo.h:214
void setPixelAspectRatio(float pixelAspectRatio)
Definition: ImageIo.h:121
ImageTargetRef(* TargetCreationFunc)(DataTargetRef, ImageSourceRef, ImageTarget::Options options, const std::string &)
Definition: ImageIo.h:242
void setColorModel(ColorModel colorModel)
Definition: ImageIo.h:76
virtual void * getRowPointer(int32_t row)=0
static uint8_t dataTypeBytes(DataType dataType)
Definition: ImageIo.cpp:121
std::shared_ptr< class DataTarget > DataTargetRef
Definition: DataTarget.h:33
RowFunc setupRowFuncForTypesAndTargetColorModel(ImageTargetRef target)
Definition: ImageIo.cpp:288
int32_t mIndex
Definition: ImageIo.h:107
ImageIoExceptionFailedLoad(const std::string &description="")
Definition: ImageIo.h:211
int8_t mRowFuncTargetAlpha
Definition: ImageIo.h:146
virtual ~ImageSource()
Definition: ImageIo.h:89
bool getThrowOnFirstException()
Returns whether throwOnFirstException() is enabled or not.
Definition: ImageIo.h:104
Definition: Exception.h:32
static std::vector< std::string > getLoadExtensions()
Definition: ImageIo.cpp:132
void setPremultiplied(bool premult=true)
Definition: ImageIo.h:122
ImageSource()
Definition: ImageIo.h:88
Options & index(int32_t index)
Specifies an image index for multi-part images, like animated GIFs.
Definition: ImageIo.h:97
int32_t getIndex() const
Returns image index.
Definition: ImageIo.h:102
ImageIoRegistrant()
Definition: ImageIo.h:274
std::shared_ptr< class ImageSource > ImageSourceRef
Definition: Channel.h:33
void setSize(int32_t width, int32_t height)
Definition: ImageIo.h:75
ImageIoExceptionFailedWrite(const std::string &description="")
Definition: ImageIo.h:216
std::shared_ptr< class DataSource > DataSourceRef
Definition: DataSource.h:35
static std::vector< std::string > getWriteExtensions()
Definition: ImageIo.cpp:142
GLclampf f
Definition: GLee.h:15307
Options()
Definition: ImageIo.h:161
int8_t mCustomPixelInc
Definition: ImageIo.h:143
float mQuality
Definition: ImageIo.h:173
ImageIoExceptionIllegalColorModel(const std::string &description="")
Definition: ImageIo.h:226
ImageTarget()
Definition: ImageIo.h:179
void setColorModelDefault()
Definition: ImageIo.h:166
ImageIoExceptionIllegalDataType(const std::string &description="")
Definition: ImageIo.h:231