2
0

capi_area.inc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. {
  2. Free Pascal port of the OpenPTC C++ library.
  3. Copyright (C) 2001-2010 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. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  27. }
  28. function ptc_area_create(left, top, right, bottom: Integer): TPTC_AREA;
  29. begin
  30. try
  31. ptc_area_create := TPTC_AREA(TPTCArea.Create(left, top, right, bottom));
  32. except
  33. on error: TPTCError do
  34. begin
  35. ptc_exception_handle(error);
  36. ptc_area_create := nil;
  37. end;
  38. end;
  39. end;
  40. procedure ptc_area_destroy(obj: TPTC_AREA);
  41. begin
  42. if obj = nil then
  43. exit;
  44. try
  45. TPTCArea(obj).Destroy;
  46. except
  47. on error: TPTCError do
  48. begin
  49. ptc_exception_handle(error);
  50. end;
  51. end;
  52. end;
  53. function ptc_area_left(obj: TPTC_AREA): Integer;
  54. begin
  55. try
  56. ptc_area_left := TPTCArea(obj).left;
  57. except
  58. on error: TPTCError do
  59. begin
  60. ptc_exception_handle(error);
  61. ptc_area_left := 0;
  62. end;
  63. end;
  64. end;
  65. function ptc_area_top(obj: TPTC_AREA): Integer;
  66. begin
  67. try
  68. ptc_area_top := TPTCArea(obj).top;
  69. except
  70. on error: TPTCError do
  71. begin
  72. ptc_exception_handle(error);
  73. ptc_area_top := 0;
  74. end;
  75. end;
  76. end;
  77. function ptc_area_right(obj: TPTC_AREA): Integer;
  78. begin
  79. try
  80. ptc_area_right := TPTCArea(obj).right;
  81. except
  82. on error: TPTCError do
  83. begin
  84. ptc_exception_handle(error);
  85. ptc_area_right := 0;
  86. end;
  87. end;
  88. end;
  89. function ptc_area_bottom(obj: TPTC_AREA): Integer;
  90. begin
  91. try
  92. ptc_area_bottom := TPTCArea(obj).bottom;
  93. except
  94. on error: TPTCError do
  95. begin
  96. ptc_exception_handle(error);
  97. ptc_area_bottom := 0;
  98. end;
  99. end;
  100. end;
  101. function ptc_area_width(obj: TPTC_AREA): Integer;
  102. begin
  103. try
  104. ptc_area_width := TPTCArea(obj).width;
  105. except
  106. on error: TPTCError do
  107. begin
  108. ptc_exception_handle(error);
  109. ptc_area_width := 0;
  110. end;
  111. end;
  112. end;
  113. function ptc_area_height(obj: TPTC_AREA): Integer;
  114. begin
  115. try
  116. ptc_area_height := TPTCArea(obj).height;
  117. except
  118. on error: TPTCError do
  119. begin
  120. ptc_exception_handle(error);
  121. ptc_area_height := 0;
  122. end;
  123. end;
  124. end;
  125. procedure ptc_area_assign(obj, area: TPTC_AREA);
  126. begin
  127. try
  128. TPTCArea(obj).Assign(TPTCArea(area));
  129. except
  130. on error: TPTCError do
  131. begin
  132. ptc_exception_handle(error);
  133. end;
  134. end;
  135. end;
  136. function ptc_area_equals(obj, area: TPTC_AREA): Boolean;
  137. begin
  138. try
  139. ptc_area_equals := TPTCArea(obj).Equals(TPTCArea(area));
  140. except
  141. on error: TPTCError do
  142. begin
  143. ptc_exception_handle(error);
  144. ptc_area_equals := False;
  145. end;
  146. end;
  147. end;