home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / 3DTOSHI2.ZIP / mpgfx / include / gfxtypes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  4.2 KB  |  178 lines

  1.  
  2. // gfxtypes.h
  3. //
  4. // Copyright (c) 1995 by Toshiaki Tsuji, all rights reserved.
  5.  
  6. #ifndef __GFXTYPES_H__
  7. #define __GFXTYPES_H__
  8.  
  9.   #include "stdgfx.h"
  10.   #include <stdio.h>
  11.   #include <math.h>
  12.  
  13.   #ifdef __FORx86__
  14.     #include <conio.h>
  15.     #include <dos.h>
  16.   #endif
  17.  
  18.   #ifndef __FORMOTIF__
  19.     #include <malloc.h>
  20.     #include <string.h>
  21.     #include <stdlib.h>
  22.   #endif
  23.   
  24.   #if defined (__32BIT__)
  25.     #define INTERRUPT int386
  26.     #define INTERRUPTx int386x
  27.     #define Regs32 Regs.x
  28.     #define Regs16 Regs.w
  29.     #define Regs8  Regs.h
  30.   #elif defined (__16BIT__)
  31.     #define INTERRUPT int86
  32.     #define INTERRUPTx int86x
  33.     #define Regs16 Regs.x
  34.     #define Regs8  Regs.h
  35.   #endif
  36.   
  37.   // Interrupt
  38.   #define INT_TIMER   0x08
  39.   #define INT_KBD     0x09
  40.   #define INT_VIDEO   0x10
  41.   #define INT_VESA    0x10
  42.   #define INT_DOS     0x21
  43.   #define INT_DPMI    0x31
  44.   #define INT_MOUSE   0x33
  45.     
  46.   #if defined (__FORDOS__)
  47.     #define CHAR     char
  48.     #define UCHAR    unsigned char
  49.     #define BYTE     unsigned char
  50.     #define INT      int
  51.     #define UINT     unsigned int
  52.     #define SHORT    short
  53.     #define USHORT   unsigned short
  54.     #define WORD     unsigned short
  55.     #define LONG     long
  56.     #define ULONG    unsigned long
  57.     #define DWORD    unsigned long
  58.     #define FLOAT    float
  59.     #define DOUBLE   double 
  60.     #define VOID     void
  61.     #define HANDLE   INT
  62.     #define HDISPLAY HANDLE   
  63.     #define HWINDOW HANDLE
  64.     #define HMEMDISPLAY HDISPLAY
  65.     #define TRUE  1
  66.     #define FALSE 0
  67.   #elif defined (__FORWINDOWS__)
  68.     #if defined (__FORGDK__)
  69.       #include <windows.h>
  70.       #include <windowsx.h>
  71.       #include <ddraw.h>
  72.     #else  
  73.       #include <windows.h>
  74.     #endif
  75.     
  76.     #define CHAR     char
  77.     #define BYTE     unsigned char
  78.     #define INT      int
  79.     #define SHORT    short
  80.     #define USHORT   unsigned short
  81.     #define LONG     long
  82.     #define HDISPLAY HDC
  83.     #define HWINDOW HANDLE
  84.     #define HMEMDISPLAY HDISPLAY
  85.     #define FLOAT    float
  86.     #define DOUBLE   double 
  87.   #elif defined (__FOROS2__)
  88.     #define  INCL_PM
  89.     #include <os2.h>
  90.     #define CHAR     char
  91.     #define BYTE     unsigned char
  92.     #define INT      int
  93.     #define SHORT    short
  94.     #define USHORT   unsigned short
  95.     #define WORD     unsigned short
  96.     #define LONG     long
  97.     #define DWORD    unsigned long
  98.     #define HANDLE   LHANDLE
  99.     #define HDISPLAY HPS
  100.     #define HWINDOW HANDLE
  101.     #define HMEMDISPLAY HDISPLAY
  102.     #define FLOAT    float
  103.     #define DOUBLE   double 
  104.   #elif defined (__FORUNIX__)
  105.     #define CHAR     char
  106.     #define UCHAR    unsigned char
  107.     #define BYTE     unsigned char
  108.     #define INT      int
  109.     #define UINT     unsigned int
  110.     #define SHORT    short
  111.     #define USHORT   unsigned short
  112.     #define WORD     unsigned short
  113.     #define LONG     long
  114.     #define ULONG    unsigned long
  115.     #define DWORD    unsigned long
  116.     #define FLOAT    float
  117.     #define DOUBLE   double 
  118.     #define VOID     void
  119.     #define HANDLE   INT
  120.     #define HDISPLAY Drawable
  121.     #define HWINDOW Window
  122.     #define HMEMDISPLAY HDISPLAY
  123.     #define TRUE  1
  124.     #define FALSE 0
  125.   #endif  
  126.  
  127.   #define BOOLEAN LONG
  128.   #define SUCCESS 1
  129.   #define FAILURE 0 
  130.  
  131.   #define STRING CHAR*
  132.   
  133.   struct RGBCOLOR
  134.     {
  135.       BYTE Red;
  136.       BYTE Green;
  137.       BYTE Blue;  
  138.     }; // End of RGBCOLOR
  139.  
  140.   struct RECTANGLE
  141.     {
  142.       LONG x1;
  143.       LONG y1;
  144.       LONG x2;
  145.       LONG y2;  
  146.     }; // End of RECTANGLE  
  147.   
  148.   template <class Type> 
  149.   Type MaxValue ( Type T1, Type T2 )
  150.          {
  151.                 if (T1<=T2)
  152.                   return T2;
  153.                 return T1;
  154.          } // End of MaxValue
  155.  
  156.   template <class Type>
  157.   Type MinValue ( Type T1, Type T2 )
  158.          {
  159.                 if (T1<=T2)
  160.                   return T1;
  161.                 return T2;
  162.          } // End of MinValue
  163.  
  164.   template <class Type>
  165.   VOID SwapValue ( Type *T1, Type *T2 )
  166.          {
  167.                 Type Temp;
  168.                 Temp = *T1;
  169.                 *T1 = *T2;
  170.                 *T2 = Temp;
  171.          } // End of SwapValue
  172.  
  173.   VOID SwapWord ( WORD *ValuePtr );  
  174.   VOID SwapDWord ( DWORD *ValuePtr );
  175.   
  176. #endif
  177.  
  178.