home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / pcq_incl3v1.lha / Graphics / View.i < prev   
Encoding:
Text File  |  1994-10-13  |  10.1 KB  |  336 lines

  1. {
  2.     View.i for PCQ Pascal
  3. }
  4.  
  5.  
  6. {$I   "Include:Graphics/GFX.i"}
  7. {$I   "Include:Graphics/Copper.i"}
  8. {$I   "Include:Graphics/GFXNodes.i"}
  9. {$I   "Include:Graphics/Monitor.i"}
  10.  
  11. Type
  12.     RasInfo = record    { used by callers to and InitDspC() }
  13.         Next    : ^RasInfo;     { used for dualpf }
  14.         BitMap  : BitMapPtr;
  15.         RxOffset,
  16.         RyOffset : Short;       { scroll offsets in this BitMap }
  17.     end;
  18.     RasInfoPtr = ^RasInfo;
  19.  
  20.     View = record
  21.         v_ViewPort      : Address;      { ViewPortPtr }
  22.         LOFCprList      : cprlistptr;   { used for interlaced and noninterlaced }
  23.         SHFCprList      : cprlistptr;   { only used during interlace }
  24.         DyOffset,
  25.         DxOffset        : Short;        { for complete View positioning }
  26.                                 { offsets are +- adjustments to standard #s }
  27.         Modes           : Short;        { such as INTERLACE, GENLOC }
  28.     end;
  29.     ViewPtr = ^View;
  30.  
  31. { these structures are obtained via GfxNew }
  32. { and disposed by GfxFree }
  33. Type
  34.        ViewExtra = Record
  35.         n : ExtendedNode;
  36.         ve_View : View;       { backwards link }   { view in C-Includes }
  37.         Monitor : MonitorSpecPtr; { monitors for this view }
  38.        END;
  39.        ViewExtraPtr = ^ViewExtra;
  40.  
  41.  
  42.     ViewPort = record
  43.         Next    : ^ViewPort;
  44.         ColorMap : Address; { table of colors for this viewport }        { ColorMapPtr }
  45.                           { if this is nil, MakeVPort assumes default values }
  46.         DspIns  : CopListPtr;   { user by MakeView() }
  47.         SprIns  : CopListPtr;   { used by sprite stuff }
  48.         ClrIns  : CopListPtr;   { used by sprite stuff }
  49.         UCopIns : UCopListPtr;  { User copper list }
  50.         DWidth,
  51.         DHeight : Short;
  52.         DxOffset,
  53.         DyOffset : Short;
  54.         Modes   : Short;
  55.         SpritePriorities : Byte;        { used by makevp }
  56.         reserved : Byte;
  57.         RasInfo : RasInfoPtr;
  58.     end;
  59.     ViewPortPtr = ^ViewPort;
  60.  
  61.  
  62. { this structure is obtained via GfxNew }
  63. { and disposed by GfxFree }
  64.  ViewPortExtra = Record
  65.   n : ExtendedNode;
  66.   vpe_ViewPort : ViewPortPtr;      { backwards link }   { ViewPort in C-Includes }
  67.   DisplayClip  : Rectangle;  { makevp display clipping information }
  68.         { These are added for V39 }
  69.   VecTable     : Address;                { Private }
  70.   DriverData   : Array[0..1] of Address;
  71.   Flags        : WORD;
  72.   Origin       : Array[0..1] of Point;  { First visible point relative to the DClip.
  73.                                          * One for each possible playfield.
  74.                                          }
  75.   cop1ptr,                  { private }
  76.   cop2ptr      : Integer;   { private }
  77.  END;
  78.  ViewPortExtraPtr = ^ViewPortExtra;
  79.  
  80.  
  81.     ColorMap = record
  82.         Flags   : Byte;
  83.         CType   : Byte;         { This is "Type" in C includes }
  84.         Count   : Short;
  85.         ColorTable      : Address;
  86.         cm_vpe  : ViewPortExtraPtr;
  87.         TransparencyBits : Address;
  88.         TransparencyPlane,
  89.         reserved1        : Byte;
  90.         reserved2        : Short;
  91.         cm_vp            : Address;   { ViewPortPtr }
  92.         NormalDisplayInfo,
  93.         CoerceDisplayInfo : Address;
  94.         cm_batch_items   : Address;
  95.         VPModeID         : Integer;
  96.     end;
  97.     ColorMapPtr = ^ColorMap;
  98.  
  99. { if Type == 0 then ColorMap is V1.2/V1.3 compatible }
  100. { if Type != 0 then ColorMap is V36       compatible }
  101. { the system will never create other than V39 type colormaps when running V39 }
  102.  
  103. CONST
  104.  COLORMAP_TYPE_V1_2     = $00;
  105.  COLORMAP_TYPE_V1_4     = $01;
  106.  COLORMAP_TYPE_V36      = COLORMAP_TYPE_V1_4;    { use this definition }
  107.  COLORMAP_TYPE_V39      = $02;
  108.  
  109.  
  110. { Flags variable }
  111.  COLORMAP_TRANSPARENCY   = $01;
  112.  COLORPLANE_TRANSPARENCY = $02;
  113.  BORDER_BLANKING         = $04;
  114.  BORDER_NOTRANSPARENCY   = $08;
  115.  VIDEOCONTROL_BATCH      = $10;
  116.  USER_COPPER_CLIP        = $20;
  117.  
  118.  
  119. CONST
  120.  EXTEND_VSTRUCT = $1000;  { unused bit in Modes field of View }
  121.  
  122.  
  123. { defines used for Modes in IVPargs }
  124.  
  125. CONST
  126.  GENLOCK_VIDEO  =  $0002;
  127.  LACE           =  $0004;
  128.  SUPERHIRES     =  $0020;
  129.  PFBA           =  $0040;
  130.  EXTRA_HALFBRITE=  $0080;
  131.  GENLOCK_AUDIO  =  $0100;
  132.  DUALPF         =  $0400;
  133.  HAM            =  $0800;
  134.  EXTENDED_MODE  =  $1000;
  135.  VP_HIDE        =  $2000;
  136.  SPRITES        =  $4000;
  137.  HIRES          =  $8000;
  138.  
  139.  VPF_A2024      =  $40;
  140.  VPF_AGNUS      =  $20;
  141.  VPF_TENHZ      =  $20;
  142.  
  143.  BORDERSPRITES   = $40;
  144.  
  145.  CMF_CMTRANS   =  0;
  146.  CMF_CPTRANS   =  1;
  147.  CMF_BRDRBLNK  =  2;
  148.  CMF_BRDNTRAN  =  3;
  149.  CMF_BRDRSPRT  =  6;
  150.  
  151.  SPRITERESN_ECS       =   0;
  152. { ^140ns, except in 35ns viewport, where it is 70ns. }
  153.  SPRITERESN_140NS     =   1;
  154.  SPRITERESN_70NS      =   2;
  155.  SPRITERESN_35NS      =   3;
  156.  SPRITERESN_DEFAULT   =   -1;
  157.  
  158. { AuxFlags : }
  159.  CMAB_FULLPALETTE = 0;
  160.  CMAF_FULLPALETTE = 1;
  161.  CMAB_NO_INTERMED_UPDATE = 1;
  162.  CMAF_NO_INTERMED_UPDATE = 2;
  163.  CMAB_NO_COLOR_LOAD = 2;
  164.  CMAF_NO_COLOR_LOAD = 4;
  165.  CMAB_DUALPF_DISABLE = 3;
  166.  CMAF_DUALPF_DISABLE = 8;
  167.  
  168. Type
  169.     PaletteExtra = Record                            { structure may be extended so watch out! }
  170.         pe_Semaphore  : SignalSemaphore;                { shared semaphore for arbitration     }
  171.         pe_FirstFree,                                   { *private*                            }
  172.         pe_NFree,                                       { number of free colors                }
  173.         pe_FirstShared,                                 { *private*                            }
  174.         pe_NShared    : WORD;                           { *private*                            }
  175.         pe_RefCnt     : Address;                        { *private*                            }
  176.         pe_AllocList  : Address;                        { *private*                            }
  177.         pe_ViewPort   : ViewPortPtr;                    { back pointer to viewport             }
  178.         pe_SharableColors : WORD;                       { the number of sharable colors.       }
  179.     end;
  180.     PaletteExtraPtr = ^PaletteExtra;
  181. { flags values for ObtainPen }
  182. Const
  183.  PENB_EXCLUSIVE = 0;
  184.  PENB_NO_SETCOLOR = 1;
  185.  
  186.  PENF_EXCLUSIVE = 1;
  187.  PENF_NO_SETCOLOR = 2;
  188.  
  189. { obsolete names for PENF_xxx flags: }
  190.  
  191.  PEN_EXCLUSIVE = PENF_EXCLUSIVE;
  192.  PEN_NO_SETCOLOR = PENF_NO_SETCOLOR;
  193.  
  194. { precision values for ObtainBestPen : }
  195.  
  196.  PRECISION_EXACT = -1;
  197.  PRECISION_IMAGE = 0;
  198.  PRECISION_ICON  = 16;
  199.  PRECISION_GUI   = 32;
  200.  
  201.  
  202. { tags for ObtainBestPen: }
  203.  OBP_Precision = $84000000;
  204.  OBP_FailIfBad = $84000001;
  205.  
  206. { From V39, MakeVPort() will return an error if there is not enough memory,
  207.  * or the requested mode cannot be opened with the requested depth with the
  208.  * given bitmap (for higher bandwidth alignments).
  209.  }
  210.  
  211.  MVP_OK        =  0;       { you want to see this one }
  212.  MVP_NO_MEM    =  1;       { insufficient memory for intermediate workspace }
  213.  MVP_NO_VPE    =  2;       { ViewPort does not have a ViewPortExtra, and
  214.                                  * insufficient memory to allocate a temporary one.
  215.                                  }
  216.  MVP_NO_DSPINS =  3;       { insufficient memory for intermidiate copper
  217.                                  * instructions.
  218.                                  }
  219.  MVP_NO_DISPLAY = 4;       { BitMap data is misaligned for this viewport's
  220.                                  * mode and depth - see AllocBitMap().
  221.                                  }
  222.  MVP_OFF_BOTTOM = 5;       { PRIVATE - you will never see this. }
  223.  
  224. { From V39, MrgCop() will return an error if there is not enough memory,
  225.  * or for some reason MrgCop() did not need to make any copper lists.
  226.  }
  227.  
  228.  MCOP_OK       =  0;       { you want to see this one }
  229.  MCOP_NO_MEM   =  1;       { insufficient memory to allocate the system
  230.                                  * copper lists.
  231.                                  }
  232.  MCOP_NOP      =  2;       { MrgCop() did not merge any copper lists
  233.                                  * (eg, no ViewPorts in the list, or all marked as
  234.                                  * hidden).
  235.                                  }
  236. Type
  237.     DBufInfo = Record
  238.         dbi_Link1   : Address;
  239.         dbi_Count1  : Integer;
  240.         dbi_SafeMessage : Message;         { replied to when safe to write to old bitmap }
  241.         dbi_UserData1   : Address;                     { first user data }
  242.  
  243.         dbi_Link2   : Address;
  244.         dbi_Count2  : Integer;
  245.         dbi_DispMessage : Message; { replied to when new bitmap has been displayed at least
  246.                                                         once }
  247.         dbi_UserData2 : Address;                  { second user data }
  248.         dbi_MatchLong : Integer;
  249.         dbi_CopPtr1,
  250.         dbi_CopPtr2,
  251.         dbi_CopPtr3   : Address;
  252.         dbi_BeamPos1,
  253.         dbi_BeamPos2  : WORD;
  254.     end;
  255.     DBufInfoPtr = ^DBufInfo;
  256.  
  257.  
  258. Procedure FreeColorMap(colormap : ColorMapPtr);
  259.     External;
  260.  
  261. Procedure FreeVPortCopLists(vp : ViewPortPtr);
  262.     External;
  263.  
  264. Function GetColorMap(entries : Integer) : ColorMapPtr;
  265.     External;
  266.  
  267. Function GetRGB4(colomap : ColorMapPtr; entry : Integer) : Integer;
  268.     External;
  269.  
  270. Procedure InitView(view : ViewPtr);
  271.     External;
  272.  
  273. Procedure InitVPort(vp : ViewPortPtr);
  274.     External;
  275.  
  276. Procedure LoadRGB4(vp : ViewPortPtr; colors : Address; count : Short);
  277.     External;
  278.  
  279. Procedure LoadView(view : ViewPtr);
  280.     External;
  281.  
  282. FUNCTION MakeVPort(view : ViewPtr; viewport : ViewPortPtr) : Integer;
  283.     External;
  284.  
  285. FUNCTION MrgCop(view : ViewPtr) : Integer;
  286.     External;
  287.  
  288. Procedure ScrollVPort(vp : ViewPortPtr);
  289.     External;
  290.  
  291. Procedure SetRGB4(vp : ViewPortPtr; n : Short; r, g, b : Byte);
  292.     External;
  293.  
  294. Procedure SetRGB4CM(cm : ColorMapPtr; n : Short; r, g, b : Byte);
  295.     External;
  296.  
  297. Function VBeamPos : Integer;
  298.     External;
  299.  
  300. Procedure WaitBOVP(vp : ViewPortPtr);
  301.     External;
  302.  
  303. Procedure WaitTOF;
  304.     External;
  305.  
  306.  { New for V39 }
  307.  
  308. FUNCTION CalclIVG(v : ViewPtr; vp : ViewPortPtr) : Word;
  309.     External;
  310.  
  311. FUNCTION AttachPalExtra(cm : ColorMapPtr; vp : ViewPortPtr;) : Integer;
  312.     External;
  313.  
  314. PROCEDURE SetRGB32(VP : ViewPortPtr; n, r, g, b : Integer);
  315.     External;
  316.  
  317. PROCEDURE LoadRGB32(VP : ViewPortPtr; table : Address);
  318.     External;
  319.  
  320. PROCEDURE GetRGB32(cm : ColorMapPtr; firstcolor, ncolors : Integer; table : Address);
  321.     External;
  322.  
  323. FUNCTION AllocDBufInfo(VP : ViewPortPtr) : DBufInfoPtr;
  324.     External;
  325.  
  326. PROCEDURE FreeDBufInfo(dbi : DBufInfoPtr);
  327.     External;
  328.  
  329. PROCEDURE SetRGB32CM(CM : ColorMapPtr; n, r, g, b : Integer);
  330.     External;
  331.  
  332. FUNCTION FindColor(CM : ColorMapPtr; r, g, b, maxcolor : Integer) : Integer;
  333.     External;
  334.  
  335.  
  336.