1{ 2 Free Pascal port of the OpenPTC C++ library. 3 Copyright (C) 2001-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 31} 32 33function ptc_copy_create: TPTC_COPY; 34begin 35 try 36 ptc_copy_create := TPTC_COPY(TPTCCopy.Create); 37 except 38 on error: TPTCError do 39 begin 40 ptc_exception_handle(error); 41 ptc_copy_create := nil; 42 end; 43 end; 44end; 45 46procedure ptc_copy_destroy(obj: TPTC_COPY); 47begin 48 if obj = nil then 49 exit; 50 try 51 TPTCCopy(obj).Destroy; 52 except 53 on error: TPTCError do 54 ptc_exception_handle(error); 55 end; 56end; 57 58procedure ptc_copy_request(obj: TPTC_COPY; source, destination: TPTC_FORMAT); 59begin 60 try 61 TPTCCopy(obj).request(TPTCFormat(source), TPTCFormat(destination)); 62 except 63 on error: TPTCError do 64 ptc_exception_handle(error); 65 end; 66end; 67 68procedure ptc_copy_palette(obj: TPTC_COPY; source, destination: TPTC_PALETTE); 69begin 70 try 71 TPTCCopy(obj).palette(TPTCPalette(source), TPTCPalette(destination)); 72 except 73 on error: TPTCError do 74 ptc_exception_handle(error); 75 end; 76end; 77 78procedure ptc_copy_copy(obj: TPTC_COPY; source_pixels: Pointer; source_x, source_y, source_width, source_height, source_pitch: Integer; 79 destination_pixels: Pointer; destination_x, destination_y, destination_width, destination_height, destination_pitch: Integer); 80begin 81 try 82 TPTCCopy(obj).copy(source_pixels, source_x, source_y, source_width, source_height, source_pitch, destination_pixels, destination_x, destination_y, destination_width, destination_height, destination_pitch); 83 except 84 on error: TPTCError do 85 ptc_exception_handle(error); 86 end; 87end; 88 89function ptc_copy_option(obj: TPTC_COPY; option: String): Boolean; 90begin 91 try 92 TPTCCopy(obj).option(option); 93 except 94 on error: TPTCError do 95 begin 96 ptc_exception_handle(error); 97 ptc_copy_option := False; 98 end; 99 end; 100end; 101