include/SDL_compat.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 16 Jun 2006 06:00:31 +0000
branchSDL-1.3
changeset 1682 7ae8018b2e5d
parent 1675 d33dcfc3fde7
child 1683 396a35389351
permissions -rw-r--r--
Default palette entries to white, instead of black.
More palettized video mode support...
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /* This file contains functions for backwards compatibility with SDL 1.2 */
    24 
    25 #ifndef _SDL_compat_h
    26 #define _SDL_compat_h
    27 
    28 #include "SDL_video.h"
    29 #include "SDL_syswm.h"
    30 
    31 #include "begin_code.h"
    32 /* Set up for C function definitions, even when using C++ */
    33 #ifdef __cplusplus
    34 /* *INDENT-OFF* */
    35 extern "C" {
    36 /* *INDENT-ON* */
    37 #endif
    38 
    39 #define SDL_SWSURFACE       0x00000000
    40 #define SDL_ANYFORMAT       0x00100000
    41 #define SDL_HWPALETTE       0x00200000
    42 #define SDL_DOUBLEBUF       0x00400000
    43 #define SDL_FULLSCREEN      0x00800000
    44 #define SDL_RESIZABLE       0x01000000
    45 #define SDL_NOFRAME         0x02000000
    46 #define SDL_OPENGL          0x04000000
    47 #define SDL_ASYNCBLIT       0x08000000  /* Not used */
    48 #define SDL_HWACCEL         0x08000000  /* Not used */
    49 #define SDL_SCREEN_SURFACE  0x10000000  /* Surface is a window screen surface */
    50 #define SDL_SHADOW_SURFACE  0x20000000  /* Surface is a window shadow surface */
    51 
    52 #define SDL_APPMOUSEFOCUS	0x01
    53 #define SDL_APPINPUTFOCUS	0x02
    54 #define SDL_APPACTIVE		0x04
    55 
    56 #define SDL_LOGPAL 0x01
    57 #define SDL_PHYSPAL 0x02
    58 
    59 #define SDL_ACTIVEEVENT	SDL_EVENT_RESERVED1
    60 #define SDL_VIDEORESIZE	SDL_EVENT_RESERVED2
    61 #define SDL_VIDEOEXPOSE	SDL_EVENT_RESERVED3
    62 
    63 typedef struct SDL_VideoInfo
    64 {
    65     Uint32 hw_available:1;
    66     Uint32 wm_available:1;
    67     Uint32 UnusedBits1:6;
    68     Uint32 UnusedBits2:1;
    69     Uint32 blit_hw:1;
    70     Uint32 blit_hw_CC:1;
    71     Uint32 blit_hw_A:1;
    72     Uint32 blit_sw:1;
    73     Uint32 blit_sw_CC:1;
    74     Uint32 blit_sw_A:1;
    75     Uint32 blit_fill:1;
    76     Uint32 UnusedBits3:16;
    77     Uint32 video_mem;
    78 
    79     SDL_PixelFormat *vfmt;
    80 } SDL_VideoInfo;
    81 
    82 /* The most common video overlay formats.
    83    For an explanation of these pixel formats, see:
    84    http://www.webartz.com/fourcc/indexyuv.htm
    85 
    86    For information on the relationship between color spaces, see:
    87    http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
    88  */
    89 #define SDL_YV12_OVERLAY  0x32315659    /* Planar mode: Y + V + U  (3 planes) */
    90 #define SDL_IYUV_OVERLAY  0x56555949    /* Planar mode: Y + U + V  (3 planes) */
    91 #define SDL_YUY2_OVERLAY  0x32595559    /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
    92 #define SDL_UYVY_OVERLAY  0x59565955    /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
    93 #define SDL_YVYU_OVERLAY  0x55595659    /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
    94 
    95 /* The YUV hardware video overlay */
    96 typedef struct SDL_Overlay
    97 {
    98     Uint32 format;              /* Read-only */
    99     int w, h;                   /* Read-only */
   100     int planes;                 /* Read-only */
   101     Uint16 *pitches;            /* Read-only */
   102     Uint8 **pixels;             /* Read-write */
   103 
   104     /* Hardware-specific surface info */
   105     struct private_yuvhwfuncs *hwfuncs;
   106     struct private_yuvhwdata *hwdata;
   107 
   108     /* Special flags */
   109     Uint32 hw_overlay:1;        /* Flag: This overlay hardware accelerated? */
   110     Uint32 UnusedBits:31;
   111 } SDL_Overlay;
   112 
   113 typedef enum
   114 {
   115     SDL_GRAB_QUERY = -1,
   116     SDL_GRAB_OFF = 0,
   117     SDL_GRAB_ON = 1
   118 } SDL_GrabMode;
   119 
   120 #define SDL_AllocSurface    SDL_CreateRGBSurface
   121 
   122 extern DECLSPEC const SDL_version *SDLCALL SDL_Linked_Version(void);
   123 extern DECLSPEC char *SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
   124 extern DECLSPEC char *SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
   125 extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
   126 extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp,
   127                                             Uint32 flags);
   128 extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format,
   129                                                  Uint32 flags);
   130 extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, int height,
   131                                                       int bpp, Uint32 flags);
   132 extern DECLSPEC SDL_Surface *SDLCALL SDL_GetVideoSurface(void);
   133 extern DECLSPEC void SDLCALL SDL_UpdateRects(SDL_Surface * screen,
   134                                              int numrects, SDL_Rect * rects);
   135 extern DECLSPEC void SDLCALL SDL_UpdateRect(SDL_Surface * screen, Sint32 x,
   136                                             Sint32 y, Uint32 w, Uint32 h);
   137 extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface * screen);
   138 extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormat(SDL_Surface * surface);
   139 extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
   140                                                             surface);
   141 extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
   142                                                const char *icon);
   143 extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
   144 extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
   145 extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
   146 extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
   147 extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
   148 extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface * surface, int flags,
   149                                            const SDL_Color * colors,
   150                                            int firstcolor, int ncolors);
   151 extern DECLSPEC int SDLCALL SDL_SetScreenColors(SDL_Surface * screen,
   152                                                 const SDL_Color * colors,
   153                                                 int firstcolor, int ncolors);
   154 extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo * info);
   155 extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
   156 extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
   157 extern DECLSPEC SDL_Overlay *SDLCALL SDL_CreateYUVOverlay(int width,
   158                                                           int height,
   159                                                           Uint32 format,
   160                                                           SDL_Surface *
   161                                                           display);
   162 extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay * overlay);
   163 extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay * overlay);
   164 extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay * overlay,
   165                                                   SDL_Rect * dstrect);
   166 extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay * overlay);
   167 
   168 /* Ends C function definitions when using C++ */
   169 #ifdef __cplusplus
   170 /* *INDENT-OFF* */
   171 }
   172 /* *INDENT-ON* */
   173 #endif
   174 #include "close_code.h"
   175 
   176 #endif /* _SDL_compat_h */
   177 
   178 /* vi: set ts=4 sw=4 expandtab: */