format.inc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. Function ptc_format_create : TPTC_FORMAT;
  2. Begin
  3. Try
  4. ptc_format_create := TPTC_FORMAT(TPTCFormat.Create);
  5. Except
  6. On error : TPTCError Do
  7. Begin
  8. ptc_exception_handle(error);
  9. ptc_format_create := Nil;
  10. End;
  11. End;
  12. End;
  13. Function ptc_format_create_indexed(bits : Integer) : TPTC_FORMAT;
  14. Begin
  15. Try
  16. ptc_format_create_indexed := TPTC_FORMAT(TPTCFormat.Create(bits));
  17. Except
  18. On error : TPTCError Do
  19. Begin
  20. ptc_exception_handle(error);
  21. ptc_format_create_indexed := Nil;
  22. End;
  23. End;
  24. End;
  25. Function ptc_format_create_direct(bits : Integer; r, g, b, a : int32) : TPTC_FORMAT;
  26. Begin
  27. Try
  28. ptc_format_create_direct := TPTC_FORMAT(TPTCFormat.Create(bits, r, g, b, a));
  29. Except
  30. On error : TPTCError Do
  31. Begin
  32. ptc_exception_handle(error);
  33. ptc_format_create_direct := Nil;
  34. End;
  35. End;
  36. End;
  37. Procedure ptc_format_destroy(obj : TPTC_FORMAT);
  38. Begin
  39. If obj = Nil Then
  40. Exit;
  41. Try
  42. TPTCFormat(obj).Destroy;
  43. Except
  44. On error : TPTCError Do
  45. ptc_exception_handle(error);
  46. End;
  47. End;
  48. Function ptc_format_r(obj : TPTC_FORMAT) : int32;
  49. Begin
  50. Try
  51. ptc_format_r := TPTCFormat(obj).r;
  52. Except
  53. On error : TPTCError Do
  54. Begin
  55. ptc_exception_handle(error);
  56. ptc_format_r := 0;
  57. End;
  58. End;
  59. End;
  60. Function ptc_format_g(obj : TPTC_FORMAT) : int32;
  61. Begin
  62. Try
  63. ptc_format_g := TPTCFormat(obj).g;
  64. Except
  65. On error : TPTCError Do
  66. Begin
  67. ptc_exception_handle(error);
  68. ptc_format_g := 0;
  69. End;
  70. End;
  71. End;
  72. Function ptc_format_b(obj : TPTC_FORMAT) : int32;
  73. Begin
  74. Try
  75. ptc_format_b := TPTCFormat(obj).b;
  76. Except
  77. On error : TPTCError Do
  78. Begin
  79. ptc_exception_handle(error);
  80. ptc_format_b := 0;
  81. End;
  82. End;
  83. End;
  84. Function ptc_format_a(obj : TPTC_FORMAT) : int32;
  85. Begin
  86. Try
  87. ptc_format_a := TPTCFormat(obj).a;
  88. Except
  89. On error : TPTCError Do
  90. Begin
  91. ptc_exception_handle(error);
  92. ptc_format_a := 0;
  93. End;
  94. End;
  95. End;
  96. Function ptc_format_bits(obj : TPTC_FORMAT) : Integer;
  97. Begin
  98. Try
  99. ptc_format_bits := TPTCFormat(obj).bits;
  100. Except
  101. On error : TPTCError Do
  102. Begin
  103. ptc_exception_handle(error);
  104. ptc_format_bits := 0;
  105. End;
  106. End;
  107. End;
  108. Function ptc_format_bytes(obj : TPTC_FORMAT) : Integer;
  109. Begin
  110. Try
  111. ptc_format_bytes := TPTCFormat(obj).bytes;
  112. Except
  113. On error : TPTCError Do
  114. Begin
  115. ptc_exception_handle(error);
  116. ptc_format_bytes := 0;
  117. End;
  118. End;
  119. End;
  120. Function ptc_format_direct(obj : TPTC_FORMAT) : Boolean;
  121. Begin
  122. Try
  123. ptc_format_direct := TPTCFormat(obj).direct;
  124. Except
  125. On error : TPTCError Do
  126. Begin
  127. ptc_exception_handle(error);
  128. ptc_format_direct := False;
  129. End;
  130. End;
  131. End;
  132. Function ptc_format_indexed(obj : TPTC_FORMAT) : Boolean;
  133. Begin
  134. Try
  135. ptc_format_indexed := TPTCFormat(obj).indexed;
  136. Except
  137. On error : TPTCError Do
  138. Begin
  139. ptc_exception_handle(error);
  140. ptc_format_indexed := False;
  141. End;
  142. End;
  143. End;
  144. Procedure ptc_format_assign(obj, format : TPTC_FORMAT);
  145. Begin
  146. Try
  147. TPTCFormat(obj).ASSign(TPTCFormat(format));
  148. Except
  149. On error : TPTCError Do
  150. ptc_exception_handle(error);
  151. End;
  152. End;
  153. Function ptc_format_equals(obj, format : TPTC_FORMAT) : Boolean;
  154. Begin
  155. Try
  156. ptc_format_equals := TPTCFormat(obj).Equals(TPTCFormat(format));
  157. Except
  158. On error : TPTCError Do
  159. Begin
  160. ptc_exception_handle(error);
  161. ptc_format_equals := False;
  162. End;
  163. End;
  164. End;