| 1 | |
|---|
| 2 | /* |
|---|
| 3 | |
|---|
| 4 | SDL_rotozoom - rotozoomer |
|---|
| 5 | |
|---|
| 6 | LGPL (c) A. Schiffler |
|---|
| 7 | |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | // convert to D by shinichiro.h |
|---|
| 11 | |
|---|
| 12 | import SDL; |
|---|
| 13 | import SDL_video; |
|---|
| 14 | import SDL_types; |
|---|
| 15 | |
|---|
| 16 | /* Set up for C function definitions, even when using C++ */ |
|---|
| 17 | extern (C) { |
|---|
| 18 | |
|---|
| 19 | /* ---- Defines */ |
|---|
| 20 | |
|---|
| 21 | const int SMOOTHING_OFF = 0; |
|---|
| 22 | const int SMOOTHING_ON = 1; |
|---|
| 23 | |
|---|
| 24 | /* ---- Structures */ |
|---|
| 25 | |
|---|
| 26 | struct tColorRGBA { |
|---|
| 27 | Uint8 r; |
|---|
| 28 | Uint8 g; |
|---|
| 29 | Uint8 b; |
|---|
| 30 | Uint8 a; |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | struct tColorY { |
|---|
| 34 | Uint8 y; |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | /* |
|---|
| 39 | |
|---|
| 40 | rotozoomSurface() |
|---|
| 41 | |
|---|
| 42 | Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. |
|---|
| 43 | 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1 |
|---|
| 44 | then the destination 32bit surface is anti-aliased. If the surface is not 8bit |
|---|
| 45 | or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. |
|---|
| 46 | |
|---|
| 47 | */ |
|---|
| 48 | |
|---|
| 49 | SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth); |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | /* Returns the size of the target surface for a rotozoomSurface() call */ |
|---|
| 53 | |
|---|
| 54 | void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, |
|---|
| 55 | int *dstheight); |
|---|
| 56 | |
|---|
| 57 | /* |
|---|
| 58 | |
|---|
| 59 | zoomSurface() |
|---|
| 60 | |
|---|
| 61 | Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. |
|---|
| 62 | 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1 |
|---|
| 63 | then the destination 32bit surface is anti-aliased. If the surface is not 8bit |
|---|
| 64 | or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. |
|---|
| 65 | |
|---|
| 66 | */ |
|---|
| 67 | |
|---|
| 68 | SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth); |
|---|
| 69 | |
|---|
| 70 | /* Returns the size of the target surface for a zoomSurface() call */ |
|---|
| 71 | |
|---|
| 72 | void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight); |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | /* Ends C function definitions when using C++ */ |
|---|
| 76 | } |
|---|
| 77 | |
|---|