imageloader.h File Reference

Go to the documentation of this file. Source: include/ffw/media/imageloader.h

/* This file is part of FineFramework project */
#ifndef FFW_MEDIA_IMAGE_LOADER
#define FFW_MEDIA_IMAGE_LOADER

#include <string>
#include "config.h"
#include "imagebuffer.h"
#include "swapwrapper.h"

#pragma warning( push )
#pragma warning( disable : 4275)

namespace ffw{
    class FFW_API ImageReader: public ImageFormat {
    public:
        ImageReader();
        virtual ~ImageReader();
        virtual void close() = 0;
        virtual size_t readRow(void* dest) = 0;
        virtual bool getMipMap(int level);
        bool readAll(void* dest);
        bool readAll(ffw::ImageBuffer& image);
        inline bool eof() const {
            return row >= height;
        }
        inline operator bool() const {
            return loaded;
        }
        inline int getRowOffset() const {
            return row;
        }
        inline bool isOpen() const {
            return loaded;
        }
        inline int getNumOfMipMaps() const {
            return mipmaps;
        }
        inline int getMipMapOffset() const {
            return mipmapOffset;
        }
        inline size_t getAllocationSize() const {
            return ImageFormat::getAllocationSize(mipmaps);
        }
    protected:
        bool loaded;
        int row;
        int mipmapOffset;
        int mipmaps;
    };
};

#pragma warning( pop ) 
#endif