include/SDL_compat.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 11 Jun 2006 07:30:16 +0000
branchSDL-1.3
changeset 1675 d33dcfc3fde7
parent 1670 eef792d31de8
child 1682 7ae8018b2e5d
permissions -rw-r--r--
Overlay functions are being replaced by YUV textures.
If the driver doesn't support YUV textures, they can be emulated by backing
the texture with an RGB texture and using the software conversion routines.

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