63 Image(name, surface) {
68 Image(data, width, height) {
73 Image(name, data, width, height) {
107 if (rect.
right() < 0 || rect.
x >
static_cast<int32_t
>(target->w) ||
108 rect.
bottom() < 0 || rect.
y >
static_cast<int32_t
>(target->h)) {
120 srcRect.x = tmpRect.
x;
121 srcRect.y = tmpRect.
y;
122 srcRect.w = tmpRect.
w;
123 srcRect.h = tmpRect.
h;
137 SDL_SetTextureColorMod(
m_texture, rgb[0], rgb[1], rgb[2]);
138 SDL_SetTextureAlphaMod(
m_texture, rgb[3]);
140 SDL_SetTextureColorMod(
m_texture, 255, 255, 255);
144 SDL_SetRenderDrawColor(renderer, 255, 255, 255, alpha);
146 if (SDL_RenderCopy(renderer,
m_texture, &srcRect, &tarRect) != 0) {
147 throw SDLException(SDL_GetError());
174 m_texture = SDL_CreateTextureFromSurface(renderer, surface);
virtual ImagePtr create(IResourceLoader *loader=0)
Creates a blank Image but does not load it immediately.
void reset(SDL_Surface *surface)
Resets the image to default values (including the x and y shift values), frees the current surface an...
virtual bool exists(const std::string &name)
Checks to see if an Image exists.
virtual ResourceState getState()
const SDL_Color & getColorKey() const
Gets the global colorkey setting.
T h
Height of the rectangle.
The main class of the SDL-based renderer.
The SDL implementation of the Image base class.
void setTexture(SDL_Texture *texture)
static Logger _log(LM_AUDIO)
SDL_Texture * getTexture()
static RenderBackend * instance()
virtual void render(const Rect &rect, uint8_t alpha=255, uint8_t const *rgb=0)
Renders itself to the current render target (main screen or attached destination image) at the rectan...
SDL_Surface * getSurface()
virtual const std::string & getName()
T right() const
The X coordinate of the right edge.
virtual void setState(const ResourceState &state)
SDL_Surface * getRenderTargetSurface()
Returns currently attached render surface.
virtual void invalidate()
Invalidates the Image causing it to be reset or re-loaded.
virtual void forceLoadInternal()
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.
virtual void setSurface(SDL_Surface *surface)
This frees the current suface and replaces it with the surface passed in the parameter (which can be ...
T * get() const
allows direct access to underlying pointer
SDLImage(IResourceLoader *loader=0)
virtual void useSharedImage(const ImagePtr &shared, const Rect ®ion)
After this call all image data will be taken from the given image and its subregion.
T w
Width of the rectangle.
T bottom() const
The Y coordinate of the bottom edge.