22 #ifndef FIFE_VIDEO_IMAGE_H 23 #define FIFE_VIDEO_IMAGE_H 30 #define PNG_SKIP_SETJMP_CHECK 59 Image(SDL_Surface* surface);
60 Image(
const std::string& name, SDL_Surface* surface);
104 virtual void setSurface(SDL_Surface* surface) = 0;
108 void saveImage(
const std::string& filename);
112 static void saveAsPng(
const std::string& filename,
const SDL_Surface& surface);
172 void reset(SDL_Surface* surface);
std::string createUniqueImageName()
Image(IResourceLoader *loader=0)
Constructor.
void reset(SDL_Surface *surface)
Resets the image to default values (including the x and y shift values), frees the current surface an...
virtual void renderZ(const Rect &rect, float vertexZ, const ImagePtr &overlay, uint8_t alpha=255, uint8_t const *rgb=0)
void saveImage(const std::string &filename)
Saves the image using given filename.
virtual void invalidate()=0
Invalidates the Image causing it to be reset or re-loaded.
static bool putPixel(SDL_Surface *surface, int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
void setXShift(int32_t xshift)
SDL_Surface * detachSurface()
Removes underlying SDL_Surface from the image (if exists) and returns this.
static void saveAsPng(const std::string &filename, const SDL_Surface &surface)
Saves the SDL_Surface to png format.
void getPixelRGBA(int32_t x, int32_t y, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *a)
int32_t getYShift() const
SharedPtr< Image > ImagePtr
virtual ~Image()
Destructor.
virtual void render(const Rect &rect, const ImagePtr &overlay, uint8_t alpha=255, uint8_t const *rgb=0)
SDL_Surface * getSurface()
virtual void copySubimage(uint32_t xoffset, uint32_t yoffset, const ImagePtr &img)
Copies given image into this one with respect to given offsets.
uint32_t getHeight() const
int32_t getXShift() const
virtual void setSurface(SDL_Surface *surface)=0
This frees the current suface and replaces it with the surface passed in the parameter (which can be ...
virtual void renderZ(const Rect &rect, float vertexZ, uint8_t alpha=255, uint8_t const *rgb=0)
bool isSharedImage() const
Returns true if this image shares data with another one.
virtual void render(const Rect &rect, uint8_t alpha=255, uint8_t const *rgb=0)=0
Renders itself to the current render target (main screen or attached destination image) at the rectan...
virtual void forceLoadInternal()=0
Forces to load the image into internal memory of GPU.
const Rect & getSubImageRect() const
Returns area of the image it occupies in the shared image.
const SDL_Surface * getSurface() const
virtual void useSharedImage(const ImagePtr &shared, const Rect ®ion)=0
After this call all image data will be taken from the given image and its subregion.
void setYShift(int32_t yshift)
virtual void renderZ(const Rect &rect, float vertexZ, uint8_t alpha=255, bool forceNewBatch=false, uint8_t const *rgb=0)
uint32_t getWidth() const