1 |
/* |
/* |
2 |
$Id$ |
$Id$ |
3 |
|
|
4 |
Copyright (C) 1999/2000/2001/2002 Alexandre Courbot |
Copyright (C) 1999/2000/2001/2002/2004 Alexandre Courbot |
5 |
Part of the Adonthell Project http://adonthell.linuxgames.com |
Part of the Adonthell Project http://adonthell.linuxgames.com |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
44 |
{ |
{ |
45 |
} |
} |
46 |
|
|
47 |
image::image (u_int16 l, u_int16 h) : surface () |
image::image (u_int16 l, u_int16 h, bool mode) : surface (mode) |
48 |
{ |
{ |
49 |
resize (l, h); |
resize (l, h); |
50 |
} |
} |
51 |
|
|
52 |
|
image::image (SDL_Surface *s, const SDL_Color & color) : surface (false) |
53 |
|
{ |
54 |
|
if (screen::dbl_mode ()) { |
55 |
|
set_length (s->w >> 1); |
56 |
|
set_height (s->h >> 1); |
57 |
|
} else { |
58 |
|
set_length (s->w); |
59 |
|
set_height (s->h); |
60 |
|
} |
61 |
|
|
62 |
|
vis = SDL_DisplayFormat (s); |
63 |
|
SDL_SetColorKey (vis, SDL_SRCCOLORKEY | SDL_RLEACCEL, |
64 |
|
SDL_MapRGB (vis->format, color.r, color.g, color.b)); |
65 |
|
SDL_FreeSurface (s); |
66 |
|
changed = false; |
67 |
|
} |
68 |
|
|
69 |
image::~image () |
image::~image () |
70 |
{ |
{ |
71 |
} |
} |
221 |
image * imt; |
image * imt; |
222 |
SDL_Surface * toconvert; |
SDL_Surface * toconvert; |
223 |
|
|
224 |
if (screen::dblmode) |
if (dbl_mode) |
225 |
{ |
{ |
226 |
imt = new image(); |
imt = new image(); |
227 |
imt->double_size(*this); |
imt->double_size(*this); |
247 |
|
|
248 |
SDL_FreeSurface (temp); |
SDL_FreeSurface (temp); |
249 |
SDL_FreeSurface (tmp2); |
SDL_FreeSurface (tmp2); |
250 |
if (screen::dblmode) delete imt; |
if (dbl_mode) delete imt; |
251 |
return 0; |
return 0; |
252 |
} |
} |
253 |
|
|
271 |
|
|
272 |
SDL_Surface * temp; |
SDL_Surface * temp; |
273 |
|
|
274 |
if (screen::dblmode) |
if (dbl_mode) |
275 |
{ |
{ |
276 |
image imt; |
image imt; |
277 |
imt.half_size(*this); |
imt.half_size(*this); |
355 |
u_int8 ir, ig, ib; |
u_int8 ir, ig, ib; |
356 |
u_int32 temp = 0; |
u_int32 temp = 0; |
357 |
|
|
358 |
resize (src.length (), src.height ()); |
if (screen::dbl_mode () && !dbl_mode) resize (src.length () << 1, src.height () << 1); |
359 |
|
else resize (src.length (), src.height ()); |
360 |
|
|
361 |
lock (); |
lock (); |
362 |
src.lock (); |
src.lock (); |
363 |
for (j = 0; j < height (); j++) |
for (j = 0; j < height (); j++) |
405 |
R_MASK, G_MASK, |
R_MASK, G_MASK, |
406 |
B_MASK, 0); |
B_MASK, 0); |
407 |
vis = SDL_DisplayFormat (tmp2); |
vis = SDL_DisplayFormat (tmp2); |
408 |
if (screen::dblmode) |
if (dbl_mode) |
409 |
{ |
{ |
410 |
image imt; |
image imt; |
411 |
imt.double_size(*this); |
imt.double_size(*this); |