-#define COMPILE_DATE_STRING "[2003-01-26 00:14]"
+#define COMPILE_DATE_STRING "[2003-01-26 02:06]"
/* !!! TEST ONLY !!! */
+#if 1
+
+ {
+ Bitmap *tst_bitmap = graphic_info[IMG_SAND].bitmap;
+ Bitmap *tmp_bitmap = ZoomBitmap(tst_bitmap,
+ tst_bitmap->width / 2,
+ tst_bitmap->height / 2);
+
+ BlitBitmap(tmp_bitmap, tst_bitmap, 0, 0, 256, 224, 0, 448);
+
+ FreeBitmap(tmp_bitmap);
+ }
+
+#else
#ifdef TARGET_SDL
{
0, 0, 512, 448,
0, 448, 256, 224);
+#endif
#endif
}
return getpixel((BITMAP *)d, x, y);
}
+void AllegroZoomBitmap(Drawable src, Drawable dst,
+ int src_width, int src_height,
+ int dst_width, int dst_height)
+{
+ stretch_blit((BITMAP *)src, (BITMAP *)dst,
+ 0, 0, src_width, src_height, 0, 0, dst_width, dst_height);
+}
+
void MSDOSOpenAudio(void)
{
if (allegro_init_audio())
void AllegroDrawLine(Drawable, int, int, int, int, Pixel);
Pixel AllegroGetPixel(Drawable, int, int);
+void AllegroZoomBitmap(Drawable, Drawable, int, int, int, int);
+
void MSDOSOpenAudio(void);
void MSDOSCloseAudio(void);
/* http://www.ferzkopp.net/Software/SDL_gfx-2.0/index.html */
/* ========================================================================= */
-typedef struct
-{
- Uint8 r;
- Uint8 g;
- Uint8 b;
- Uint8 a;
-} tColorRGBA;
-
/*
-----------------------------------------------------------------------------
32 bit zoomer
-----------------------------------------------------------------------------
*/
+typedef struct
+{
+ Uint8 r;
+ Uint8 g;
+ Uint8 b;
+ Uint8 a;
+} tColorRGBA;
+
int zoomSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst)
{
int x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy;
-----------------------------------------------------------------------------
*/
-void zoomSurfaceSize(int width, int height, float zoom_x, float zoom_y,
- int *dst_width, int *dst_height)
-{
- const float value_limit = 0.001;
-
- /* sanity check zoom factors */
- if (zoom_x < value_limit)
- zoom_x = value_limit;
- if (zoom_y < value_limit)
- zoom_y = value_limit;
-
- /* calculate target size */
- *dst_width = (int) ((float) width * zoom_x);
- *dst_height = (int) ((float) height * zoom_y);
-
- if (*dst_width < 1)
- *dst_width = 1;
- if (*dst_height < 1)
- *dst_height = 1;
-}
-
-SDL_Surface *zoomSurface(SDL_Surface *src, float zoom_x, float zoom_y)
+SDL_Surface *zoomSurface(SDL_Surface *src, int dst_width, int dst_height)
{
SDL_Surface *zoom_src = NULL;
SDL_Surface *zoom_dst = NULL;
- int dst_width, dst_height;
boolean is_converted = FALSE;
boolean is_32bit;
int i;
is_converted = TRUE;
}
- /* get size of destination surface */
- zoomSurfaceSize(zoom_src->w, zoom_src->h, zoom_x, zoom_y,
- &dst_width, &dst_height);
-
/* allocate surface to completely contain the zoomed surface */
if (is_32bit)
{
return zoom_dst;
}
-SDL_Surface *SDLZoomSurface(SDL_Surface *src, float zoom_x, float zoom_y)
+void SDLZoomBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap)
{
- return zoomSurface(src, zoom_x, zoom_y);
+ int dst_width = dst_bitmap->width;
+ int dst_height = dst_bitmap->height;
+
+ SDL_FreeSurface(dst_bitmap->surface);
+
+ dst_bitmap->surface = zoomSurface(src_bitmap->surface, dst_width,dst_height);
}
inline void SDLDrawLine(Bitmap *, int, int, int, int, Uint32);
inline Pixel SDLGetPixel(Bitmap *, int, int);
-SDL_Surface *SDLZoomSurface(SDL_Surface *, float, float);
+void SDLZoomBitmap(Bitmap *, Bitmap *);
Bitmap *SDLLoadImage(char *);
free(new_bitmap);
}
+Bitmap *ZoomBitmap(Bitmap *src_bitmap, int zoom_width, int zoom_height)
+{
+ Bitmap *dst_bitmap = CreateBitmap(zoom_width, zoom_height, DEFAULT_DEPTH);
+
+#if defined(TARGET_SDL)
+ SDLZoomBitmap(src_bitmap, dst_bitmap);
+#else
+ X11ZoomBitmap(src_bitmap, dst_bitmap);
+#endif
+
+ return dst_bitmap;
+}
+
/* ========================================================================= */
/* audio functions */
Bitmap *LoadCustomImage(char *);
void ReloadCustomImage(Bitmap *, char *);
+Bitmap *ZoomBitmap(Bitmap *, int, int);
+
inline void OpenAudio(void);
inline void CloseAudio(void);
inline void SetAudioMode(boolean);
return new_window;
}
+inline void X11NativeZoomBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap)
+{
+}
+
+void X11ZoomBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap)
+{
+#if defined(TARGET_ALLEGRO)
+ AllegroZoomBitmap(src_bitmap->drawable, dst_bitmap->drawable,
+ src_bitmap->width, src_bitmap->height,
+ dst_bitmap->width, dst_bitmap->height);
+#else
+ X11NativeZoomBitmap(src_bitmap, dst_bitmap);
+#endif
+}
+
static void SetImageDimensions(Bitmap *bitmap)
{
#if defined(TARGET_ALLEGRO)
inline void X11InitVideoDisplay(void);
inline void X11InitVideoBuffer(DrawBuffer **, DrawWindow **);
+
+void X11ZoomBitmap(Bitmap *, Bitmap *);
+
Bitmap *X11LoadImage(char *);
#endif /* X11_H */