/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

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