areai.inc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {
  2. Free Pascal port of the OpenPTC C++ library.
  3. Copyright (C) 2001-2006 Nikolay Nikolov ([email protected])
  4. Original C++ version by Glenn Fiedler ([email protected])
  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. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. }
  17. Constructor TPTCArea.Create(ALeft, ATop, ARight, ABottom : Integer);
  18. Begin
  19. If ALeft < ARight Then
  20. Begin
  21. FLeft := ALeft;
  22. FRight := ARight;
  23. End
  24. Else
  25. Begin
  26. FLeft := ARight;
  27. FRight := ALeft;
  28. End;
  29. If ATop < ABottom Then
  30. Begin
  31. FTop := ATop;
  32. FBottom := ABottom;
  33. End
  34. Else
  35. Begin
  36. FTop := ABottom;
  37. FBottom := ATop;
  38. End;
  39. End;
  40. Constructor TPTCArea.Create;
  41. Begin
  42. FLeft := 0;
  43. FRight := 0;
  44. FTop := 0;
  45. FBottom := 0;
  46. End;
  47. Constructor TPTCArea.Create(Const AArea : TPTCArea);
  48. Begin
  49. FLeft := AArea.FLeft;
  50. FTop := AArea.FTop;
  51. FRight := AArea.FRight;
  52. FBottom := AArea.FBottom;
  53. End;
  54. Procedure TPTCArea.Assign(Const AArea : TPTCArea);
  55. Begin
  56. FLeft := AArea.FLeft;
  57. FTop := AArea.FTop;
  58. FRight := AArea.FRight;
  59. FBottom := AArea.FBottom;
  60. End;
  61. Function TPTCArea.Equals(Const AArea : TPTCArea) : Boolean;
  62. Begin
  63. Result := (FLeft = AArea.FLeft) And
  64. (FTop = AArea.FTop) And
  65. (FRight = AArea.FRight) And
  66. (FBottom = AArea.FBottom);
  67. End;
  68. Function TPTCArea.GetWidth : Integer;
  69. Begin
  70. Result := FRight - FLeft;
  71. End;
  72. Function TPTCArea.GetHeight : Integer;
  73. Begin
  74. Result := FBottom - FTop;
  75. End;