PageRenderTime 35ms CodeModel.GetById 21ms app.highlight 13ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/ptc/src/win32/directx/win32directxprimaryd.inc

https://github.com/slibre/freepascal
Pascal | 128 lines | 71 code | 26 blank | 31 comment | 0 complexity | cbced57e3ef6ceaff861a47da297aa2b MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1{
  2    Free Pascal port of the OpenPTC C++ library.
  3    Copyright (C) 2001-2003, 2006, 2009-2012  Nikolay Nikolov (nickysn@users.sourceforge.net)
  4    Original C++ version by Glenn Fiedler (ptc@gaffer.org)
  5
  6    This library is free software; you can redistribute it and/or
  7    modify it under the terms of the GNU Lesser General Public
  8    License as published by the Free Software Foundation; either
  9    version 2.1 of the License, or (at your option) any later version
 10    with the following modification:
 11
 12    As a special exception, the copyright holders of this library give you
 13    permission to link this library with independent modules to produce an
 14    executable, regardless of the license terms of these independent modules,and
 15    to copy and distribute the resulting executable under terms of your choice,
 16    provided that you also meet, for each linked independent module, the terms
 17    and conditions of the license of that module. An independent module is a
 18    module which is not derived from or based on this library. If you modify
 19    this library, you may extend this exception to your version of the library,
 20    but you are not obligated to do so. If you do not wish to do so, delete this
 21    exception statement from your version.
 22
 23    This library is distributed in the hope that it will be useful,
 24    but WITHOUT ANY WARRANTY; without even the implied warranty of
 25    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 26    Lesser General Public License for more details.
 27
 28    You should have received a copy of the GNU Lesser General Public
 29    License along with this library; if not, write to the Free Software
 30    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 31}
 32
 33type
 34  TDirectXPrimary = class
 35  private
 36    FWidth: Integer;
 37    FHeight: Integer;
 38    FPages: Integer;
 39    FArea: IPTCArea;
 40    FClip: IPTCArea;
 41    FFormat: IPTCFormat;
 42
 43    FActive: Boolean;
 44    FBlocking: Boolean;
 45    FCentering: Boolean;
 46    FFullscreen: Boolean;
 47    FSynchronize: Boolean;
 48
 49    FClear: TPTCClear;
 50
 51    FWindow: TWin32Window;
 52
 53    FLocked: Pointer;
 54
 55    FPalette: IPTCPalette;
 56
 57    FPrimaryWidth: Integer;
 58    FPrimaryHeight: Integer;
 59
 60    FSecondaryWidth: Integer;
 61    FSecondaryHeight: Integer;
 62
 63    FDD2: IDirectDraw2;
 64
 65    FDDSPrimary: IDirectDrawSurface;
 66    FDDSPrimaryBack: IDirectDrawSurface;
 67    FDDSPrimaryPage: array [0..31] of IDirectDrawSurface;
 68
 69    FDDSSecondary: IDirectDrawSurface;
 70
 71    FDDC: IDirectDrawClipper;
 72
 73    FBack, FFront: IDirectDrawSurface;
 74
 75    function Pack(const AColor: IPTCColor; const AFormat: IPTCFormat): Uint32;
 76    procedure Analyse(AMask: Uint32; out ABase, ASize: Integer);
 77    function GetDDS: IDirectDrawSurface;
 78    function GetPitch: Integer;
 79  public
 80    constructor Create;
 81    destructor Destroy; override;
 82
 83    procedure Initialize(AWindow: TWin32Window; const ADDraw2: IDirectDraw2);
 84    procedure Primary(APages: Integer; AVideo, AFullscreen, APalette, AComplex: Boolean);
 85    procedure Secondary(AWidth, AHeight: Integer);
 86    procedure Synchronize(AUpdate: Boolean);
 87    procedure Centering(ACenter: Boolean);
 88    procedure Close;
 89
 90    procedure Update;
 91
 92    function Lock: Pointer;
 93    procedure Unlock;
 94
 95    procedure Clear;
 96    procedure Clear(AColor: IPTCColor; const AArea: IPTCArea);
 97
 98    procedure Palette(APalette: IPTCPalette);
 99    procedure ResetPalette;
100    function Palette: IPTCPalette;
101
102    procedure Clip(const AArea: IPTCArea);
103
104    property Width: Integer read FWidth;
105    property Height: Integer read FHeight;
106    property Pages: Integer read FPages;
107    property Pitch: Integer read GetPitch;
108    property Area: IPTCArea read FArea;
109    function Clip: IPTCArea;
110    property Format: IPTCFormat read FFormat;
111
112    property DDS: IDirectDrawSurface read GetDDS;
113    property DDSPrimary: IDirectDrawSurface read FDDSPrimary;
114    property DDSSecondary: IDirectDrawSurface read FDDSSecondary;
115
116    procedure Activate;
117    procedure Deactivate;
118    property Active: Boolean read FActive;
119    procedure Block;
120    procedure Save;
121    procedure Restore;
122
123    procedure Paint;
124
125    procedure Blocking(ABlocking: Boolean);
126    
127    property Fullscreen: Boolean read FFullscreen;
128  end;