/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson
*
* Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
* Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a//
* _Qhm`] _f "'c 1!5m
* Visit: http://guichan.darkbits.org )Qk
ws?a-?' ._/L #'
* binary forms, with or without )4d[#7r, . ' )d`)[
* modification, are permitted provided _Q-5'5W..j/?' -?!\)cam'
* that the following conditions are met: j<. a J@\
* this list of conditions and the j(]1u
#include "guisan/color.hpp"
#include "guisan/platform.hpp"
#include "guisan/image.hpp"
namespace gcn
{
/**
* SDL implementation of Image.
*/
class GCN_EXTENSION_DECLSPEC SDLImage : public Image
{
public:
/**
* Constructor. Load an image from an SDL surface.
*
* NOTE: The functions getPixel and putPixel are only guaranteed to work
* before an image has been converted to display format.
*
* @param surface the surface from which to load.
* @param autoFree true if the surface should automatically be deleted.
* @param renderer renderer object to create the texture (last parameter to avoid breaking stuff)
*/
SDLImage(SDL_Surface* surface, bool autoFree, SDL_Renderer* renderer = NULL);
/**
* Destructor.
*/
virtual ~SDLImage();
/**
* Gets the SDL surface for the image.
*
* @return the SDL surface for the image.
*/
virtual SDL_Surface* getSurface() const;
/**
* Gets the SDL texture for the image.
*
* @return the SDL texture for the image.
*/
virtual SDL_Texture* getTexture() const;
// Inherited from Image
virtual void free();
virtual int getWidth() const;
virtual int getHeight() const;
virtual Color getPixel(int x, int y);
virtual void putPixel(int x, int y, const Color& color);
virtual void convertToDisplayFormat();
protected:
SDL_Surface* mSurface;
SDL_Texture* mTexture = NULL;
SDL_Renderer* mRenderer = NULL;
bool mAutoFree;
};
}
#endif // end GCN_SDLIMAGE_HPP