-#ifdef WITH_LIBPNG
- if(priv->data)
- return priv->fmt;
-#endif
-#ifdef WITH_DEVIL
- if(priv->id)
- {
- ilBindImage(priv->id);
- switch(ilGetInteger(IL_IMAGE_FORMAT))
- {
- case IL_COLOR_INDEX: return COLOR_INDEX;
- case IL_LUMINANCE: return LUMINANCE;
- case IL_LUMINANCE_ALPHA: return LUMINANCE_ALPHA;
- case IL_RGB: return RGB;
- case IL_RGBA: return RGBA;
- case IL_BGR: return BGR;
- case IL_BGRA: return BGRA;
- // XXX bad, should throw when loading
- default: throw invalid_argument("unknown pixel format in image");
- }
- }
-#endif
- return RGB;
-}
-
-unsigned Image::get_width() const
-{
-#ifdef WITH_LIBPNG
- if(priv->data)
- return priv->width;
-#endif
-#ifdef WITH_DEVIL
- if(priv->id)
- {
- ilBindImage(priv->id);
- return ilGetInteger(IL_IMAGE_WIDTH);
- }
-#endif
- return 0;
-}
-
-unsigned Image::get_height() const
-{
-#ifdef WITH_LIBPNG
- if(priv->data)
- return priv->height;
-#endif
-#ifdef WITH_DEVIL
- if(priv->id)
- {
- ilBindImage(priv->id);
- return ilGetInteger(IL_IMAGE_HEIGHT);
- }
-#endif
- return 0;
-}
-
-const void *Image::get_data() const
-{
-#ifdef WITH_LIBPNG
- if(priv->data)
- return priv->data;
-#endif
-#ifdef WITH_DEVIL
- if(priv->id)
- {
- ilBindImage(priv->id);
- return ilGetData();
- }
-#endif
- return 0;