sdl

FORK: Simple Directmedia Layer
git clone https://git.neptards.moe/neptards/sdl.git
Log | Files | Refs

my_gradd.h (7432B)


      1 /*
      2 gradd.h structures and constants -- only the ones used by SDL_os2vman.c.
      3 
      4 Based on public knowledge from around the internet including pages from
      5 http://www.osfree.org and http://www.edm2.com
      6 */
      7 
      8 #ifndef my_gradd_h_
      9 #define my_gradd_h_
     10 
     11 typedef struct _INITPROCOUT {
     12   ULONG     ulLength;         /*  Length of the INITPROCOUT data structure, in bytes. */
     13   ULONG     ulVRAMVirt;       /*  32-bit virtual address of VRAM. */
     14 } INITPROCOUT;
     15 typedef INITPROCOUT *PINITPROCOUT;
     16 
     17 #define RC_SUCCESS 0
     18 
     19 typedef ULONG GID;
     20 typedef ULONG (_System FNVMIENTRY) (
     21   GID       gid, ULONG ulFunction,
     22   PVOID     pIn,
     23   PVOID     pOut /* PINITPROCOUT */
     24 );
     25 
     26 #define VMI_CMD_INITPROC 1
     27 #define VMI_CMD_TERMPROC 3
     28 #define VMI_CMD_QUERYMODES 5
     29 #define VMI_CMD_SETMODE 6
     30 #define VMI_CMD_PALETTE 7
     31 #define VMI_CMD_BITBLT 8
     32 #define VMI_CMD_LINE  9
     33 #define VMI_CMD_REQUESTHW 14
     34 #define VMI_CMD_QUERYCURRENTMODE 0x1001
     35 
     36 #define QUERYMODE_NUM_MODES 0x01
     37 #define QUERYMODE_MODE_DATA 0x02
     38 
     39 typedef struct _HWPALETTEINFO {
     40   ULONG     ulLength;         /* Size of the HWPALETTEINFO data structure, in bytes. */
     41   ULONG     fFlags;           /* Palette flag. */
     42   ULONG     ulStartIndex;     /* Starting palette index. */
     43   ULONG     ulNumEntries;     /* Number of palette slots to query or set. */
     44   PRGB2     pRGBs;            /* Pointer to the array of RGB values. */
     45 } HWPALETTEINFO;
     46 typedef HWPALETTEINFO *PHWPALETTEINFO;
     47 
     48 #define PALETTE_GET 0x01
     49 #define PALETTE_SET 0x02
     50 
     51 typedef struct _BMAPINFO {
     52   ULONG     ulLength;         /* Length of the BMAPINFO data structure, in bytes. */
     53   ULONG     ulType;           /* Description of the Blt. */
     54   ULONG     ulWidth;          /* Width in pels of the bit map. */
     55   ULONG     ulHeight;         /* Height in pels of the bit map. */
     56   ULONG     ulBpp;            /* Number of bits per pel/color depth. */
     57   ULONG     ulBytesPerLine;   /* Number of aligned bytes per line. */
     58   PBYTE     pBits;            /* Pointer to bit-map bits. */
     59 } BMAPINFO;
     60 typedef BMAPINFO *PBMAPINFO;
     61 
     62 #define BMAP_VRAM 0
     63 #define BMAP_MEMORY 1
     64 
     65 typedef struct _LINEPACK {
     66   ULONG        ulStyleStep;   /* Value to be added to ulStyleValue. */
     67   ULONG        ulStyleValue;  /* Style value at the current pel. */
     68   ULONG        ulFlags;       /* Flags used for the LINEPACK data structure. */
     69   struct _LINEPACK *plpkNext; /* Pointer to next LINEPACK data structure. */
     70   ULONG        ulAbsDeltaX;   /* Clipped Bresenham Delta X, absolute. */
     71   ULONG        ulAbsDeltaY;   /* Clipped Bresenham Delta Y, absolute. */
     72   POINTL       ptlClipStart;  /* Pointer to location for device to perform Bresenham algorithm. */
     73   POINTL       ptlClipEnd;    /* Ending location for Bresenham algorithm (see ptlClipStart). */
     74   POINTL       ptlStart;      /* Pointer to starting location for line. */
     75   POINTL       ptlEnd;        /* Ending location for line. */
     76   LONG         lClipStartError;/* Standard Bresenham error at the clipped start point. */
     77 } LINEPACK;
     78 typedef LINEPACK *PLINEPACK;
     79 
     80 typedef struct _LINEINFO {
     81   ULONG         ulLength;     /* Length of LINEINFO data structure. */
     82   ULONG         ulType;       /* Defines line type. */
     83   ULONG         ulStyleMask;  /* A 32-bit style mask. */
     84   ULONG         cLines;       /* Count of lines to be drawn. */
     85   ULONG         ulFGColor;    /* Line Foreground color. */
     86   ULONG         ulBGColor;    /* Line Background color. */
     87   USHORT        usForeROP;    /* Line Foreground mix. */
     88   USHORT        usBackROP;    /* Line Background mix. */
     89   PBMAPINFO     pDstBmapInfo; /* Pointer to destination surface bit map. */
     90   PLINEPACK     alpkLinePack; /* Pointer to LINEPACK data structure. */
     91   PRECTL        prclBounds;   /* Pointer to bounding rect of a clipped line. */
     92 } LINEINFO;
     93 typedef LINEINFO *PLINEINFO;
     94 
     95 #define LINE_DO_FIRST_PEL 0x02
     96 #define LINE_DIR_Y_POSITIVE 0x04
     97 #define LINE_HORIZONTAL 0x08
     98 #define LINE_DIR_X_POSITIVE 0x20
     99 #define LINE_VERTICAL 0x1000
    100 #define LINE_DO_LAST_PEL 0x4000
    101 #define LINE_SOLID 0x01
    102 
    103 typedef struct _BLTRECT {
    104   ULONG     ulXOrg;           /* X origin of the destination Blt. */
    105   ULONG     ulYOrg;           /* Y origin of the destination Blt. */
    106   ULONG     ulXExt;           /* X extent of the BitBlt. */
    107   ULONG     ulYExt;           /* Y extent of the BitBlt. */
    108 } BLTRECT;
    109 typedef BLTRECT *PBLTRECT;
    110 
    111 typedef struct _BITBLTINFO {
    112   ULONG     ulLength;         /* Length of the BITBLTINFO data structure, in bytes. */
    113   ULONG     ulBltFlags;       /* Flags for rendering of rasterized data. */
    114   ULONG     cBlits;           /* Count of Blts to be performed. */
    115   ULONG     ulROP;            /* Raster operation. */
    116   ULONG     ulMonoBackROP;    /* Background mix if B_APPLY_BACK_ROP is set. */
    117   ULONG     ulSrcFGColor;     /* Monochrome source Foreground color. */
    118   ULONG     ulSrcBGColor;     /* Monochrome source Background color and transparent color. */
    119   ULONG     ulPatFGColor;     /* Monochrome pattern Foreground color. */
    120   ULONG     ulPatBGColor;     /* Monochrome pattern Background color. */
    121   PBYTE     abColors;         /* Pointer to color translation table. */
    122   PBMAPINFO pSrcBmapInfo;     /* Pointer to source bit map (BMAPINFO) */
    123   PBMAPINFO pDstBmapInfo;     /* Pointer to destination bit map (BMAPINFO). */
    124   PBMAPINFO pPatBmapInfo;     /* Pointer to pattern bit map (BMAPINFO). */
    125   PPOINTL   aptlSrcOrg;       /* Pointer to array of source origin POINTLs. */
    126   PPOINTL   aptlPatOrg;       /* Pointer to array of pattern origin POINTLs. */
    127   PBLTRECT  abrDst;           /* Pointer to array of Blt rects. */
    128   PRECTL    prclSrcBounds;    /* Pointer to source bounding rect of source Blts. */
    129   PRECTL    prclDstBounds;    /* Pointer to destination bounding rect of destination Blts. */
    130 } BITBLTINFO;
    131 typedef BITBLTINFO *PBITBLTINFO;
    132 
    133 #define BF_DEFAULT_STATE 0x0
    134 #define BF_ROP_INCL_SRC (0x01 << 2)
    135 #define BF_PAT_HOLLOW   (0x01 << 8)
    136 
    137 typedef struct _GDDMODEINFO {
    138   ULONG     ulLength;         /* Size of the GDDMODEINFO data structure, in bytes. */
    139   ULONG     ulModeId;         /* ID used to make SETMODE request. */
    140   ULONG     ulBpp;            /* Number of colors (bpp). */
    141   ULONG     ulHorizResolution;/* Number of horizontal pels. */
    142   ULONG     ulVertResolution; /* Number of vertical scan lines. */
    143   ULONG     ulRefreshRate;    /* Refresh rate in Hz. */
    144   PBYTE     pbVRAMPhys;       /* Physical address of VRAM. */
    145   ULONG     ulApertureSize;   /* Size of VRAM, in bytes. */
    146   ULONG     ulScanLineSize;   /* Size of one scan line, in bytes. */
    147 
    148   ULONG     fccColorEncoding, ulTotalVRAMSize, cColors;
    149 } GDDMODEINFO;
    150 typedef GDDMODEINFO *PGDDMODEINFO;
    151 
    152 typedef struct _HWREQIN {
    153   ULONG     ulLength;         /* Size of the HWREQIN data structure, in bytes. */
    154   ULONG     ulFlags;          /* Request option flags. */
    155   ULONG     cScrChangeRects;  /* Count of screen rectangles affected by HWREQIN. */
    156   PRECTL    arectlScreen;     /* Array of screen rectangles affected by HWREQIN. */
    157 } HWREQIN;
    158 typedef HWREQIN *PHWREQIN;
    159 
    160 #define REQUEST_HW 0x01
    161 
    162 /*
    163 BOOL GreDeath(HDC hdc, PVOID pInstance, LONG lFunction);
    164 LONG GreResurrection(HDC hdc, LONG cbVmem, PULONG pReserved, PVOID pInstance, LONG lFunction);
    165 */
    166 #define GreDeath(h) (BOOL)Gre32Entry3((ULONG)(h), 0, 0x40B7L)
    167 #define GreResurrection(h,n,r) (LONG)Gre32Entry5((ULONG)(h), (ULONG)(n), (ULONG)(r), 0, 0x40B8L)
    168 ULONG _System Gre32Entry3(ULONG, ULONG, ULONG);
    169 ULONG _System Gre32Entry5(ULONG, ULONG, ULONG, ULONG, ULONG);
    170 
    171 #endif /* my_gradd_h_ */