18 #include <SDL_image.h>
30 timage::timage(Uint16
w, Uint16
h)
44 clip_ = create_gpu_rect(0, 0, w, h);
47 throw tgpu_exception(
"Failed to construct timage object.",
true);
50 static SDL_Color black = {0, 0, 0, 0};
70 throw tgpu_exception(
"Failed to construct timage object.",
true);
74 static SDL_Color black = {0, 0, 0, 0};
96 if (!source.nullptr()) {
97 throw tgpu_exception(
"Failed to construct timage object.",
true);
102 static SDL_Color black = {0, 0, 0, 0};
107 timage::timage(SDL_Surface *source)
124 if (source !=
nullptr) {
125 throw tgpu_exception(
"Failed to construct timage object.",
true);
130 static SDL_Color black = {0, 0, 0, 0};
153 sdl::timage::~timage()
157 if (
image_->refcount == 0) {
163 timage::timage(
const timage &
texture)
165 , rotation_(texture.rotation_)
166 , hscale_(texture.hscale_)
167 , vscale_(texture.vscale_)
168 , clip_(texture.clip_)
169 , red_mod_(texture.red_mod_)
170 , green_mod_(texture.green_mod_)
171 , blue_mod_(texture.blue_mod_)
172 , alpha_mod_(texture.alpha_mod_)
173 , hwrap_(texture.hwrap_)
174 , vwrap_(texture.vwrap_)
175 , smooth_(texture.smooth_)
176 , submerge_(texture.submerge_)
177 , effects_(texture.effects_)
184 timage &timage::operator =(
const timage &texture)
186 if (&texture !=
this) {
188 new (
this) timage(texture);
198 video.set_texture_color_modulation(red_mod_, green_mod_, blue_mod_, alpha_mod_);
199 video.set_texture_submerge(
float(submerge_));
200 video.set_texture_effects(effects_);
202 rotation_, hscale_, vscale_);
205 void timage::set_rotation(
float rotation)
207 rotation_ = rotation;
210 float timage::rotation()
const
215 void timage::set_hscale(
float factor)
220 void timage::set_vscale(
float factor)
225 void timage::set_scale(
float hfactor,
float vfactor)
231 float timage::hscale()
const
236 float timage::vscale()
const
241 void timage::set_smooth_scaling(
bool use_smooth)
243 smooth_ = use_smooth;
246 bool timage::smooth_scaling()
const
253 return clip_.w * hscale_;
258 return clip_.h * vscale_;
261 Uint16 timage::base_width()
const
266 Uint16 timage::base_height()
const
271 void timage::set_clip(
const SDL_Rect &rect)
279 SDL_Rect timage::clip()
const
290 void timage::set_alpha(
int alpha)
300 void timage::set_color_mod(
int r,
int g,
int b)
307 int timage::red_mod()
const
312 int timage::green_mod()
const
317 int timage::blue_mod()
const
348 void timage::set_submerge(
double val)
353 double timage::submerge()
const
358 void timage::set_effects(
int effects)
363 int timage::effects()
const
368 bool timage::nullptr()
const
373 timage timage::clone()
const
377 res.set_alpha(
alpha());
378 res.set_clip(clip());
379 res.set_color_mod(red_mod(), green_mod(), blue_mod());
380 res.set_wrap(hwrap(), vwrap());
381 res.set_rotation(rotation());
382 res.set_scale(hscale(), vscale());
383 res.set_smooth_scaling(smooth_scaling());
384 res.set_submerge(submerge());
385 res.set_effects(effects());
GPU_Image * GPU_CopyImageFromSurface(SDL_Surface *surface)
void GPU_SetColor(GPU_Image *image, SDL_Color *color)
surface image_
The image is cached in this surface.
GLuint const GLfloat * val
GLenum GLenum GLuint texture
void GPU_BlitTransform(GPU_Image *image, GPU_Rect *src_rect, GPU_Target *target, float x, float y, float angle, float scaleX, float scaleY)
GLint GLint GLint GLint GLint GLint y
GLdouble GLdouble GLdouble b
GLubyte GLubyte GLubyte GLubyte w
GPU_Image * GPU_LoadImage(const char *filename)
GLclampf GLclampf GLclampf alpha
void draw(surface screen)
GPU_Image * GPU_CopyImage(GPU_Image *image)
void GPU_SetImageFilter(GPU_Image *image, GPU_FilterEnum filter)
Contains a wrapper class for the GPU_Image class.
GLfloat GLfloat GLfloat GLfloat h
GLint GLint GLint GLint GLint x
GPU_Image * GPU_CreateImage(Uint16 w, Uint16 h, GPU_FormatEnum format)
GLdouble GLdouble GLdouble r
void GPU_SetWrapMode(GPU_Image *image, GPU_WrapEnum wrap_mode_x, GPU_WrapEnum wrap_mode_y)
Contains a basic exception class for SDL operations.
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
Contains the SDL_Rect helper code.
void GPU_FreeImage(GPU_Image *image)
GLint GLint GLint GLint GLint GLint GLsizei width
GLsizei const GLcharARB ** string
GLsizei GLsizei GLchar * source