home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warptlk3.zip / TOOLKIT / H / DIVE.H < prev    next >
C/C++ Source or Header  |  1995-08-24  |  12KB  |  248 lines

  1. /***************************************************************************\
  2. *
  3. * Module Name: DIVE.H
  4. *
  5. * OS/2 2.1 Multimedia Extensions Display Engine API data structures
  6. *
  7. * Copyright (c) International Business Machines Corporation 1993, 1994
  8. *                         All Rights Reserved
  9. *
  10. *
  11. \****************************************************************************/
  12. #ifdef __cplusplus
  13.    extern "C" {
  14. #endif
  15.  
  16. #ifndef _DIVE_H_
  17. #define _DIVE_H_
  18.  
  19. #define MAX_DIVE_INSTANCES    64
  20.  
  21. #define FOURCC ULONG
  22. #define HDIVE ULONG
  23.  
  24. #define DIVE_SUCCESS                                     0x00000000
  25. #define DIVE_ERR_INVALID_INSTANCE                        0x00001000
  26. #define DIVE_ERR_SOURCE_FORMAT                           0x00001001
  27. #define DIVE_ERR_DESTINATION_FORMAT                      0x00001002
  28. #define DIVE_ERR_BLITTER_NOT_SETUP                       0x00001003
  29. #define DIVE_ERR_INSUFFICIENT_LENGTH                     0x00001004
  30. #define DIVE_ERR_TOO_MANY_INSTANCES                      0x00001005
  31. #define DIVE_ERR_NO_DIRECT_ACCESS                        0x00001006
  32. #define DIVE_ERR_NOT_BANK_SWITCHED                       0x00001007
  33. #define DIVE_ERR_INVALID_BANK_NUMBER                     0x00001008
  34. #define DIVE_ERR_FB_NOT_ACQUIRED                         0x00001009
  35. #define DIVE_ERR_FB_ALREADY_ACQUIRED                     0x0000100a
  36. #define DIVE_ERR_ACQUIRE_FAILED                          0x0000100b
  37. #define DIVE_ERR_BANK_SWITCH_FAILED                      0x0000100c
  38. #define DIVE_ERR_DEACQUIRE_FAILED                        0x0000100d
  39. #define DIVE_ERR_INVALID_PALETTE                         0x0000100e
  40. #define DIVE_ERR_INVALID_DESTINATION_RECTL               0x0000100f
  41. #define DIVE_ERR_INVALID_BUFFER_NUMBER                   0x00001010
  42. #define DIVE_ERR_SSMDD_NOT_INSTALLED                     0x00001011
  43. #define DIVE_ERR_BUFFER_ALREADY_ACCESSED                 0x00001012
  44. #define DIVE_ERR_BUFFER_NOT_ACCESSED                     0x00001013
  45. #define DIVE_ERR_TOO_MANY_BUFFERS                        0x00001014
  46. #define DIVE_ERR_ALLOCATION_ERROR                        0x00001015
  47. #define DIVE_ERR_INVALID_LINESIZE                        0x00001016
  48. #define DIVE_ERR_FATAL_EXCEPTION                         0x00001017
  49. #define DIVE_ERR_INVALID_CONVERSION                      0x00001018
  50. #define DIVE_WARN_NO_SIZE                                0x00001100
  51.  
  52. #define DIVE_BUFFER_SCREEN                               0x00000000
  53. #define DIVE_BUFFER_GRAPHICS_PLANE                       0x00000001
  54. #define DIVE_BUFFER_ALTERNATE_PLANE                      0x00000002
  55.  
  56. /* Notes:
  57.       Associated/Allocated memory buffers start at:      0x00000010
  58.  
  59.       Specifing DIVE_BUFFER_GRAPHICS_PLANE results in the image being
  60.             transferred to the graphics plane.
  61.       Specifing DIVE_BUFFER_ALTERNATE_PLANE results in the image being
  62.             transferred to the alternate (e.g. overlay) plane.  If your
  63.             hardware doesn't support such a plane, this is an error.
  64.       Specifing DIVE_BUFFER_SCREEN will result in the image being
  65.             transferred to either the graphics plane buffer or the alternate
  66.             plane buffer based on if an alternate buffer exists and based on
  67.             the suitability the overlay plane to accelerate the scaling of
  68.             the image.  If DIVE chooses to use the alternate buffer, it
  69.             will also paint the overlay "key" color on the graphics plane.
  70.             This automatic painting does not occur if the alternate plane
  71.             is explicitly specified.
  72. */
  73.  
  74.  
  75.  
  76. typedef struct _DIVE_CAPS {
  77.  
  78.    ULONG  ulStructLen;            /* Set equal to sizeof(DIVE_CAPS)          */
  79.    ULONG  ulPlaneCount;           /* Number of defined planes.               */
  80.  
  81.    /* Info returned in the following fields pertains to ulPlaneID.           */
  82.    BOOL   fScreenDirect;          /* TRUE if can get addressability to vram. */
  83.    BOOL   fBankSwitched;          /* TRUE if vram is bank-switched.          */
  84.    ULONG  ulDepth;                /* Number of bits per pixel.               */
  85.    ULONG  ulHorizontalResolution; /* Screen width in pixels.                 */
  86.    ULONG  ulVerticalResolution;   /* Screen height in pixels.                */
  87.    ULONG  ulScanLineBytes;        /* Screen scan line size in bytes.         */
  88.    FOURCC fccColorEncoding;       /* Colorspace encoding of the screen.      */
  89.    ULONG  ulApertureSize;         /* Size of vram aperture in bytes.         */
  90.  
  91.    ULONG  ulInputFormats;         /* Number of input color formats.          */
  92.    ULONG  ulOutputFormats;        /* Number of output color formats.         */
  93.    ULONG  ulFormatLength;         /* Length of format buffer.                */
  94.    PVOID  pFormatData;            /* Pointer to color format buffer FOURCC's.*/
  95.  
  96.    } DIVE_CAPS;
  97. typedef DIVE_CAPS *PDIVE_CAPS;
  98.  
  99.  
  100. /* Notes:
  101.       DiveSetupBlitter may be called with a structure length at any of the
  102.       breaks below (i.e. 8, 28, 32, 52, 60, or 68):
  103. */
  104.  
  105. typedef struct _SETUP_BLITTER {
  106.  
  107.    ULONG  ulStructLen;            /* Set equal to sizeof(SETUP_BLITTER)      */
  108.    BOOL   fInvert;                /* TRUE if we are to invert image on blit. */
  109.  
  110.    FOURCC fccSrcColorFormat;      /* Color format of source data.            */
  111.    ULONG  ulSrcWidth;             /* Source width in pixels.                 */
  112.    ULONG  ulSrcHeight;            /* Source height in pixels.                */
  113.    ULONG  ulSrcPosX;              /* Source start X position.                */
  114.    ULONG  ulSrcPosY;              /* Source start Y position.                */
  115.  
  116.    ULONG  ulDitherType;           /* Where 0 is no dither, 1 is 2x2 dither.  */
  117.  
  118.    FOURCC fccDstColorFormat;      /* Color format of destination data.       */
  119.    ULONG  ulDstWidth;             /* Destination width in pixels.            */
  120.    ULONG  ulDstHeight;            /* Destination height in pixels.           */
  121.    LONG   lDstPosX;               /* Destination start X position.           */
  122.    LONG   lDstPosY;               /* Destination start Y position.           */
  123.  
  124.    LONG   lScreenPosX;            /* Destination start X position on screen. */
  125.    LONG   lScreenPosY;            /* Destination start Y position on screen. */
  126.  
  127.    ULONG  ulNumDstRects;          /* Number of visible rectangles.           */
  128.    PRECTL pVisDstRects;           /* Pointer to array of visible rectangles. */
  129.  
  130.    } SETUP_BLITTER;
  131. typedef SETUP_BLITTER *PSETUP_BLITTER;
  132.  
  133.  
  134.  
  135. ULONG APIENTRY DiveQueryCaps ( PDIVE_CAPS pDiveCaps,
  136.                                ULONG      ulPlaneBufNum );
  137.  
  138. ULONG APIENTRY DiveOpen ( HDIVE *phDiveInst,
  139.                           BOOL   fNonScreenInstance,
  140.                           PVOID  ppFrameBuffer );
  141.  
  142. ULONG APIENTRY DiveSetupBlitter ( HDIVE          hDiveInst,
  143.                                   PSETUP_BLITTER pSetupBlitter );
  144.  
  145. ULONG APIENTRY DiveBlitImage ( HDIVE hDiveInst,
  146.                                ULONG ulSrcBufNumber,
  147.                                ULONG ulDstBufNumber );
  148.  
  149. ULONG APIENTRY DiveClose ( HDIVE hDiveInst );
  150.  
  151. ULONG APIENTRY DiveAcquireFrameBuffer ( HDIVE   hDiveInst,
  152.                                         PRECTL  prectlDst );
  153.  
  154. ULONG APIENTRY DiveSwitchBank ( HDIVE hDiveInst,
  155.                                 ULONG ulBankNumber );
  156.  
  157. ULONG APIENTRY DiveDeacquireFrameBuffer ( HDIVE hDiveInst );
  158.  
  159. ULONG APIENTRY DiveCalcFrameBufferAddress ( HDIVE  hDiveInst,
  160.                                             PRECTL prectlDest,
  161.                                             PBYTE *ppDestinationAddress,
  162.                                             PULONG pulBankNumber,
  163.                                             PULONG pulRemLinesInBank );
  164.  
  165. /* Notes on DiveAllocImageBuffer:
  166.       If pbImageBuffer is not NULL, the buffer is associated rather than
  167.       allocated.  If pbImageBuffer is not NULL and the buffer number
  168.       pointed to by pulBufferNumber is non-zero, a new buffer pointer is
  169.       associated with the buffer number.  Even though no memory is
  170.       allocated by DiveAllocImageBuffer when user-allocated buffers are
  171.       associated, DiveFreeImageBuffer should be called to release the
  172.       buffer association to avoid using up available buffer indexes.
  173.       The specified line size will be used if a buffer is allocated in
  174.       system memory, or if a user buffer is associated.  If the
  175.       specified line size is zero, the allocated line size is rounded up
  176.       to the nearest DWORD boundry.
  177. */
  178.  
  179. ULONG APIENTRY DiveAllocImageBuffer ( HDIVE  hDiveInst,
  180.                                       PULONG pulBufferNumber,
  181.                                       FOURCC fccColorSpace,
  182.                                       ULONG  ulWidth,
  183.                                       ULONG  ulHeight,
  184.                                       ULONG  ulLineSizeBytes,
  185.                                       PBYTE  pbImageBuffer );
  186.  
  187. ULONG APIENTRY DiveFreeImageBuffer ( HDIVE hDiveInst,
  188.                                      ULONG ulBufferNumber );
  189.  
  190. ULONG APIENTRY DiveBeginImageBufferAccess ( HDIVE  hDiveInst,
  191.                                             ULONG  ulBufferNumber,
  192.                                             PBYTE *ppbImageBuffer,
  193.                                             PULONG pulBufferScanLineBytes,
  194.                                             PULONG pulBufferScanLines );
  195.  
  196. ULONG APIENTRY DiveEndImageBufferAccess ( HDIVE hDiveInst,
  197.                                           ULONG ulBufferNumber );
  198.  
  199.  
  200.  
  201. /* Notes on palettes:
  202.       Neither DiveSetSourcePalette nor DiveSetDestinationPalette API's will set
  203.       the physical palette.  If your application MUST set the PHYSICAL palette,
  204.       try using no more than 236 entries (the middle 236: 10-245, thus leaving
  205.       the top and bottom 10 entries for the Workplace Shell).  If your
  206.       application MUST use ALL 256 entries, it must do so as a full-screen
  207.       (i.e. maximized) application.  Remember, No WM_REALIZEPALETTE message
  208.       will be sent to other running applications, meaning they will not redraw
  209.       and their colors will be all wrong.  It is not recommended that a
  210.       developer use these commands:
  211.  
  212.    To set physical palette, do the following:
  213.             hps = WinGetPS ( HWND_DESKTOP );
  214.             hdc = GpiQueryDevice ( hps );
  215.             GpiCreateLogColorTable ( hps, LCOL_PURECOLOR | LCOL_REALIZABLE,
  216.                            LCOLF_CONSECRGB, 0, 256, (PLONG)plRGB2Entries );
  217.             DiveSetPhysicalPalette ( hDiveInst, hdc );
  218.             Gre32EntrY3 ( hdc, 0L, 0x000060C6L );
  219.             WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE );
  220.             WinReleasePS ( hps );
  221.  
  222.    To reset physical palette, do the following:
  223.             hps = WinGetPS ( HWND_DESKTOP );
  224.             hdc = GpiQueryDevice ( hps );
  225.             Gre32EntrY3 ( hdc, 0L, 0x000060C7L );
  226.             WinInvalidateRect ( HWND_DESKTOP, (PRECTL)NULL, TRUE );
  227.             WinReleasePS ( hps );
  228. */
  229.  
  230.  
  231. ULONG APIENTRY DiveSetDestinationPalette ( HDIVE hDiveInst,
  232.                                            ULONG ulStartIndex,
  233.                                            ULONG ulNumEntries,
  234.                                            PBYTE pbRGB2Entries );
  235.  
  236. ULONG APIENTRY DiveSetSourcePalette ( HDIVE hDiveInst,
  237.                                       ULONG ulStartIndex,
  238.                                       ULONG ulNumEntries,
  239.                                       PBYTE pbRGB2Entries );
  240.  
  241.  
  242. #endif
  243.  
  244. #ifdef __cplusplus
  245. }
  246. #endif
  247.  
  248.