00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #ifndef _SDL_video_h
00028 #define _SDL_video_h
00029
00030 #include "SDL_stdinc.h"
00031 #include "SDL_error.h"
00032 #include "SDL_rwops.h"
00033
00034 #include "begin_code.h"
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00044 #define SDL_ALPHA_OPAQUE 255
00045 #define SDL_ALPHA_TRANSPARENT 0
00046
00050 typedef struct SDL_Rect {
00051 Sint16 x, y;
00052 Uint16 w, h;
00053 } SDL_Rect;
00054
00055 typedef struct SDL_Color {
00056 Uint8 r;
00057 Uint8 g;
00058 Uint8 b;
00059 Uint8 unused;
00060 } SDL_Color;
00061 #define SDL_Colour SDL_Color
00062
00063 typedef struct SDL_Palette {
00064 int ncolors;
00065 SDL_Color *colors;
00066 } SDL_Palette;
00070 typedef struct SDL_PixelFormat {
00071 SDL_Palette *palette;
00072 Uint8 BitsPerPixel;
00073 Uint8 BytesPerPixel;
00074 Uint8 Rloss;
00075 Uint8 Gloss;
00076 Uint8 Bloss;
00077 Uint8 Aloss;
00078 Uint8 Rshift;
00079 Uint8 Gshift;
00080 Uint8 Bshift;
00081 Uint8 Ashift;
00082 Uint32 Rmask;
00083 Uint32 Gmask;
00084 Uint32 Bmask;
00085 Uint32 Amask;
00086
00088 Uint32 colorkey;
00090 Uint8 alpha;
00091 } SDL_PixelFormat;
00092
00096 typedef struct SDL_Surface {
00097 Uint32 flags;
00098 SDL_PixelFormat *format;
00099 int w, h;
00100 Uint16 pitch;
00101 void *pixels;
00102 int offset;
00105 struct private_hwdata *hwdata;
00106
00108 SDL_Rect clip_rect;
00109 Uint32 unused1;
00112 Uint32 locked;
00115 struct SDL_BlitMap *map;
00118 unsigned int format_version;
00121 int refcount;
00122 } SDL_Surface;
00123
00128
00131 #define SDL_SWSURFACE 0x00000000
00132 #define SDL_HWSURFACE 0x00000001
00133 #define SDL_ASYNCBLIT 0x00000004
00135
00136
00138 #define SDL_ANYFORMAT 0x10000000
00139 #define SDL_HWPALETTE 0x20000000
00140 #define SDL_DOUBLEBUF 0x40000000
00141 #define SDL_FULLSCREEN 0x80000000
00142 #define SDL_OPENGL 0x00000002
00143 #define SDL_OPENGLBLIT 0x0000000A
00144 #define SDL_RESIZABLE 0x00000010
00145 #define SDL_NOFRAME 0x00000020
00147
00148
00150 #define SDL_HWACCEL 0x00000100
00151 #define SDL_SRCCOLORKEY 0x00001000
00152 #define SDL_RLEACCELOK 0x00002000
00153 #define SDL_RLEACCEL 0x00004000
00154 #define SDL_SRCALPHA 0x00010000
00155 #define SDL_PREALLOC 0x01000000
00157
00158
00161 #define SDL_MUSTLOCK(surface) \
00162 (surface->offset || \
00163 ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
00164
00166 typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect,
00167 struct SDL_Surface *dst, SDL_Rect *dstrect);
00168
00169
00171 typedef struct SDL_VideoInfo {
00172 Uint32 hw_available :1;
00173 Uint32 wm_available :1;
00174 Uint32 UnusedBits1 :6;
00175 Uint32 UnusedBits2 :1;
00176 Uint32 blit_hw :1;
00177 Uint32 blit_hw_CC :1;
00178 Uint32 blit_hw_A :1;
00179 Uint32 blit_sw :1;
00180 Uint32 blit_sw_CC :1;
00181 Uint32 blit_sw_A :1;
00182 Uint32 blit_fill :1;
00183 Uint32 UnusedBits3 :16;
00184 Uint32 video_mem;
00185 SDL_PixelFormat *vfmt;
00186 int current_w;
00187 int current_h;
00188 } SDL_VideoInfo;
00189
00190
00200 #define SDL_YV12_OVERLAY 0x32315659
00201 #define SDL_IYUV_OVERLAY 0x56555949
00202 #define SDL_YUY2_OVERLAY 0x32595559
00203 #define SDL_UYVY_OVERLAY 0x59565955
00204 #define SDL_YVYU_OVERLAY 0x55595659
00206
00207
00208 typedef struct SDL_Overlay {
00209 Uint32 format;
00210 int w, h;
00211 int planes;
00212 Uint16 *pitches;
00213 Uint8 **pixels;
00217 struct private_yuvhwfuncs *hwfuncs;
00218 struct private_yuvhwdata *hwdata;
00223 Uint32 hw_overlay :1;
00224 Uint32 UnusedBits :31;
00226 } SDL_Overlay;
00227
00228
00230 typedef enum {
00231 SDL_GL_RED_SIZE,
00232 SDL_GL_GREEN_SIZE,
00233 SDL_GL_BLUE_SIZE,
00234 SDL_GL_ALPHA_SIZE,
00235 SDL_GL_BUFFER_SIZE,
00236 SDL_GL_DOUBLEBUFFER,
00237 SDL_GL_DEPTH_SIZE,
00238 SDL_GL_STENCIL_SIZE,
00239 SDL_GL_ACCUM_RED_SIZE,
00240 SDL_GL_ACCUM_GREEN_SIZE,
00241 SDL_GL_ACCUM_BLUE_SIZE,
00242 SDL_GL_ACCUM_ALPHA_SIZE,
00243 SDL_GL_STEREO,
00244 SDL_GL_MULTISAMPLEBUFFERS,
00245 SDL_GL_MULTISAMPLESAMPLES,
00246 SDL_GL_ACCELERATED_VISUAL,
00247 SDL_GL_SWAP_CONTROL
00248 } SDL_GLattr;
00249
00252 #define SDL_LOGPAL 0x01
00253 #define SDL_PHYSPAL 0x02
00254
00256
00257
00275 extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags);
00276 extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
00284 extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
00285
00292 extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void);
00293
00300 extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void);
00301
00313 extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
00314
00324 extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
00325
00384 extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode
00385 (int width, int height, int bpp, Uint32 flags);
00386
00394 extern DECLSPEC void SDLCALL SDL_UpdateRects
00395 (SDL_Surface *screen, int numrects, SDL_Rect *rects);
00400 extern DECLSPEC void SDLCALL SDL_UpdateRect
00401 (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
00414 extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen);
00415
00424 extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
00425
00438 extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue);
00439
00449 extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
00450
00466 extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface,
00467 SDL_Color *colors, int firstcolor, int ncolors);
00468
00485 extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags,
00486 SDL_Color *colors, int firstcolor,
00487 int ncolors);
00488
00492 extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
00493 (const SDL_PixelFormat * const format,
00494 const Uint8 r, const Uint8 g, const Uint8 b);
00495
00499 extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA
00500 (const SDL_PixelFormat * const format,
00501 const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a);
00502
00506 extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
00507 const SDL_PixelFormat * const fmt,
00508 Uint8 *r, Uint8 *g, Uint8 *b);
00509
00513 extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
00514 const SDL_PixelFormat * const fmt,
00515 Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
00516
00518 #define SDL_AllocSurface SDL_CreateRGBSurface
00519
00553 extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface
00554 (Uint32 flags, int width, int height, int depth,
00555 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
00557 extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
00558 int width, int height, int depth, int pitch,
00559 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
00560 extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface);
00561
00580 extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
00581 extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
00582
00589 extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
00590
00592 #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
00593
00599 extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
00600 (SDL_Surface *surface, SDL_RWops *dst, int freedst);
00601
00603 #define SDL_SaveBMP(surface, file) \
00604 SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
00605
00615 extern DECLSPEC int SDLCALL SDL_SetColorKey
00616 (SDL_Surface *surface, Uint32 flag, Uint32 key);
00617
00633 extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
00634
00647 extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect);
00648
00654 extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);
00655
00668 extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface
00669 (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);
00670
00743 #define SDL_BlitSurface SDL_UpperBlit
00744
00748 extern DECLSPEC int SDLCALL SDL_UpperBlit
00749 (SDL_Surface *src, SDL_Rect *srcrect,
00750 SDL_Surface *dst, SDL_Rect *dstrect);
00754 extern DECLSPEC int SDLCALL SDL_LowerBlit
00755 (SDL_Surface *src, SDL_Rect *srcrect,
00756 SDL_Surface *dst, SDL_Rect *dstrect);
00757
00767 extern DECLSPEC int SDLCALL SDL_FillRect
00768 (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
00769
00781 extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface);
00782
00795 extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface);
00796
00797
00798
00800
00801
00807 extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height,
00808 Uint32 format, SDL_Surface *display);
00809
00811 extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay);
00812 extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay);
00813
00820 extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);
00821
00823 extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay);
00824
00827
00829
00830
00837 extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
00838
00842 extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc);
00843
00847 extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
00848
00858 extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value);
00859
00863 extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
00864
00870 extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects);
00871 extern DECLSPEC void SDLCALL SDL_GL_Lock(void);
00872 extern DECLSPEC void SDLCALL SDL_GL_Unlock(void);
00876
00877
00880
00881
00885 extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
00889 extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
00890
00897 extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
00898
00904 extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
00905
00921 extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface);
00922
00923 typedef enum {
00924 SDL_GRAB_QUERY = -1,
00925 SDL_GRAB_OFF = 0,
00926 SDL_GRAB_ON = 1,
00927 SDL_GRAB_FULLSCREEN
00928 } SDL_GrabMode;
00937 extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
00938
00942 extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect,
00943 SDL_Surface *dst, SDL_Rect *dstrect);
00944
00945
00946 #ifdef __cplusplus
00947 }
00948 #endif
00949 #include "close_code.h"
00950
00951 #endif