diff options
| author | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-10-12 14:38:27 +0000 |
|---|---|---|
| committer | nickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-10-12 14:38:27 +0000 |
| commit | 0819c607862b9ae19712ebe99daee96fe8c7bdb9 (patch) | |
| tree | e910fc2edfd3522ebee77a23ff9975feb64640f1 /packages/ptc | |
| parent | a7c5ae1f3064537f928d8e17c60a62b05d197bcf (diff) | |
| download | fpc-0819c607862b9ae19712ebe99daee96fe8c7bdb9.tar.gz | |
* updated ptc c_api
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16143 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/ptc')
57 files changed, 3114 insertions, 2345 deletions
diff --git a/packages/ptc/src/c_api/area.inc b/packages/ptc/src/c_api/area.inc deleted file mode 100644 index eca3130933..0000000000 --- a/packages/ptc/src/c_api/area.inc +++ /dev/null @@ -1,140 +0,0 @@ -Function ptc_area_create(left, top, right, bottom : Integer) : TPTC_AREA; - -Begin - Try - ptc_area_create := TPTC_AREA(TPTCArea.Create(left, top, right, bottom)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_area_create := Nil; - End; - End; -End; - -Procedure ptc_area_destroy(obj : TPTC_AREA); - -Begin - If obj = Nil Then - Exit; - Try - TPTCArea(obj).Destroy; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - End; - End; -End; - -Function ptc_area_left(obj : TPTC_AREA) : Integer; - -Begin - Try - ptc_area_left := TPTCArea(obj).left; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_area_left := 0; - End; - End; -End; - -Function ptc_area_top(obj : TPTC_AREA) : Integer; - -Begin - Try - ptc_area_top := TPTCArea(obj).top; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_area_top := 0; - End; - End; -End; - -Function ptc_area_right(obj : TPTC_AREA) : Integer; - -Begin - Try - ptc_area_right := TPTCArea(obj).right; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_area_right := 0; - End; - End; -End; - -Function ptc_area_bottom(obj : TPTC_AREA) : Integer; - -Begin - Try - ptc_area_bottom := TPTCArea(obj).bottom; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_area_bottom := 0; - End; - End; -End; - -Function ptc_area_width(obj : TPTC_AREA) : Integer; - -Begin - Try - ptc_area_width := TPTCArea(obj).width; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_area_width := 0; - End; - End; -End; - -Function ptc_area_height(obj : TPTC_AREA) : Integer; - -Begin - Try - ptc_area_height := TPTCArea(obj).height; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_area_height := 0; - End; - End; -End; - -Procedure ptc_area_assign(obj, area : TPTC_AREA); - -Begin - Try - TPTCArea(obj).ASSign(TPTCArea(area)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - End; - End; -End; - -Function ptc_area_equals(obj, area : TPTC_AREA) : Boolean; - -Begin - Try - ptc_area_equals := TPTCArea(obj).Equals(TPTCArea(area)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_area_equals := False; - End; - End; -End; - diff --git a/packages/ptc/src/c_api/aread.inc b/packages/ptc/src/c_api/aread.inc deleted file mode 100644 index 2703b9146a..0000000000 --- a/packages/ptc/src/c_api/aread.inc +++ /dev/null @@ -1,15 +0,0 @@ -{ setup } -Function ptc_area_create(left, top, right, bottom : Integer) : TPTC_AREA; -Procedure ptc_area_destroy(obj : TPTC_AREA); - -{ data access } -Function ptc_area_left(obj : TPTC_AREA) : Integer; -Function ptc_area_top(obj : TPTC_AREA) : Integer; -Function ptc_area_right(obj : TPTC_AREA) : Integer; -Function ptc_area_bottom(obj : TPTC_AREA) : Integer; -Function ptc_area_width(obj : TPTC_AREA) : Integer; -Function ptc_area_height(obj : TPTC_AREA) : Integer; - -{ operators } -Procedure ptc_area_assign(obj, area : TPTC_AREA); -Function ptc_area_equals(obj, area : TPTC_AREA) : Boolean; diff --git a/packages/ptc/src/c_api/capi_area.inc b/packages/ptc/src/c_api/capi_area.inc new file mode 100644 index 0000000000..1e746e12c5 --- /dev/null +++ b/packages/ptc/src/c_api/capi_area.inc @@ -0,0 +1,161 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_area_create(left, top, right, bottom: Integer): TPTC_AREA; +begin + try + ptc_area_create := TPTC_AREA(TPTCArea.Create(left, top, right, bottom)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_area_create := nil; + end; + end; +end; + +procedure ptc_area_destroy(obj: TPTC_AREA); +begin + if obj = nil then + exit; + try + TPTCArea(obj).Destroy; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + end; + end; +end; + +function ptc_area_left(obj: TPTC_AREA): Integer; +begin + try + ptc_area_left := TPTCArea(obj).left; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_area_left := 0; + end; + end; +end; + +function ptc_area_top(obj: TPTC_AREA): Integer; +begin + try + ptc_area_top := TPTCArea(obj).top; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_area_top := 0; + end; + end; +end; + +function ptc_area_right(obj: TPTC_AREA): Integer; +begin + try + ptc_area_right := TPTCArea(obj).right; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_area_right := 0; + end; + end; +end; + +function ptc_area_bottom(obj: TPTC_AREA): Integer; +begin + try + ptc_area_bottom := TPTCArea(obj).bottom; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_area_bottom := 0; + end; + end; +end; + +function ptc_area_width(obj: TPTC_AREA): Integer; +begin + try + ptc_area_width := TPTCArea(obj).width; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_area_width := 0; + end; + end; +end; + +function ptc_area_height(obj: TPTC_AREA): Integer; +begin + try + ptc_area_height := TPTCArea(obj).height; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_area_height := 0; + end; + end; +end; + +procedure ptc_area_assign(obj, area: TPTC_AREA); +begin + try + TPTCArea(obj).Assign(TPTCArea(area)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + end; + end; +end; + +function ptc_area_equals(obj, area: TPTC_AREA): Boolean; +begin + try + ptc_area_equals := TPTCArea(obj).Equals(TPTCArea(area)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_area_equals := False; + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_aread.inc b/packages/ptc/src/c_api/capi_aread.inc new file mode 100644 index 0000000000..be1f490519 --- /dev/null +++ b/packages/ptc/src/c_api/capi_aread.inc @@ -0,0 +1,47 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_area_create(left, top, right, bottom: Integer): TPTC_AREA; +procedure ptc_area_destroy(obj: TPTC_AREA); + +{ data access } +function ptc_area_left(obj: TPTC_AREA): Integer; +function ptc_area_top(obj: TPTC_AREA): Integer; +function ptc_area_right(obj: TPTC_AREA): Integer; +function ptc_area_bottom(obj: TPTC_AREA): Integer; +function ptc_area_width(obj: TPTC_AREA): Integer; +function ptc_area_height(obj: TPTC_AREA): Integer; + +{ operators } +procedure ptc_area_assign(obj, area: TPTC_AREA); +function ptc_area_equals(obj, area: TPTC_AREA): Boolean; diff --git a/packages/ptc/src/c_api/capi_clear.inc b/packages/ptc/src/c_api/capi_clear.inc new file mode 100644 index 0000000000..2a014eece9 --- /dev/null +++ b/packages/ptc/src/c_api/capi_clear.inc @@ -0,0 +1,76 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_clear_create: TPTC_CLEAR; +begin + try + ptc_clear_create := TPTC_CLEAR(TPTCClear.Create); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_clear_create := nil; + end; + end; +end; + +procedure ptc_clear_destroy(obj: TPTC_CLEAR); +begin + if obj = nil then + exit; + try + TPTCClear(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_clear_request(obj: TPTC_CLEAR; format: TPTC_FORMAT); +begin + try + TPTCClear(obj).request(TPTCFormat(format)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_clear_clear(obj: TPTC_CLEAR; pixels: Pointer; x, y, width, height, pitch: Integer; color: TPTC_COLOR); +begin + try + TPTCClear(obj).clear(pixels, x, y, width, height, pitch, TPTCColor(color)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; diff --git a/packages/ptc/src/c_api/capi_cleard.inc b/packages/ptc/src/c_api/capi_cleard.inc new file mode 100644 index 0000000000..3129bddb87 --- /dev/null +++ b/packages/ptc/src/c_api/capi_cleard.inc @@ -0,0 +1,41 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_clear_create: TPTC_CLEAR; +procedure ptc_clear_destroy(obj: TPTC_CLEAR); + +{ request clear } +procedure ptc_clear_request(obj: TPTC_CLEAR; format: TPTC_FORMAT); + +{ clear pixels } +procedure ptc_clear_clear(obj: TPTC_CLEAR; pixels: Pointer; x, y, width, height, pitch: Integer; color: TPTC_COLOR); diff --git a/packages/ptc/src/c_api/capi_clipper.inc b/packages/ptc/src/c_api/capi_clipper.inc new file mode 100644 index 0000000000..43128960b4 --- /dev/null +++ b/packages/ptc/src/c_api/capi_clipper.inc @@ -0,0 +1,62 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +procedure ptc_clipper_clip(area, clip, clipped: TPTC_AREA); +var + tmp: TPTCArea; +begin + try + tmp := TPTCClipper.clip(TPTCArea(area), TPTCArea(clip)); + try + TPTCArea(clipped).Assign(tmp); + finally + tmp.Destroy; + end; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + end; + end; +end; + +procedure ptc_clipper_clip_complex(source, clip_source, clipped_source, destination, clip_destination, clipped_destination: TPTC_AREA); +begin + try + TPTCClipper.clip(TPTCArea(source), TPTCArea(clip_source), TPTCArea(clipped_source), TPTCArea(destination), TPTCArea(clip_destination), TPTCArea(clipped_destination)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_clipperd.inc b/packages/ptc/src/c_api/capi_clipperd.inc new file mode 100644 index 0000000000..045a25dbc4 --- /dev/null +++ b/packages/ptc/src/c_api/capi_clipperd.inc @@ -0,0 +1,37 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ clip a single area against clip area } +procedure ptc_clipper_clip(area, clip, clipped: TPTC_AREA); + +{ clip source and destination areas against source and destination clip areas } +procedure ptc_clipper_clip_complex(source, clip_source, clipped_source, destination, clip_destination, clipped_destination: TPTC_AREA); diff --git a/packages/ptc/src/c_api/capi_color.inc b/packages/ptc/src/c_api/capi_color.inc new file mode 100644 index 0000000000..50a15ee4ce --- /dev/null +++ b/packages/ptc/src/c_api/capi_color.inc @@ -0,0 +1,196 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_color_create: TPTC_COLOR; +begin + try + ptc_color_create := TPTC_COLOR(TPTCColor.Create); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_create := nil; + end; + end; +end; + +function ptc_color_create_indexed(index: Integer): TPTC_COLOR; +begin + try + ptc_color_create_indexed := TPTC_COLOR(TPTCColor.Create(index)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_create_indexed := nil; + end; + end; +end; + +function ptc_color_create_direct(r, g, b, a: Single): TPTC_COLOR; +begin + try + ptc_color_create_direct := TPTC_COLOR(TPTCColor.Create(r, g, b, a)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_create_direct := nil; + end; + end; +end; + +procedure ptc_color_destroy(obj: TPTC_COLOR); +begin + if obj = nil then + exit; + try + TPTCColor(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_color_index(obj: TPTC_COLOR): Integer; +begin + try + ptc_color_index := TPTCColor(obj).index; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_index := 0; + end; + end; +end; + +function ptc_color_r(obj: TPTC_COLOR): Single; +begin + try + ptc_color_r := TPTCColor(obj).r; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_r := 0; + end; + end; +end; + +function ptc_color_g(obj: TPTC_COLOR): Single; +begin + try + ptc_color_g := TPTCColor(obj).g; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_g := 0; + end; + end; +end; + +function ptc_color_b(obj: TPTC_COLOR): Single; +begin + try + ptc_color_b := TPTCColor(obj).b; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_b := 0; + end; + end; +end; + +function ptc_color_a(obj: TPTC_COLOR): Single; +begin + try + ptc_color_a := TPTCColor(obj).a; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_a := 0; + end; + end; +end; + +function ptc_color_direct(obj: TPTC_COLOR): Boolean; +begin + try + ptc_color_direct := TPTCColor(obj).direct; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_direct := False; + end; + end; +end; + +function ptc_color_indexed(obj: TPTC_COLOR): Boolean; +begin + try + ptc_color_indexed := TPTCColor(obj).indexed; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_indexed := False; + end; + end; +end; + +procedure ptc_color_assign(obj, color: TPTC_COLOR); +begin + try + TPTCColor(obj).Assign(TPTCColor(color)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_color_equals(obj, color: TPTC_COLOR): Boolean; +begin + try + ptc_color_equals := TPTCColor(obj).Equals(TPTCColor(color)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_color_equals := False; + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_colord.inc b/packages/ptc/src/c_api/capi_colord.inc new file mode 100644 index 0000000000..7de056d34e --- /dev/null +++ b/packages/ptc/src/c_api/capi_colord.inc @@ -0,0 +1,50 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_color_create: TPTC_COLOR; +function ptc_color_create_indexed(index: Integer): TPTC_COLOR; +function ptc_color_create_direct(r, g, b, a: Single): TPTC_COLOR; +procedure ptc_color_destroy(obj: TPTC_COLOR); + +{ data access } +function ptc_color_index(obj: TPTC_COLOR): Integer; +function ptc_color_r(obj: TPTC_COLOR): Single; +function ptc_color_g(obj: TPTC_COLOR): Single; +function ptc_color_b(obj: TPTC_COLOR): Single; +function ptc_color_a(obj: TPTC_COLOR): Single; +function ptc_color_direct(obj: TPTC_COLOR): Boolean; +function ptc_color_indexed(obj: TPTC_COLOR): Boolean; + +{ operators } +procedure ptc_color_assign(obj, color: TPTC_COLOR); +function ptc_color_equals(obj, color: TPTC_COLOR): Boolean; diff --git a/packages/ptc/src/c_api/capi_console.inc b/packages/ptc/src/c_api/capi_console.inc new file mode 100644 index 0000000000..f8a4a17cd6 --- /dev/null +++ b/packages/ptc/src/c_api/capi_console.inc @@ -0,0 +1,488 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_console_create: TPTC_CONSOLE; +begin + try + ptc_console_create := TPTC_CONSOLE(TPTCConsole.Create); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_create := nil; + end; + end; +end; + +procedure ptc_console_destroy(obj: TPTC_CONSOLE); +begin + if obj = nil then + exit; + try + TPTCBaseConsole(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_configure(obj: TPTC_CONSOLE; _file: String); +begin + try + TPTCBaseConsole(obj).configure(_file); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_console_option(obj: TPTC_CONSOLE; _option: String): Boolean; +begin + try + ptc_console_option := TPTCBaseConsole(obj).option(_option); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_option := False; + end; + end; +end; + +function ptc_console_mode(obj: TPTC_CONSOLE; index: Integer): TPTC_MODE; +begin + try + ptc_console_mode := TPTC_MODE(TPTCBaseConsole(obj).modes[index]); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_mode := nil; + end; + end; +end; + +procedure ptc_console_open(obj: TPTC_CONSOLE; title: string; pages: Integer); +begin + try + TPTCBaseConsole(obj).open(title, pages); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_open_format(obj: TPTC_CONSOLE; title: string; format: TPTC_FORMAT; pages: Integer); +begin + try + TPTCBaseConsole(obj).open(title, TPTCFormat(format), pages); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_open_resolution(obj: TPTC_CONSOLE; title: string; width, height: Integer; format: TPTC_FORMAT; pages: Integer); +begin + try + TPTCBaseConsole(obj).open(title, width, height, TPTCFormat(format), pages); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_open_mode(obj: TPTC_CONSOLE; title: string; mode: TPTC_MODE; pages: Integer); +begin + try + TPTCBaseConsole(obj).open(title, TPTCMode(mode), pages); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_close(obj: TPTC_CONSOLE); +begin + try + TPTCBaseConsole(obj).close; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_flush(obj: TPTC_CONSOLE); +begin + try + TPTCBaseConsole(obj).flush; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_finish(obj: TPTC_CONSOLE); +begin + try + TPTCBaseConsole(obj).finish; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_update(obj: TPTC_CONSOLE); +begin + try + TPTCBaseConsole(obj).update; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_update_area(obj: TPTC_CONSOLE; area: TPTC_AREA); +begin + try + TPTCBaseConsole(obj).update(TPTCArea(area)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_console_key(obj: TPTC_CONSOLE): Boolean; +begin + try + ptc_console_key := TPTCBaseConsole(obj).key; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_key := False; + end; + end; +end; + +procedure ptc_console_read(obj: TPTC_CONSOLE; key: TPTC_KEY); +var + tmp: TPTCKeyEvent; +begin + try + tmp := TPTCBaseConsole(obj).read; + try + TPTCKeyEvent(key).Assign(tmp); + finally + tmp.Destroy; + end; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_copy(obj: TPTC_CONSOLE; surface: TPTC_SURFACE); +begin + try + TPTCBaseConsole(obj).copy(TPTCBaseSurface(surface)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_copy_area(obj: TPTC_CONSOLE; surface: TPTC_SURFACE; source, destination: TPTC_AREA); +begin + try + TPTCBaseConsole(obj).copy(TPTCBaseSurface(surface), TPTCArea(source), TPTCArea(destination)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_console_lock(obj: TPTC_CONSOLE): Pointer; +begin + try + ptc_console_lock := TPTCBaseConsole(obj).lock; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_lock := nil; + end; + end; +end; + +procedure ptc_console_unlock(obj: TPTC_CONSOLE); +begin + try + TPTCBaseConsole(obj).unlock; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_load(obj: TPTC_CONSOLE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE); +begin + try + TPTCBaseConsole(obj).load(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_load_area(obj: TPTC_CONSOLE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE; source, destination: TPTC_AREA); +begin + try + TPTCBaseConsole(obj).load(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette), TPTCArea(source), TPTCArea(destination)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_save(obj: TPTC_CONSOLE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE); +begin + try + TPTCBaseConsole(obj).save(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_save_area(obj: TPTC_CONSOLE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE; source, destination: TPTC_AREA); +begin + try + TPTCBaseConsole(obj).save(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette), TPTCArea(source), TPTCArea(destination)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_clear(obj: TPTC_CONSOLE); +begin + try + TPTCBaseConsole(obj).clear; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_clear_color(obj: TPTC_CONSOLE; color: TPTC_COLOR); +begin + try + TPTCBaseConsole(obj).clear(TPTCColor(color)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_clear_color_area(obj: TPTC_CONSOLE; color: TPTC_COLOR; area: TPTC_AREA); +begin + try + TPTCBaseConsole(obj).clear(TPTCColor(color), TPTCArea(area)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_console_palette_set(obj: TPTC_CONSOLE; palette: TPTC_PALETTE); +begin + try + TPTCBaseConsole(obj).palette(TPTCPalette(palette)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_console_palette_get(obj: TPTC_CONSOLE): TPTC_PALETTE; +begin + try + ptc_console_palette_get := TPTC_PALETTE(TPTCBaseConsole(obj).palette); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_palette_get := nil; + end; + end; +end; + +procedure ptc_console_clip_set(obj: TPTC_CONSOLE; area: TPTC_AREA); +begin + try + TPTCBaseConsole(obj).clip(TPTCArea(area)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_console_width(obj: TPTC_CONSOLE): Integer; +begin + try + ptc_console_width := TPTCBaseConsole(obj).width; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_width := 0; + end; + end; +end; + +function ptc_console_height(obj: TPTC_CONSOLE): Integer; +begin + try + ptc_console_height := TPTCBaseConsole(obj).height; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_height := 0; + end; + end; +end; + +function ptc_console_pages(obj: TPTC_CONSOLE): Integer; +begin + try + ptc_console_pages := TPTCBaseConsole(obj).pages; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_pages := 0; + end; + end; +end; + +function ptc_console_pitch(obj: TPTC_CONSOLE): Integer; +begin + try + ptc_console_pitch := TPTCBaseConsole(obj).pitch; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_pitch := 0; + end; + end; +end; + +function ptc_console_area(obj: TPTC_CONSOLE): TPTC_AREA; +begin + try + ptc_console_area := TPTC_AREA(TPTCBaseConsole(obj).area); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_area := nil; + end; + end; +end; + +function ptc_console_clip(obj: TPTC_CONSOLE): TPTC_AREA; +begin + try + ptc_console_clip := TPTC_AREA(TPTCBaseConsole(obj).clip); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_clip := nil; + end; + end; +end; + +function ptc_console_format(obj: TPTC_CONSOLE): TPTC_FORMAT; +begin + try + ptc_console_format := TPTC_FORMAT(TPTCBaseConsole(obj).format); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_format := nil; + end; + end; +end; + +function ptc_console_name(obj: TPTC_CONSOLE): string; +begin + try + ptc_console_name := TPTCBaseConsole(obj).name; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_name := ''; + end; + end; +end; + +function ptc_console_title(obj: TPTC_CONSOLE): string; +begin + try + ptc_console_title := TPTCBaseConsole(obj).title; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_title := ''; + end; + end; +end; + +function ptc_console_information(obj: TPTC_CONSOLE): string; +begin + try + ptc_console_information := TPTCBaseConsole(obj).information; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_console_information := ''; + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_consoled.inc b/packages/ptc/src/c_api/capi_consoled.inc new file mode 100644 index 0000000000..fd5a3a054f --- /dev/null +++ b/packages/ptc/src/c_api/capi_consoled.inc @@ -0,0 +1,115 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_console_create: TPTC_CONSOLE; +procedure ptc_console_destroy(obj: TPTC_CONSOLE); + +{ console configuration } +procedure ptc_console_configure(obj: TPTC_CONSOLE; _file: String); + +{ console option string } +function ptc_console_option(obj: TPTC_CONSOLE; _option: String): Boolean; + +{ console modes } +function ptc_console_mode(obj: TPTC_CONSOLE; index: Integer): TPTC_MODE; + +{ console management } +procedure ptc_console_open(obj: TPTC_CONSOLE; title: string; pages: Integer); +procedure ptc_console_open_format(obj: TPTC_CONSOLE; title: string; format: TPTC_FORMAT; pages: Integer); +procedure ptc_console_open_resolution(obj: TPTC_CONSOLE; title: string; width, height: Integer; format: TPTC_FORMAT; pages: Integer); +procedure ptc_console_open_mode(obj: TPTC_CONSOLE; title: string; mode: TPTC_MODE; pages: Integer); +procedure ptc_console_close(obj: TPTC_CONSOLE); + +{ synchronization } +procedure ptc_console_flush(obj: TPTC_CONSOLE); +procedure ptc_console_finish(obj: TPTC_CONSOLE); +procedure ptc_console_update(obj: TPTC_CONSOLE); +procedure ptc_console_update_area(obj: TPTC_CONSOLE; area: TPTC_AREA); + +{ keyboard input } +function ptc_console_key(obj: TPTC_CONSOLE): Boolean; +procedure ptc_console_read(obj: TPTC_CONSOLE; key: TPTC_KEY); + +{ copy to surface } +procedure ptc_console_copy(obj: TPTC_CONSOLE; surface: TPTC_SURFACE); +procedure ptc_console_copy_area(obj: TPTC_CONSOLE; surface: TPTC_SURFACE; source, destination: TPTC_AREA); + +{ memory access } +function ptc_console_lock(obj: TPTC_CONSOLE): Pointer; +procedure ptc_console_unlock(obj: TPTC_CONSOLE); + +{ load pixels to console } +procedure ptc_console_load(obj: TPTC_CONSOLE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE); +procedure ptc_console_load_area(obj: TPTC_CONSOLE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE; source, destination: TPTC_AREA); + +{ save console pixels } +procedure ptc_console_save(obj: TPTC_CONSOLE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE); +procedure ptc_console_save_area(obj: TPTC_CONSOLE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE; source, destination: TPTC_AREA); + +{ clear console } +procedure ptc_console_clear(obj: TPTC_CONSOLE); +procedure ptc_console_clear_color(obj: TPTC_CONSOLE; color: TPTC_COLOR); +procedure ptc_console_clear_color_area(obj: TPTC_CONSOLE; color: TPTC_COLOR; area: TPTC_AREA); + +{ console palette } +procedure ptc_console_palette_set(obj: TPTC_CONSOLE; palette: TPTC_PALETTE); +function ptc_console_palette_get(obj: TPTC_CONSOLE): TPTC_PALETTE; + +{ console clip area } +procedure ptc_console_clip_set(obj: TPTC_CONSOLE; area: TPTC_AREA); + +{ data access } +function ptc_console_width(obj: TPTC_CONSOLE): Integer; +function ptc_console_height(obj: TPTC_CONSOLE): Integer; +function ptc_console_pages(obj: TPTC_CONSOLE): Integer; +function ptc_console_pitch(obj: TPTC_CONSOLE): Integer; +function ptc_console_area(obj: TPTC_CONSOLE): TPTC_AREA; +function ptc_console_clip(obj: TPTC_CONSOLE): TPTC_AREA; +function ptc_console_format(obj: TPTC_CONSOLE): TPTC_FORMAT; +function ptc_console_name(obj: TPTC_CONSOLE): string; +function ptc_console_title(obj: TPTC_CONSOLE): string; +function ptc_console_information(obj: TPTC_CONSOLE): string; + +{ extension functions } +{#ifdef __PTC_WIN32_EXTENSIONS__ +CAPI void PTCAPI ptc_console_open_window(PTC_CONSOLE object,HWND window,int pages); +CAPI void PTCAPI ptc_console_open_window_format(PTC_CONSOLE object,HWND window,PTC_FORMAT format,int pages); +CAPI void PTCAPI ptc_console_open_window_resolution(PTC_CONSOLE object,HWND window,int width,int height,PTC_FORMAT format,int pages); +CAPI void PTCAPI ptc_console_open_window_mode(PTC_CONSOLE object,HWND window,PTC_MODE mode,int pages); +CAPI HWND PTCAPI ptc_console_window(PTC_CONSOLE object); +CAPI LPDIRECTDRAW PTCAPI ptc_console_lpDD(PTC_CONSOLE object); +CAPI LPDIRECTDRAW2 PTCAPI ptc_console_lpDD2(PTC_CONSOLE object); +CAPI LPDIRECTDRAWSURFACE PTCAPI ptc_console_lpDDS(PTC_CONSOLE object); +CAPI LPDIRECTDRAWSURFACE PTCAPI ptc_console_lpDDS_primary(PTC_CONSOLE object); +CAPI LPDIRECTDRAWSURFACE PTCAPI ptc_console_lpDDS_secondary(PTC_CONSOLE object); +#endif} diff --git a/packages/ptc/src/c_api/capi_copy.inc b/packages/ptc/src/c_api/capi_copy.inc new file mode 100644 index 0000000000..5fa83332a7 --- /dev/null +++ b/packages/ptc/src/c_api/capi_copy.inc @@ -0,0 +1,100 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_copy_create: TPTC_COPY; +begin + try + ptc_copy_create := TPTC_COPY(TPTCCopy.Create); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_copy_create := nil; + end; + end; +end; + +procedure ptc_copy_destroy(obj: TPTC_COPY); +begin + if obj = nil then + exit; + try + TPTCCopy(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_copy_request(obj: TPTC_COPY; source, destination: TPTC_FORMAT); +begin + try + TPTCCopy(obj).request(TPTCFormat(source), TPTCFormat(destination)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_copy_palette(obj: TPTC_COPY; source, destination: TPTC_PALETTE); +begin + try + TPTCCopy(obj).palette(TPTCPalette(source), TPTCPalette(destination)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_copy_copy(obj: TPTC_COPY; source_pixels: Pointer; source_x, source_y, source_width, source_height, source_pitch: Integer; + destination_pixels: Pointer; destination_x, destination_y, destination_width, destination_height, destination_pitch: Integer); +begin + try + 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); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_copy_option(obj: TPTC_COPY; option: String): Boolean; +begin + try + TPTCCopy(obj).option(option); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_copy_option := False; + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_copyd.inc b/packages/ptc/src/c_api/capi_copyd.inc new file mode 100644 index 0000000000..2ea395f073 --- /dev/null +++ b/packages/ptc/src/c_api/capi_copyd.inc @@ -0,0 +1,48 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_copy_create: TPTC_COPY; +procedure ptc_copy_destroy(obj: TPTC_COPY); + +{ set source and destination formats } +procedure ptc_copy_request(obj: TPTC_COPY; source, destination: TPTC_FORMAT); + +{ set source and destination palettes } +procedure ptc_copy_palette(obj: TPTC_COPY; source, destination: TPTC_PALETTE); + +{ copy pixels } +procedure ptc_copy_copy(obj: TPTC_COPY; source_pixels: Pointer; source_x, source_y, source_width, source_height, source_pitch: Integer; + destination_pixels: Pointer; destination_x, destination_y, destination_width, destination_height, destination_pitch: Integer); + +{ copy option string } +function ptc_copy_option(obj: TPTC_COPY; option: String): Boolean; diff --git a/packages/ptc/src/c_api/capi_error.inc b/packages/ptc/src/c_api/capi_error.inc new file mode 100644 index 0000000000..c94fb78d2d --- /dev/null +++ b/packages/ptc/src/c_api/capi_error.inc @@ -0,0 +1,120 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_error_create(message: string): TPTC_ERROR; +begin + try + ptc_error_create := TPTC_ERROR(TPTCError.Create(message)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_error_create := nil; + end; + end; +end; + +function ptc_error_create_composite(message: string; error: TPTC_ERROR): TPTC_ERROR; +begin + try + ptc_error_create_composite := TPTC_ERROR(TPTCError.Create(message, TPTCError(error))); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_error_create_composite := nil; + end; + end; +end; + +procedure ptc_error_destroy(obj: TPTC_ERROR); +begin + if obj = nil then + exit; + try + TPTCError(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_error_report(obj: TPTC_ERROR); +begin + try + TPTCError(obj).report; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_error_message(obj: TPTC_ERROR): string; +begin + try + ptc_error_message := TPTCError(obj).message; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_error_message := ''; + end; + end; +end; + +procedure ptc_error_assign(obj, error: TPTC_ERROR); +begin + try + TPTCError(obj).Assign(TPTCError(error)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_error_equals(obj, error: TPTC_ERROR): Boolean; +begin + try + ptc_error_equals := TPTCError(obj).Equals(TPTCError(error)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_error_equals := False; + end; + end; +end; + +procedure ptc_error_handler(handler: TPTC_ERROR_HANDLER); +begin + ptc_exception_handler(handler); +end; diff --git a/packages/ptc/src/c_api/capi_errord.inc b/packages/ptc/src/c_api/capi_errord.inc new file mode 100644 index 0000000000..fab8f5fec2 --- /dev/null +++ b/packages/ptc/src/c_api/capi_errord.inc @@ -0,0 +1,47 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +type + TPTC_ERROR_HANDLER = procedure(error: TPTC_ERROR); + +function ptc_error_create(message: string): TPTC_ERROR; +function ptc_error_create_composite(message: string; error: TPTC_ERROR): TPTC_ERROR; +procedure ptc_error_destroy(obj: TPTC_ERROR); + +procedure ptc_error_report(obj: TPTC_ERROR); + +function ptc_error_message(obj: TPTC_ERROR): string; + +procedure ptc_error_assign(obj, error: TPTC_ERROR); +function ptc_error_equals(obj, error: TPTC_ERROR): Boolean; + +procedure ptc_error_handler(handler: TPTC_ERROR_HANDLER); diff --git a/packages/ptc/src/c_api/capi_except.inc b/packages/ptc/src/c_api/capi_except.inc new file mode 100644 index 0000000000..e41bdbccba --- /dev/null +++ b/packages/ptc/src/c_api/capi_except.inc @@ -0,0 +1,55 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +var + ptc_error_handler_function: TPTC_ERROR_HANDLER; + +procedure ptc_error_handler_default(error: TPTC_ERROR); + +begin + TPTCError(error).report; +end; + +procedure ptc_exception_handler(handler: TPTC_ERROR_HANDLER); + +begin + if handler = nil then + ptc_error_handler_function := @ptc_error_handler_default + else + ptc_error_handler_function := handler; +end; + +procedure ptc_exception_handle(error: TPTCError); + +begin + ptc_error_handler_function(TPTC_ERROR(error)); +end; diff --git a/packages/ptc/src/c_api/capi_exceptd.inc b/packages/ptc/src/c_api/capi_exceptd.inc new file mode 100644 index 0000000000..0a2037d729 --- /dev/null +++ b/packages/ptc/src/c_api/capi_exceptd.inc @@ -0,0 +1,34 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +procedure ptc_exception_handler(handler: TPTC_ERROR_HANDLER); +procedure ptc_exception_handle(error: TPTCError); diff --git a/packages/ptc/src/c_api/capi_format.inc b/packages/ptc/src/c_api/capi_format.inc new file mode 100644 index 0000000000..75d4a07b2a --- /dev/null +++ b/packages/ptc/src/c_api/capi_format.inc @@ -0,0 +1,209 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_format_create: TPTC_FORMAT; +begin + try + ptc_format_create := TPTC_FORMAT(TPTCFormat.Create); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_create := nil; + end; + end; +end; + +function ptc_format_create_indexed(bits: Integer): TPTC_FORMAT; +begin + try + ptc_format_create_indexed := TPTC_FORMAT(TPTCFormat.Create(bits)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_create_indexed := nil; + end; + end; +end; + +function ptc_format_create_direct(bits: Integer; r, g, b, a: int32): TPTC_FORMAT; +begin + try + ptc_format_create_direct := TPTC_FORMAT(TPTCFormat.Create(bits, r, g, b, a)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_create_direct := nil; + end; + end; +end; + +procedure ptc_format_destroy(obj: TPTC_FORMAT); +begin + if obj = nil then + exit; + try + TPTCFormat(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_format_r(obj: TPTC_FORMAT): int32; +begin + try + ptc_format_r := TPTCFormat(obj).r; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_r := 0; + end; + end; +end; + +function ptc_format_g(obj: TPTC_FORMAT): int32; +begin + try + ptc_format_g := TPTCFormat(obj).g; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_g := 0; + end; + end; +end; + +function ptc_format_b(obj: TPTC_FORMAT): int32; +begin + try + ptc_format_b := TPTCFormat(obj).b; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_b := 0; + end; + end; +end; + +function ptc_format_a(obj: TPTC_FORMAT): int32; +begin + try + ptc_format_a := TPTCFormat(obj).a; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_a := 0; + end; + end; +end; + +function ptc_format_bits(obj: TPTC_FORMAT): Integer; +begin + try + ptc_format_bits := TPTCFormat(obj).bits; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_bits := 0; + end; + end; +end; + +function ptc_format_bytes(obj: TPTC_FORMAT): Integer; +begin + try + ptc_format_bytes := TPTCFormat(obj).bytes; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_bytes := 0; + end; + end; +end; + +function ptc_format_direct(obj: TPTC_FORMAT): Boolean; +begin + try + ptc_format_direct := TPTCFormat(obj).direct; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_direct := False; + end; + end; +end; + +function ptc_format_indexed(obj: TPTC_FORMAT): Boolean; +begin + try + ptc_format_indexed := TPTCFormat(obj).indexed; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_indexed := False; + end; + end; +end; + +procedure ptc_format_assign(obj, format: TPTC_FORMAT); +begin + try + TPTCFormat(obj).Assign(TPTCFormat(format)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_format_equals(obj, format: TPTC_FORMAT): Boolean; +begin + try + ptc_format_equals := TPTCFormat(obj).Equals(TPTCFormat(format)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_format_equals := False; + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_formatd.inc b/packages/ptc/src/c_api/capi_formatd.inc new file mode 100644 index 0000000000..43e6ed583f --- /dev/null +++ b/packages/ptc/src/c_api/capi_formatd.inc @@ -0,0 +1,51 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_format_create: TPTC_FORMAT; +function ptc_format_create_indexed(bits: Integer): TPTC_FORMAT; +function ptc_format_create_direct(bits: Integer; r, g, b, a: int32): TPTC_FORMAT; +procedure ptc_format_destroy(obj: TPTC_FORMAT); + +{ data access } +function ptc_format_r(obj: TPTC_FORMAT): int32; +function ptc_format_g(obj: TPTC_FORMAT): int32; +function ptc_format_b(obj: TPTC_FORMAT): int32; +function ptc_format_a(obj: TPTC_FORMAT): int32; +function ptc_format_bits(obj: TPTC_FORMAT): Integer; +function ptc_format_bytes(obj: TPTC_FORMAT): Integer; +function ptc_format_direct(obj: TPTC_FORMAT): Boolean; +function ptc_format_indexed(obj: TPTC_FORMAT): Boolean; + +{ operators } +procedure ptc_format_assign(obj, format: TPTC_FORMAT); +function ptc_format_equals(obj, format: TPTC_FORMAT): Boolean; diff --git a/packages/ptc/src/c_api/capi_index.inc b/packages/ptc/src/c_api/capi_index.inc new file mode 100644 index 0000000000..5338108fed --- /dev/null +++ b/packages/ptc/src/c_api/capi_index.inc @@ -0,0 +1,46 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +type + { object handles } + TPTC_KEY = Pointer; { equivalent to Object Pascal TPTCKeyEvent } + TPTC_AREA = Pointer; { equivalent to Object Pascal TPTCArea } + TPTC_MODE = Pointer; { equivalent to Object Pascal TPTCMode } + TPTC_COPY = Pointer; { equivalent to Object Pascal TPTCCopy } + TPTC_CLEAR = Pointer; { equivalent to Object Pascal TPTCClear } + TPTC_TIMER = Pointer; { equivalent to Object Pascal TPTCTimer } + TPTC_ERROR = Pointer; { equivalent to Object Pascal TPTCError } + TPTC_COLOR = Pointer; { equivalent to Object Pascal TPTCColor } + TPTC_FORMAT = Pointer; { equivalent to Object Pascal TPTCFormat } + TPTC_PALETTE = Pointer; { equivalent to Object Pascal TPTCPalette } + TPTC_SURFACE = Pointer; { equivalent to Object Pascal TPTCBaseSurface } + TPTC_CONSOLE = Pointer; { equivalent to Object Pascal TPTCBaseConsole } diff --git a/packages/ptc/src/c_api/capi_key.inc b/packages/ptc/src/c_api/capi_key.inc new file mode 100644 index 0000000000..dab07b495f --- /dev/null +++ b/packages/ptc/src/c_api/capi_key.inc @@ -0,0 +1,131 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_key_create(code: Integer; alt, shift, control: Boolean): TPTC_KEY; +begin + try + ptc_key_create := TPTC_KEY(TPTCKeyEvent.Create(code, alt, shift, control)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_key_create := nil; + end; + end; +end; + +procedure ptc_key_destroy(obj: TPTC_KEY); +begin + if obj = nil then + exit; + try + TPTCKeyEvent(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_key_code(obj: TPTC_KEY): Integer; +begin + try + ptc_key_code := Integer(TPTCKeyEvent(obj).code); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_key_code := 0; + end; + end; +end; + +function ptc_key_alt(obj: TPTC_KEY): Boolean; +begin + try + ptc_key_alt := TPTCKeyEvent(obj).alt; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_key_alt := False; + end; + end; +end; + +function ptc_key_shift(obj: TPTC_KEY): Boolean; +begin + try + ptc_key_shift := TPTCKeyEvent(obj).shift; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_key_shift := False; + end; + end; +end; + +function ptc_key_control(obj: TPTC_KEY): Boolean; +begin + try + ptc_key_control := TPTCKeyEvent(obj).control; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_key_control := False; + end; + end; +end; + +procedure ptc_key_assign(obj: TPTC_KEY; key: TPTC_KEY); +begin + try + TPTCKeyEvent(obj).Assign(TPTCKeyEvent(key)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_key_equals(obj: TPTC_KEY; key: TPTC_KEY): Boolean; +begin + try + ptc_key_equals := TPTCKeyEvent(obj).Equals(TPTCKeyEvent(key)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_key_equals := False; + end; + end; +end; diff --git a/packages/ptc/src/c_api/keyd.inc b/packages/ptc/src/c_api/capi_keyd.inc index a8b3f7b26f..c7bad73d33 100644 --- a/packages/ptc/src/c_api/keyd.inc +++ b/packages/ptc/src/c_api/capi_keyd.inc @@ -1,18 +1,50 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + { setup } -Function ptc_key_create(code : Integer; alt, shift, control : Boolean) : TPTC_KEY; -Procedure ptc_key_destroy(obj : TPTC_KEY); +function ptc_key_create(code: Integer; alt, shift, control: Boolean): TPTC_KEY; +procedure ptc_key_destroy(obj: TPTC_KEY); { key code } -Function ptc_key_code(obj : TPTC_KEY) : Integer; +function ptc_key_code(obj: TPTC_KEY): Integer; { modifiers } -Function ptc_key_alt(obj : TPTC_KEY) : Boolean; -Function ptc_key_shift(obj : TPTC_KEY) : Boolean; -Function ptc_key_control(obj : TPTC_KEY) : Boolean; +function ptc_key_alt(obj: TPTC_KEY): Boolean; +function ptc_key_shift(obj: TPTC_KEY): Boolean; +function ptc_key_control(obj: TPTC_KEY): Boolean; { operators } -Procedure ptc_key_assign(obj : TPTC_KEY; key : TPTC_KEY); -Function ptc_key_equals(obj : TPTC_KEY; key : TPTC_KEY) : Boolean; +procedure ptc_key_assign(obj: TPTC_KEY; key: TPTC_KEY); +function ptc_key_equals(obj: TPTC_KEY; key: TPTC_KEY): Boolean; { key codes } {#define PTC_KEY_ENTER '\n' diff --git a/packages/ptc/src/c_api/capi_mode.inc b/packages/ptc/src/c_api/capi_mode.inc new file mode 100644 index 0000000000..b2e3d61a2b --- /dev/null +++ b/packages/ptc/src/c_api/capi_mode.inc @@ -0,0 +1,144 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_mode_create(width, height: Integer; format: TPTC_FORMAT): TPTC_MODE; +begin + try + ptc_mode_create := TPTC_MODE(TPTCMode.Create(width, height, TPTCFormat(format))); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_mode_create := nil; + end; + end; +end; + +function ptc_mode_create_invalid: TPTC_MODE; +begin + try + ptc_mode_create_invalid := TPTC_MODE(TPTCMode.Create); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_mode_create_invalid := nil; + end; + end; +end; + +procedure ptc_mode_destroy(obj: TPTC_MODE); +begin + if obj = nil then + exit; + try + TPTCMode(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_mode_valid(obj: TPTC_MODE): Boolean; +begin + try + ptc_mode_valid := TPTCMode(obj).valid; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_mode_valid := False; + end; + end; +end; + +function ptc_mode_width(obj: TPTC_MODE): Integer; +begin + try + ptc_mode_width := TPTCMode(obj).width; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_mode_width := 0; + end; + end; +end; + +function ptc_mode_height(obj: TPTC_MODE): Integer; +begin + try + ptc_mode_height := TPTCMode(obj).height; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_mode_height := 0; + end; + end; +end; + +function ptc_mode_format(obj: TPTC_MODE): TPTC_FORMAT; +begin + try + ptc_mode_format := TPTC_FORMAT(TPTCMode(obj).format); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_mode_format := nil; + end; + end; +end; + +procedure ptc_mode_assign(obj, mode: TPTC_MODE); +begin + try + TPTCMode(obj).Assign(TPTCMode(mode)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_mode_equals(obj, mode: TPTC_MODE): Boolean; +begin + try + ptc_mode_equals := TPTCMode(obj).Equals(TPTCMode(mode)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_mode_equals := False; + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_moded.inc b/packages/ptc/src/c_api/capi_moded.inc new file mode 100644 index 0000000000..16340a9145 --- /dev/null +++ b/packages/ptc/src/c_api/capi_moded.inc @@ -0,0 +1,48 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_mode_create(width, height: Integer; format: TPTC_FORMAT): TPTC_MODE; +function ptc_mode_create_invalid: TPTC_MODE; +procedure ptc_mode_destroy(obj: TPTC_MODE); + +{ valid mode flag } +function ptc_mode_valid(obj: TPTC_MODE): Boolean; + +{ data access } +function ptc_mode_width(obj: TPTC_MODE): Integer; +function ptc_mode_height(obj: TPTC_MODE): Integer; +function ptc_mode_format(obj: TPTC_MODE): TPTC_FORMAT; + +{ operators } +procedure ptc_mode_assign(obj, mode: TPTC_MODE); +function ptc_mode_equals(obj, mode: TPTC_MODE): Boolean; diff --git a/packages/ptc/src/c_api/capi_palette.inc b/packages/ptc/src/c_api/capi_palette.inc new file mode 100644 index 0000000000..f3a6a45d65 --- /dev/null +++ b/packages/ptc/src/c_api/capi_palette.inc @@ -0,0 +1,149 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_palette_create: TPTC_PALETTE; +begin + try + ptc_palette_create := TPTC_PALETTE(TPTCPalette.Create); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_palette_create := nil; + end; + end; +end; + +{function ptc_palette_create_data(data: Pint32): TPTC_PALETTE; + +begin + try + ptc_palette_create_data := TPTC_PALETTE(TPTCPalette.Create(data)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_palette_create_data := nil; + end; + end; +End;} + +procedure ptc_palette_destroy(obj: TPTC_PALETTE); +begin + if obj = nil then + exit; + try + TPTCPalette(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_palette_lock(obj: TPTC_PALETTE): Pint32; +begin + try + ptc_palette_lock := TPTCPalette(obj).lock; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_palette_lock := nil; + end; + end; +end; + +procedure ptc_palette_unlock(obj: TPTC_PALETTE); +begin + try + TPTCPalette(obj).unlock; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_palette_load(obj: TPTC_PALETTE; data: Pint32); +begin + try + TPTCPalette(obj).load(data); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_palette_save(obj: TPTC_PALETTE; data: Pint32); +begin + try + TPTCPalette(obj).save(data); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_palette_data(obj: TPTC_PALETTE): Pint32; +begin + try + ptc_palette_data := TPTCPalette(obj).data; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_palette_data := nil; + end; + end; +end; + +procedure ptc_palette_assign(obj, palette: TPTC_PALETTE); +begin + try + TPTCPalette(obj).Assign(TPTCPalette(palette)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_palette_equals(obj, palette: TPTC_PALETTE): Boolean; +begin + try + ptc_palette_equals := TPTCPalette(obj).Equals(TPTCPalette(palette)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_palette_equals := False; + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_paletted.inc b/packages/ptc/src/c_api/capi_paletted.inc new file mode 100644 index 0000000000..b2d8ceaf1b --- /dev/null +++ b/packages/ptc/src/c_api/capi_paletted.inc @@ -0,0 +1,53 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_palette_create: TPTC_PALETTE; +{function ptc_palette_create_data(data: Pint32): TPTC_PALETTE;} +procedure ptc_palette_destroy(obj: TPTC_PALETTE); + +{ memory access } +function ptc_palette_lock(obj: TPTC_PALETTE): Pint32; +procedure ptc_palette_unlock(obj: TPTC_PALETTE); + +{ load palette data } +procedure ptc_palette_load(obj: TPTC_PALETTE; data: Pint32); + +{ save palette data } +procedure ptc_palette_save(obj: TPTC_PALETTE; data: Pint32); + +{ get palette data } +function ptc_palette_data(obj: TPTC_PALETTE): Pint32; + +{ operators } +procedure ptc_palette_assign(obj, palette: TPTC_PALETTE); +function ptc_palette_equals(obj, palette: TPTC_PALETTE): Boolean; diff --git a/packages/ptc/src/c_api/capi_surface.inc b/packages/ptc/src/c_api/capi_surface.inc new file mode 100644 index 0000000000..eb61e6de78 --- /dev/null +++ b/packages/ptc/src/c_api/capi_surface.inc @@ -0,0 +1,293 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_surface_create(width, height: Integer; format: TPTC_FORMAT): TPTC_SURFACE; +begin + try + ptc_surface_create := TPTC_SURFACE(TPTCSurface.Create(width, height, TPTCFormat(format))); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_create := nil; + end; + end; +end; + +procedure ptc_surface_destroy(obj: TPTC_SURFACE); +begin + if obj = nil then + exit; + try + TPTCBaseSurface(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_copy(obj: TPTC_SURFACE; surface: TPTC_SURFACE); +begin + try + TPTCBaseSurface(obj).copy(TPTCBaseSurface(surface)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_copy_area(obj: TPTC_SURFACE; surface: TPTC_SURFACE; source, destination: TPTC_AREA); +begin + try + TPTCBaseSurface(obj).copy(TPTCBaseSurface(surface), TPTCArea(source), TPTCArea(destination)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_surface_lock(obj: TPTC_SURFACE): Pointer; +begin + try + ptc_surface_lock := TPTCBaseSurface(obj).lock; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_lock := nil; + end; + end; +end; + +procedure ptc_surface_unlock(obj: TPTC_SURFACE); +begin + try + TPTCBaseSurface(obj).unlock; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_load(obj: TPTC_SURFACE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE); +begin + try + TPTCBaseSurface(obj).load(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_load_area(obj: TPTC_SURFACE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE; source, destination: TPTC_AREA); +begin + try + TPTCBaseSurface(obj).load(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette), TPTCArea(source), TPTCArea(destination)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_save(obj: TPTC_SURFACE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE); +begin + try + TPTCBaseSurface(obj).save(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_save_area(obj: TPTC_SURFACE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE; source, destination: TPTC_AREA); +begin + try + TPTCBaseSurface(obj).save(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette), TPTCArea(source), TPTCArea(destination)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_clear(obj: TPTC_SURFACE); +begin + try + TPTCBaseSurface(obj).clear; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_clear_color(obj: TPTC_SURFACE; color: TPTC_COLOR); +begin + try + TPTCBaseSurface(obj).clear(TPTCColor(color)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_clear_color_area(obj: TPTC_SURFACE; color: TPTC_COLOR; area: TPTC_AREA); +begin + try + TPTCBaseSurface(obj).clear(TPTCColor(color), TPTCArea(area)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_surface_palette_set(obj: TPTC_SURFACE; palette: TPTC_PALETTE); +begin + try + TPTCBaseSurface(obj).palette(TPTCPalette(palette)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_surface_palette_get(obj: TPTC_SURFACE): TPTC_PALETTE; +begin + try + ptc_surface_palette_get := TPTC_PALETTE(TPTCBaseSurface(obj).palette); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_palette_get := nil; + end; + end; +end; + +procedure ptc_surface_clip_set(obj: TPTC_SURFACE; area: TPTC_AREA); +begin + try + TPTCBaseSurface(obj).clip(TPTCArea(area)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_surface_width(obj: TPTC_SURFACE): Integer; +begin + try + ptc_surface_width := TPTCBaseSurface(obj).width; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_width := 0; + end; + end; +end; + +function ptc_surface_height(obj: TPTC_SURFACE): Integer; +begin + try + ptc_surface_height := TPTCBaseSurface(obj).height; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_height := 0; + end; + end; +end; + +function ptc_surface_pitch(obj: TPTC_SURFACE): Integer; +begin + try + ptc_surface_pitch := TPTCBaseSurface(obj).pitch; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_pitch := 0; + end; + end; +end; + +function ptc_surface_area(obj: TPTC_SURFACE): TPTC_AREA; +begin + try + ptc_surface_area := TPTC_AREA(TPTCBaseSurface(obj).area); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_area := nil; + end; + end; +end; + +function ptc_surface_clip(obj: TPTC_SURFACE): TPTC_AREA; +begin + try + ptc_surface_clip := TPTC_AREA(TPTCBaseSurface(obj).clip); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_clip := nil; + end; + end; +end; + +function ptc_surface_format(obj: TPTC_SURFACE): TPTC_FORMAT; +begin + try + ptc_surface_format := TPTC_FORMAT(TPTCBaseSurface(obj).format); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_format := nil; + end; + end; +end; + +function ptc_surface_option(obj: TPTC_SURFACE; _option: string): Boolean; +begin + try + ptc_surface_option := TPTCBaseSurface(obj).option(_option); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_surface_option := False; + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_surfaced.inc b/packages/ptc/src/c_api/capi_surfaced.inc new file mode 100644 index 0000000000..8f5fb398d1 --- /dev/null +++ b/packages/ptc/src/c_api/capi_surfaced.inc @@ -0,0 +1,74 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_surface_create(width, height: Integer; format: TPTC_FORMAT): TPTC_SURFACE; +procedure ptc_surface_destroy(obj: TPTC_SURFACE); + +{ copy to surface } +procedure ptc_surface_copy(obj: TPTC_SURFACE; surface: TPTC_SURFACE); +procedure ptc_surface_copy_area(obj: TPTC_SURFACE; surface: TPTC_SURFACE; source, destination: TPTC_AREA); + +{ memory access } +function ptc_surface_lock(obj: TPTC_SURFACE): Pointer; +procedure ptc_surface_unlock(obj: TPTC_SURFACE); + +{ load pixels to surface } +procedure ptc_surface_load(obj: TPTC_SURFACE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE); +procedure ptc_surface_load_area(obj: TPTC_SURFACE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE; source, destination: TPTC_AREA); + +{ save surface pixels } +procedure ptc_surface_save(obj: TPTC_SURFACE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE); +procedure ptc_surface_save_area(obj: TPTC_SURFACE; pixels: Pointer; width, height, pitch: Integer; format: TPTC_FORMAT; palette: TPTC_PALETTE; source, destination: TPTC_AREA); + +{ clear surface } +procedure ptc_surface_clear(obj: TPTC_SURFACE); +procedure ptc_surface_clear_color(obj: TPTC_SURFACE; color: TPTC_COLOR); +procedure ptc_surface_clear_color_area(obj: TPTC_SURFACE; color: TPTC_COLOR; area: TPTC_AREA); + +{ surface palette } +procedure ptc_surface_palette_set(obj: TPTC_SURFACE; palette: TPTC_PALETTE); +function ptc_surface_palette_get(obj: TPTC_SURFACE): TPTC_PALETTE; + +{ surface clip area } +procedure ptc_surface_clip_set(obj: TPTC_SURFACE; area: TPTC_AREA); + +{ data access } +function ptc_surface_width(obj: TPTC_SURFACE): Integer; +function ptc_surface_height(obj: TPTC_SURFACE): Integer; +function ptc_surface_pitch(obj: TPTC_SURFACE): Integer; +function ptc_surface_area(obj: TPTC_SURFACE): TPTC_AREA; +function ptc_surface_clip(obj: TPTC_SURFACE): TPTC_AREA; +function ptc_surface_format(obj: TPTC_SURFACE): TPTC_FORMAT; + +{ surface option string } +function ptc_surface_option(obj: TPTC_SURFACE; _option: string): Boolean; diff --git a/packages/ptc/src/c_api/capi_timer.inc b/packages/ptc/src/c_api/capi_timer.inc new file mode 100644 index 0000000000..d4af8fa621 --- /dev/null +++ b/packages/ptc/src/c_api/capi_timer.inc @@ -0,0 +1,148 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +function ptc_timer_create: TPTC_TIMER; +begin + try + ptc_timer_create := TPTC_TIMER(TPTCTimer.Create); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_timer_create := nil; + end; + end; +end; + +procedure ptc_timer_destroy(obj: TPTC_TIMER); +begin + if obj = nil then + exit; + try + TPTCTimer(obj).Destroy; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_timer_set(obj: TPTC_TIMER; time: Double); +begin + try + TPTCTimer(obj).settime(time); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_timer_start(obj: TPTC_TIMER); +begin + try + TPTCTimer(obj).start; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +procedure ptc_timer_stop(obj: TPTC_TIMER); +begin + try + TPTCTimer(obj).stop; + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_timer_time(obj: TPTC_TIMER): Double; +begin + try + ptc_timer_time := TPTCTimer(obj).time; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_timer_time := 0; + end; + end; +end; + +function ptc_timer_delta(obj: TPTC_TIMER): Double; +begin + try + ptc_timer_delta := TPTCTimer(obj).delta; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_timer_delta := 0; + end; + end; +end; + +function ptc_timer_resolution(obj: TPTC_TIMER): Double; +begin + try + ptc_timer_resolution := TPTCTimer(obj).resolution; + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_timer_resolution := 0; + end; + end; +end; + +procedure ptc_timer_assign(obj, timer: TPTC_TIMER); +begin + try + TPTCTimer(obj).Assign(TPTCTimer(timer)); + except + on error: TPTCError do + ptc_exception_handle(error); + end; +end; + +function ptc_timer_equals(obj, timer: TPTC_TIMER): Boolean; +begin + try + ptc_timer_equals := TPTCTimer(obj).equals(TPTCTimer(timer)); + except + on error: TPTCError do + begin + ptc_exception_handle(error); + ptc_timer_equals := False; + end; + end; +end; diff --git a/packages/ptc/src/c_api/capi_timerd.inc b/packages/ptc/src/c_api/capi_timerd.inc new file mode 100644 index 0000000000..8b17beb7c5 --- /dev/null +++ b/packages/ptc/src/c_api/capi_timerd.inc @@ -0,0 +1,51 @@ +{ + Free Pascal port of the OpenPTC C++ library. + Copyright (C) 2001-2010 Nikolay Nikolov (nickysn@users.sourceforge.net) + Original C++ version by Glenn Fiedler (ptc@gaffer.org) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version + with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} + +{ setup } +function ptc_timer_create: TPTC_TIMER; +procedure ptc_timer_destroy(obj: TPTC_TIMER); + +{ set time } +procedure ptc_timer_set(obj: TPTC_TIMER; time: Double); + +{ control } +procedure ptc_timer_start(obj: TPTC_TIMER); +procedure ptc_timer_stop(obj: TPTC_TIMER); + +{ time data } +function ptc_timer_time(obj: TPTC_TIMER): Double; +function ptc_timer_delta(obj: TPTC_TIMER): Double; +function ptc_timer_resolution(obj: TPTC_TIMER): Double; + +{ operators } +procedure ptc_timer_assign(obj, timer: TPTC_TIMER); +function ptc_timer_equals(obj, timer: TPTC_TIMER): Boolean; diff --git a/packages/ptc/src/c_api/clear.inc b/packages/ptc/src/c_api/clear.inc deleted file mode 100644 index 9d287d9e87..0000000000 --- a/packages/ptc/src/c_api/clear.inc +++ /dev/null @@ -1,48 +0,0 @@ -Function ptc_clear_create : TPTC_CLEAR; - -Begin - Try - ptc_clear_create := TPTC_CLEAR(TPTCClear.Create); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_clear_create := Nil; - End; - End; -End; - -Procedure ptc_clear_destroy(obj : TPTC_CLEAR); - -Begin - If obj = Nil Then - Exit; - Try - TPTCClear(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_clear_request(obj : TPTC_CLEAR; format : TPTC_FORMAT); - -Begin - Try - TPTCClear(obj).request(TPTCFormat(format)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_clear_clear(obj : TPTC_CLEAR; pixels : Pointer; x, y, width, height, pitch : Integer; color : TPTC_COLOR); - -Begin - Try - TPTCClear(obj).clear(pixels, x, y, width, height, pitch, TPTCColor(color)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; diff --git a/packages/ptc/src/c_api/cleard.inc b/packages/ptc/src/c_api/cleard.inc deleted file mode 100644 index 4f8f761bdc..0000000000 --- a/packages/ptc/src/c_api/cleard.inc +++ /dev/null @@ -1,9 +0,0 @@ -{ setup } -Function ptc_clear_create : TPTC_CLEAR; -Procedure ptc_clear_destroy(obj : TPTC_CLEAR); - -{ request clear } -Procedure ptc_clear_request(obj : TPTC_CLEAR; format : TPTC_FORMAT); - -{ clear pixels } -Procedure ptc_clear_clear(obj : TPTC_CLEAR; pixels : Pointer; x, y, width, height, pitch : Integer; color : TPTC_COLOR); diff --git a/packages/ptc/src/c_api/clipper.inc b/packages/ptc/src/c_api/clipper.inc deleted file mode 100644 index 4246034375..0000000000 --- a/packages/ptc/src/c_api/clipper.inc +++ /dev/null @@ -1,33 +0,0 @@ -Procedure ptc_clipper_clip(area, clip, clipped : TPTC_AREA); - -Var - tmp : TPTCArea; - -Begin - Try - tmp := TPTCClipper.clip(TPTCArea(area), TPTCArea(clip)); - Try - TPTCArea(clipped).ASSign(tmp); - Finally - tmp.Destroy; - End; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - End; - End; -End; - -Procedure ptc_clipper_clip_complex(source, clip_source, clipped_source, destination, clip_destination, clipped_destination : TPTC_AREA); - -Begin - Try - TPTCClipper.clip(TPTCArea(source), TPTCArea(clip_source), TPTCArea(clipped_source), TPTCArea(destination), TPTCArea(clip_destination), TPTCArea(clipped_destination)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - End; - End; -End; diff --git a/packages/ptc/src/c_api/clipperd.inc b/packages/ptc/src/c_api/clipperd.inc deleted file mode 100644 index 29642abaa6..0000000000 --- a/packages/ptc/src/c_api/clipperd.inc +++ /dev/null @@ -1,5 +0,0 @@ -{ clip a single area against clip area } -Procedure ptc_clipper_clip(area, clip, clipped : TPTC_AREA); - -{ clip source and destination areas against source and destination clip areas } -Procedure ptc_clipper_clip_complex(source, clip_source, clipped_source, destination, clip_destination, clipped_destination : TPTC_AREA); diff --git a/packages/ptc/src/c_api/color.inc b/packages/ptc/src/c_api/color.inc deleted file mode 100644 index 966dee2286..0000000000 --- a/packages/ptc/src/c_api/color.inc +++ /dev/null @@ -1,177 +0,0 @@ -Function ptc_color_create : TPTC_COLOR; - -Begin - Try - ptc_color_create := TPTC_COLOR(TPTCColor.Create); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_create := Nil; - End; - End; -End; - -Function ptc_color_create_indexed(index : Integer) : TPTC_COLOR; - -Begin - Try - ptc_color_create_indexed := TPTC_COLOR(TPTCColor.Create(index)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_create_indexed := Nil; - End; - End; -End; - -Function ptc_color_create_direct(r, g, b, a : Single) : TPTC_COLOR; - -Begin - Try - ptc_color_create_direct := TPTC_COLOR(TPTCColor.Create(r, g, b, a)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_create_direct := Nil; - End; - End; -End; - -Procedure ptc_color_destroy(obj : TPTC_COLOR); - -Begin - If obj = Nil Then - Exit; - Try - TPTCColor(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_color_index(obj : TPTC_COLOR) : Integer; - -Begin - Try - ptc_color_index := TPTCColor(obj).index; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_index := 0; - End; - End; -End; - -Function ptc_color_r(obj : TPTC_COLOR) : Single; - -Begin - Try - ptc_color_r := TPTCColor(obj).r; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_r := 0; - End; - End; -End; - -Function ptc_color_g(obj : TPTC_COLOR) : Single; - -Begin - Try - ptc_color_g := TPTCColor(obj).g; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_g := 0; - End; - End; -End; - -Function ptc_color_b(obj : TPTC_COLOR) : Single; - -Begin - Try - ptc_color_b := TPTCColor(obj).b; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_b := 0; - End; - End; -End; - -Function ptc_color_a(obj : TPTC_COLOR) : Single; - -Begin - Try - ptc_color_a := TPTCColor(obj).a; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_a := 0; - End; - End; -End; - -Function ptc_color_direct(obj : TPTC_COLOR) : Boolean; - -Begin - Try - ptc_color_direct := TPTCColor(obj).direct; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_direct := False; - End; - End; -End; - -Function ptc_color_indexed(obj : TPTC_COLOR) : Boolean; - -Begin - Try - ptc_color_indexed := TPTCColor(obj).indexed; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_indexed := False; - End; - End; -End; - -Procedure ptc_color_assign(obj, color : TPTC_COLOR); - -Begin - Try - TPTCColor(obj).ASSign(TPTCColor(color)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_color_equals(obj, color : TPTC_COLOR) : Boolean; - -Begin - Try - ptc_color_equals := TPTCColor(obj).Equals(TPTCColor(color)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_color_equals := False; - End; - End; -End; diff --git a/packages/ptc/src/c_api/colord.inc b/packages/ptc/src/c_api/colord.inc deleted file mode 100644 index 8098bae6bc..0000000000 --- a/packages/ptc/src/c_api/colord.inc +++ /dev/null @@ -1,18 +0,0 @@ -{ setup } -Function ptc_color_create : TPTC_COLOR; -Function ptc_color_create_indexed(index : Integer) : TPTC_COLOR; -Function ptc_color_create_direct(r, g, b, a : Single) : TPTC_COLOR; -Procedure ptc_color_destroy(obj : TPTC_COLOR); - -{ data access } -Function ptc_color_index(obj : TPTC_COLOR) : Integer; -Function ptc_color_r(obj : TPTC_COLOR) : Single; -Function ptc_color_g(obj : TPTC_COLOR) : Single; -Function ptc_color_b(obj : TPTC_COLOR) : Single; -Function ptc_color_a(obj : TPTC_COLOR) : Single; -Function ptc_color_direct(obj : TPTC_COLOR) : Boolean; -Function ptc_color_indexed(obj : TPTC_COLOR) : Boolean; - -{ operators } -Procedure ptc_color_assign(obj, color : TPTC_COLOR); -Function ptc_color_equals(obj, color : TPTC_COLOR) : Boolean; diff --git a/packages/ptc/src/c_api/console.inc b/packages/ptc/src/c_api/console.inc deleted file mode 100644 index fd2779475f..0000000000 --- a/packages/ptc/src/c_api/console.inc +++ /dev/null @@ -1,497 +0,0 @@ -Function ptc_console_create : TPTC_CONSOLE; - -Begin - Try - ptc_console_create := TPTC_CONSOLE(TPTCConsole.Create); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_create := Nil; - End; - End; -End; - -Procedure ptc_console_destroy(obj : TPTC_CONSOLE); - -Begin - If obj = Nil Then - Exit; - Try - TPTCBaseConsole(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_configure(obj : TPTC_CONSOLE; _file : String); - -Begin - Try - TPTCBaseConsole(obj).configure(_file); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_console_option(obj : TPTC_CONSOLE; _option : String) : Boolean; - -Begin - Try - ptc_console_option := TPTCBaseConsole(obj).option(_option); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_option := False; - End; - End; -End; - -Function ptc_console_mode(obj : TPTC_CONSOLE; index : Integer) : TPTC_MODE; - -Begin - Try - ptc_console_mode := TPTC_MODE(TPTCBaseConsole(obj).modes[index]); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_mode := Nil; - End; - End; -End; - -Procedure ptc_console_open(obj : TPTC_CONSOLE; title : String; pages : Integer); - -Begin - Try - TPTCBaseConsole(obj).open(title, pages); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_open_format(obj : TPTC_CONSOLE; title : String; format : TPTC_FORMAT; pages : Integer); - -Begin - Try - TPTCBaseConsole(obj).open(title, TPTCFormat(format), pages); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_open_resolution(obj : TPTC_CONSOLE; title : String; width, height : Integer; format : TPTC_FORMAT; pages : Integer); - -Begin - Try - TPTCBaseConsole(obj).open(title, width, height, TPTCFormat(format), pages); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_open_mode(obj : TPTC_CONSOLE; title : String; mode : TPTC_MODE; pages : Integer); - -Begin - Try - TPTCBaseConsole(obj).open(title, TPTCMode(mode), pages); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_close(obj : TPTC_CONSOLE); - -Begin - Try - TPTCBaseConsole(obj).close; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_flush(obj : TPTC_CONSOLE); - -Begin - Try - TPTCBaseConsole(obj).flush; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_finish(obj : TPTC_CONSOLE); - -Begin - Try - TPTCBaseConsole(obj).finish; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_update(obj : TPTC_CONSOLE); - -Begin - Try - TPTCBaseConsole(obj).update; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_update_area(obj : TPTC_CONSOLE; area : TPTC_AREA); - -Begin - Try - TPTCBaseConsole(obj).update(TPTCArea(area)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_console_key(obj : TPTC_CONSOLE) : Boolean; - -Begin - Try - ptc_console_key := TPTCBaseConsole(obj).key; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_key := False; - End; - End; -End; - -Procedure ptc_console_read(obj : TPTC_CONSOLE; key : TPTC_KEY); - -Var - tmp : TPTCKey; - -Begin - Try - tmp := TPTCBaseConsole(obj).read; - Try - TPTCKey(key).ASSign(tmp); - Finally - tmp.Destroy; - End; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_copy(obj : TPTC_CONSOLE; surface : TPTC_SURFACE); - -Begin - Try - TPTCBaseConsole(obj).copy(TPTCBaseSurface(surface)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_copy_area(obj : TPTC_CONSOLE; surface : TPTC_SURFACE; source, destination : TPTC_AREA); - -Begin - Try - TPTCBaseConsole(obj).copy(TPTCBaseSurface(surface), TPTCArea(source), TPTCArea(destination)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_console_lock(obj : TPTC_CONSOLE) : Pointer; - -Begin - Try - ptc_console_lock := TPTCBaseConsole(obj).lock; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_lock := Nil; - End; - End; -End; - -Procedure ptc_console_unlock(obj : TPTC_CONSOLE); - -Begin - Try - TPTCBaseConsole(obj).unlock; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_load(obj : TPTC_CONSOLE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE); - -Begin - Try - TPTCBaseConsole(obj).load(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_load_area(obj : TPTC_CONSOLE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE; source, destination : TPTC_AREA); - -Begin - Try - TPTCBaseConsole(obj).load(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette), TPTCArea(source), TPTCArea(destination)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_save(obj : TPTC_CONSOLE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE); - -Begin - Try - TPTCBaseConsole(obj).save(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_save_area(obj : TPTC_CONSOLE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE; source, destination : TPTC_AREA); - -Begin - Try - TPTCBaseConsole(obj).save(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette), TPTCArea(source), TPTCArea(destination)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_clear(obj : TPTC_CONSOLE); - -Begin - Try - TPTCBaseConsole(obj).clear; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_clear_color(obj : TPTC_CONSOLE; color : TPTC_COLOR); - -Begin - Try - TPTCBaseConsole(obj).clear(TPTCColor(color)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_clear_color_area(obj : TPTC_CONSOLE; color : TPTC_COLOR; area : TPTC_AREA); - -Begin - Try - TPTCBaseConsole(obj).clear(TPTCColor(color), TPTCArea(area)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_console_palette_set(obj : TPTC_CONSOLE; palette : TPTC_PALETTE); - -Begin - Try - TPTCBaseConsole(obj).palette(TPTCPalette(palette)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_console_palette_get(obj : TPTC_CONSOLE) : TPTC_PALETTE; - -Begin - Try - ptc_console_palette_get := TPTC_PALETTE(TPTCBaseConsole(obj).palette); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_palette_get := Nil; - End; - End; -End; - -Procedure ptc_console_clip_set(obj : TPTC_CONSOLE; area : TPTC_AREA); - -Begin - Try - TPTCBaseConsole(obj).clip(TPTCArea(area)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_console_width(obj : TPTC_CONSOLE) : Integer; - -Begin - Try - ptc_console_width := TPTCBaseConsole(obj).width; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_width := 0; - End; - End; -End; - -Function ptc_console_height(obj : TPTC_CONSOLE) : Integer; - -Begin - Try - ptc_console_height := TPTCBaseConsole(obj).height; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_height := 0; - End; - End; -End; - -Function ptc_console_pages(obj : TPTC_CONSOLE) : Integer; - -Begin - Try - ptc_console_pages := TPTCBaseConsole(obj).pages; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_pages := 0; - End; - End; -End; - -Function ptc_console_pitch(obj : TPTC_CONSOLE) : Integer; - -Begin - Try - ptc_console_pitch := TPTCBaseConsole(obj).pitch; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_pitch := 0; - End; - End; -End; - -Function ptc_console_area(obj : TPTC_CONSOLE) : TPTC_AREA; - -Begin - Try - ptc_console_area := TPTC_AREA(TPTCBaseConsole(obj).area); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_area := Nil; - End; - End; -End; - -Function ptc_console_clip(obj : TPTC_CONSOLE) : TPTC_AREA; - -Begin - Try - ptc_console_clip := TPTC_AREA(TPTCBaseConsole(obj).clip); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_clip := Nil; - End; - End; -End; - -Function ptc_console_format(obj : TPTC_CONSOLE) : TPTC_FORMAT; - -Begin - Try - ptc_console_format := TPTC_FORMAT(TPTCBaseConsole(obj).format); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_format := Nil; - End; - End; -End; - -Function ptc_console_name(obj : TPTC_CONSOLE) : String; - -Begin - Try - ptc_console_name := TPTCBaseConsole(obj).name; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_name := ''; - End; - End; -End; - -Function ptc_console_title(obj : TPTC_CONSOLE) : String; - -Begin - Try - ptc_console_title := TPTCBaseConsole(obj).title; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_title := ''; - End; - End; -End; - -Function ptc_console_information(obj : TPTC_CONSOLE) : String; - -Begin - Try - ptc_console_information := TPTCBaseConsole(obj).information; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_console_information := ''; - End; - End; -End; diff --git a/packages/ptc/src/c_api/consoled.inc b/packages/ptc/src/c_api/consoled.inc deleted file mode 100644 index 3d00204192..0000000000 --- a/packages/ptc/src/c_api/consoled.inc +++ /dev/null @@ -1,83 +0,0 @@ -{ setup } -Function ptc_console_create : TPTC_CONSOLE; -Procedure ptc_console_destroy(obj : TPTC_CONSOLE); - -{ console configuration } -Procedure ptc_console_configure(obj : TPTC_CONSOLE; _file : String); - -{ console option string } -Function ptc_console_option(obj : TPTC_CONSOLE; _option : String) : Boolean; - -{ console modes } -Function ptc_console_mode(obj : TPTC_CONSOLE; index : Integer) : TPTC_MODE; - -{ console management } -Procedure ptc_console_open(obj : TPTC_CONSOLE; title : String; pages : Integer); -Procedure ptc_console_open_format(obj : TPTC_CONSOLE; title : String; format : TPTC_FORMAT; pages : Integer); -Procedure ptc_console_open_resolution(obj : TPTC_CONSOLE; title : String; width, height : Integer; format : TPTC_FORMAT; pages : Integer); -Procedure ptc_console_open_mode(obj : TPTC_CONSOLE; title : String; mode : TPTC_MODE; pages : Integer); -Procedure ptc_console_close(obj : TPTC_CONSOLE); - -{ synchronization } -Procedure ptc_console_flush(obj : TPTC_CONSOLE); -Procedure ptc_console_finish(obj : TPTC_CONSOLE); -Procedure ptc_console_update(obj : TPTC_CONSOLE); -Procedure ptc_console_update_area(obj : TPTC_CONSOLE; area : TPTC_AREA); - -{ keyboard input } -Function ptc_console_key(obj : TPTC_CONSOLE) : Boolean; -Procedure ptc_console_read(obj : TPTC_CONSOLE; key : TPTC_KEY); - -{ copy to surface } -Procedure ptc_console_copy(obj : TPTC_CONSOLE; surface : TPTC_SURFACE); -Procedure ptc_console_copy_area(obj : TPTC_CONSOLE; surface : TPTC_SURFACE; source, destination : TPTC_AREA); - -{ memory access } -Function ptc_console_lock(obj : TPTC_CONSOLE) : Pointer; -Procedure ptc_console_unlock(obj : TPTC_CONSOLE); - -{ load pixels to console } -Procedure ptc_console_load(obj : TPTC_CONSOLE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE); -Procedure ptc_console_load_area(obj : TPTC_CONSOLE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE; source, destination : TPTC_AREA); - -{ save console pixels } -Procedure ptc_console_save(obj : TPTC_CONSOLE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE); -Procedure ptc_console_save_area(obj : TPTC_CONSOLE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE; source, destination : TPTC_AREA); - -{ clear console } -Procedure ptc_console_clear(obj : TPTC_CONSOLE); -Procedure ptc_console_clear_color(obj : TPTC_CONSOLE; color : TPTC_COLOR); -Procedure ptc_console_clear_color_area(obj : TPTC_CONSOLE; color : TPTC_COLOR; area : TPTC_AREA); - -{ console palette } -Procedure ptc_console_palette_set(obj : TPTC_CONSOLE; palette : TPTC_PALETTE); -Function ptc_console_palette_get(obj : TPTC_CONSOLE) : TPTC_PALETTE; - -{ console clip area } -Procedure ptc_console_clip_set(obj : TPTC_CONSOLE; area : TPTC_AREA); - -{ data access } -Function ptc_console_width(obj : TPTC_CONSOLE) : Integer; -Function ptc_console_height(obj : TPTC_CONSOLE) : Integer; -Function ptc_console_pages(obj : TPTC_CONSOLE) : Integer; -Function ptc_console_pitch(obj : TPTC_CONSOLE) : Integer; -Function ptc_console_area(obj : TPTC_CONSOLE) : TPTC_AREA; -Function ptc_console_clip(obj : TPTC_CONSOLE) : TPTC_AREA; -Function ptc_console_format(obj : TPTC_CONSOLE) : TPTC_FORMAT; -Function ptc_console_name(obj : TPTC_CONSOLE) : String; -Function ptc_console_title(obj : TPTC_CONSOLE) : String; -Function ptc_console_information(obj : TPTC_CONSOLE) : String; - -{ extension functions } -{#ifdef __PTC_WIN32_EXTENSIONS__ -CAPI void PTCAPI ptc_console_open_window(PTC_CONSOLE object,HWND window,int pages); -CAPI void PTCAPI ptc_console_open_window_format(PTC_CONSOLE object,HWND window,PTC_FORMAT format,int pages); -CAPI void PTCAPI ptc_console_open_window_resolution(PTC_CONSOLE object,HWND window,int width,int height,PTC_FORMAT format,int pages); -CAPI void PTCAPI ptc_console_open_window_mode(PTC_CONSOLE object,HWND window,PTC_MODE mode,int pages); -CAPI HWND PTCAPI ptc_console_window(PTC_CONSOLE object); -CAPI LPDIRECTDRAW PTCAPI ptc_console_lpDD(PTC_CONSOLE object); -CAPI LPDIRECTDRAW2 PTCAPI ptc_console_lpDD2(PTC_CONSOLE object); -CAPI LPDIRECTDRAWSURFACE PTCAPI ptc_console_lpDDS(PTC_CONSOLE object); -CAPI LPDIRECTDRAWSURFACE PTCAPI ptc_console_lpDDS_primary(PTC_CONSOLE object); -CAPI LPDIRECTDRAWSURFACE PTCAPI ptc_console_lpDDS_secondary(PTC_CONSOLE object); -#endif} diff --git a/packages/ptc/src/c_api/copy.inc b/packages/ptc/src/c_api/copy.inc deleted file mode 100644 index 838c812b78..0000000000 --- a/packages/ptc/src/c_api/copy.inc +++ /dev/null @@ -1,74 +0,0 @@ -Function ptc_copy_create : TPTC_COPY; - -Begin - Try - ptc_copy_create := TPTC_COPY(TPTCCopy.Create); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_copy_create := Nil; - End; - End; -End; - -Procedure ptc_copy_destroy(obj : TPTC_COPY); - -Begin - If obj = Nil Then - Exit; - Try - TPTCCopy(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_copy_request(obj : TPTC_COPY; source, destination : TPTC_FORMAT); - -Begin - Try - TPTCCopy(obj).request(TPTCFormat(source), TPTCFormat(destination)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_copy_palette(obj : TPTC_COPY; source, destination : TPTC_PALETTE); - -Begin - Try - TPTCCopy(obj).palette(TPTCPalette(source), TPTCPalette(destination)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_copy_copy(obj : TPTC_COPY; source_pixels : Pointer; source_x, source_y, source_width, source_height, source_pitch : Integer; - destination_pixels : Pointer; destination_x, destination_y, destination_width, destination_height, destination_pitch : Integer); - -Begin - Try - 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); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_copy_option(obj : TPTC_COPY; option : String) : Boolean; - -Begin - Try - TPTCCopy(obj).option(option); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_copy_option := False; - End; - End; -End; diff --git a/packages/ptc/src/c_api/copyd.inc b/packages/ptc/src/c_api/copyd.inc deleted file mode 100644 index d87cc3552f..0000000000 --- a/packages/ptc/src/c_api/copyd.inc +++ /dev/null @@ -1,16 +0,0 @@ -{ setup } -Function ptc_copy_create : TPTC_COPY; -Procedure ptc_copy_destroy(obj : TPTC_COPY); - -{ set source and destination formats } -Procedure ptc_copy_request(obj : TPTC_COPY; source, destination : TPTC_FORMAT); - -{ set source and destination palettes } -Procedure ptc_copy_palette(obj : TPTC_COPY; source, destination : TPTC_PALETTE); - -{ copy pixels } -Procedure ptc_copy_copy(obj : TPTC_COPY; source_pixels : Pointer; source_x, source_y, source_width, source_height, source_pitch : Integer; - destination_pixels : Pointer; destination_x, destination_y, destination_width, destination_height, destination_pitch : Integer); - -{ copy option string } -Function ptc_copy_option(obj : TPTC_COPY; option : String) : Boolean; diff --git a/packages/ptc/src/c_api/error.inc b/packages/ptc/src/c_api/error.inc deleted file mode 100644 index af05fbb66b..0000000000 --- a/packages/ptc/src/c_api/error.inc +++ /dev/null @@ -1,96 +0,0 @@ -Function ptc_error_create(message : String) : TPTC_ERROR; - -Begin - Try - ptc_error_create := TPTC_ERROR(TPTCError.Create(message)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_error_create := Nil; - End; - End; -End; - -Function ptc_error_create_composite(message : String; error : TPTC_ERROR) : TPTC_ERROR; - -Begin - Try - ptc_error_create_composite := TPTC_ERROR(TPTCError.Create(message, TPTCError(error))); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_error_create_composite := Nil; - End; - End; -End; - -Procedure ptc_error_destroy(obj : TPTC_ERROR); - -Begin - If obj = Nil Then - Exit; - Try - TPTCError(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_error_report(obj : TPTC_ERROR); - -Begin - Try - TPTCError(obj).report; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_error_message(obj : TPTC_ERROR) : String; - -Begin - Try - ptc_error_message := TPTCError(obj).message; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_error_message := ''; - End; - End; -End; - -Procedure ptc_error_assign(obj, error : TPTC_ERROR); - -Begin - Try - TPTCError(obj).ASSign(TPTCError(error)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_error_equals(obj, error : TPTC_ERROR) : Boolean; - -Begin - Try - ptc_error_equals := TPTCError(obj).Equals(TPTCError(error)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_error_equals := False; - End; - End; -End; - -Procedure ptc_error_handler(handler : TPTC_ERROR_HANDLER); - -Begin - ptc_exception_handler(handler); -End; diff --git a/packages/ptc/src/c_api/errord.inc b/packages/ptc/src/c_api/errord.inc deleted file mode 100644 index 0eff904d73..0000000000 --- a/packages/ptc/src/c_api/errord.inc +++ /dev/null @@ -1,15 +0,0 @@ -Type - TPTC_ERROR_HANDLER = Procedure(error : TPTC_ERROR); - -Function ptc_error_create(message : String) : TPTC_ERROR; -Function ptc_error_create_composite(message : String; error : TPTC_ERROR) : TPTC_ERROR; -Procedure ptc_error_destroy(obj : TPTC_ERROR); - -Procedure ptc_error_report(obj : TPTC_ERROR); - -Function ptc_error_message(obj : TPTC_ERROR) : String; - -Procedure ptc_error_assign(obj, error : TPTC_ERROR); -Function ptc_error_equals(obj, error : TPTC_ERROR) : Boolean; - -Procedure ptc_error_handler(handler : TPTC_ERROR_HANDLER); diff --git a/packages/ptc/src/c_api/except.inc b/packages/ptc/src/c_api/except.inc deleted file mode 100644 index d6eb32b576..0000000000 --- a/packages/ptc/src/c_api/except.inc +++ /dev/null @@ -1,23 +0,0 @@ -Var - ptc_error_handler_function : TPTC_ERROR_HANDLER; - -Procedure ptc_error_handler_default(error : TPTC_ERROR); - -Begin - TPTCError(error).report; -End; - -Procedure ptc_exception_handler(handler : TPTC_ERROR_HANDLER); - -Begin - If handler = Nil Then - ptc_error_handler_function := @ptc_error_handler_default - Else - ptc_error_handler_function := handler; -End; - -Procedure ptc_exception_handle(error : TPTCError); - -Begin - ptc_error_handler_function(TPTC_ERROR(error)); -End; diff --git a/packages/ptc/src/c_api/exceptd.inc b/packages/ptc/src/c_api/exceptd.inc deleted file mode 100644 index b84497aa61..0000000000 --- a/packages/ptc/src/c_api/exceptd.inc +++ /dev/null @@ -1,2 +0,0 @@ -Procedure ptc_exception_handler(handler : TPTC_ERROR_HANDLER); -Procedure ptc_exception_handle(error : TPTCError); diff --git a/packages/ptc/src/c_api/format.inc b/packages/ptc/src/c_api/format.inc deleted file mode 100644 index 55db5e762f..0000000000 --- a/packages/ptc/src/c_api/format.inc +++ /dev/null @@ -1,191 +0,0 @@ -Function ptc_format_create : TPTC_FORMAT; - -Begin - Try - ptc_format_create := TPTC_FORMAT(TPTCFormat.Create); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_create := Nil; - End; - End; -End; - -Function ptc_format_create_indexed(bits : Integer) : TPTC_FORMAT; - -Begin - Try - ptc_format_create_indexed := TPTC_FORMAT(TPTCFormat.Create(bits)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_create_indexed := Nil; - End; - End; -End; - -Function ptc_format_create_direct(bits : Integer; r, g, b, a : int32) : TPTC_FORMAT; - -Begin - Try - ptc_format_create_direct := TPTC_FORMAT(TPTCFormat.Create(bits, r, g, b, a)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_create_direct := Nil; - End; - End; -End; - -Procedure ptc_format_destroy(obj : TPTC_FORMAT); - -Begin - If obj = Nil Then - Exit; - Try - TPTCFormat(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_format_r(obj : TPTC_FORMAT) : int32; - -Begin - Try - ptc_format_r := TPTCFormat(obj).r; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_r := 0; - End; - End; -End; - -Function ptc_format_g(obj : TPTC_FORMAT) : int32; - -Begin - Try - ptc_format_g := TPTCFormat(obj).g; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_g := 0; - End; - End; -End; - -Function ptc_format_b(obj : TPTC_FORMAT) : int32; - -Begin - Try - ptc_format_b := TPTCFormat(obj).b; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_b := 0; - End; - End; -End; - -Function ptc_format_a(obj : TPTC_FORMAT) : int32; - -Begin - Try - ptc_format_a := TPTCFormat(obj).a; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_a := 0; - End; - End; -End; - -Function ptc_format_bits(obj : TPTC_FORMAT) : Integer; - -Begin - Try - ptc_format_bits := TPTCFormat(obj).bits; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_bits := 0; - End; - End; -End; - -Function ptc_format_bytes(obj : TPTC_FORMAT) : Integer; - -Begin - Try - ptc_format_bytes := TPTCFormat(obj).bytes; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_bytes := 0; - End; - End; -End; - -Function ptc_format_direct(obj : TPTC_FORMAT) : Boolean; - -Begin - Try - ptc_format_direct := TPTCFormat(obj).direct; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_direct := False; - End; - End; -End; - -Function ptc_format_indexed(obj : TPTC_FORMAT) : Boolean; - -Begin - Try - ptc_format_indexed := TPTCFormat(obj).indexed; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_indexed := False; - End; - End; -End; - -Procedure ptc_format_assign(obj, format : TPTC_FORMAT); - -Begin - Try - TPTCFormat(obj).ASSign(TPTCFormat(format)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_format_equals(obj, format : TPTC_FORMAT) : Boolean; - -Begin - Try - ptc_format_equals := TPTCFormat(obj).Equals(TPTCFormat(format)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_format_equals := False; - End; - End; -End; diff --git a/packages/ptc/src/c_api/formatd.inc b/packages/ptc/src/c_api/formatd.inc deleted file mode 100644 index b235e13078..0000000000 --- a/packages/ptc/src/c_api/formatd.inc +++ /dev/null @@ -1,19 +0,0 @@ -{ setup } -Function ptc_format_create : TPTC_FORMAT; -Function ptc_format_create_indexed(bits : Integer) : TPTC_FORMAT; -Function ptc_format_create_direct(bits : Integer; r, g, b, a : int32) : TPTC_FORMAT; -Procedure ptc_format_destroy(obj : TPTC_FORMAT); - -{ data access } -Function ptc_format_r(obj : TPTC_FORMAT) : int32; -Function ptc_format_g(obj : TPTC_FORMAT) : int32; -Function ptc_format_b(obj : TPTC_FORMAT) : int32; -Function ptc_format_a(obj : TPTC_FORMAT) : int32; -Function ptc_format_bits(obj : TPTC_FORMAT) : Integer; -Function ptc_format_bytes(obj : TPTC_FORMAT) : Integer; -Function ptc_format_direct(obj : TPTC_FORMAT) : Boolean; -Function ptc_format_indexed(obj : TPTC_FORMAT) : Boolean; - -{ operators } -Procedure ptc_format_assign(obj, format : TPTC_FORMAT); -Function ptc_format_equals(obj, format : TPTC_FORMAT) : Boolean; diff --git a/packages/ptc/src/c_api/index.inc b/packages/ptc/src/c_api/index.inc deleted file mode 100644 index 4698836290..0000000000 --- a/packages/ptc/src/c_api/index.inc +++ /dev/null @@ -1,14 +0,0 @@ -Type - { object handles } - TPTC_KEY = Pointer; { equivalent to Object Pascal TPTCKey } - TPTC_AREA = Pointer; { equivalent to Object Pascal TPTCArea } - TPTC_MODE = Pointer; { equivalent to Object Pascal TPTCMode } - TPTC_COPY = Pointer; { equivalent to Object Pascal TPTCCopy } - TPTC_CLEAR = Pointer; { equivalent to Object Pascal TPTCClear } - TPTC_TIMER = Pointer; { equivalent to Object Pascal TPTCTimer } - TPTC_ERROR = Pointer; { equivalent to Object Pascal TPTCError } - TPTC_COLOR = Pointer; { equivalent to Object Pascal TPTCColor } - TPTC_FORMAT = Pointer; { equivalent to Object Pascal TPTCFormat } - TPTC_PALETTE = Pointer; { equivalent to Object Pascal TPTCPalette } - TPTC_SURFACE = Pointer; { equivalent to Object Pascal TPTCBaseSurface } - TPTC_CONSOLE = Pointer; { equivalent to Object Pascal TPTCBaseConsole } diff --git a/packages/ptc/src/c_api/key.inc b/packages/ptc/src/c_api/key.inc deleted file mode 100644 index d622dba32e..0000000000 --- a/packages/ptc/src/c_api/key.inc +++ /dev/null @@ -1,107 +0,0 @@ -Function ptc_key_create(code : Integer; alt, shift, control : Boolean) : TPTC_KEY; - -Begin - Try - ptc_key_create := TPTC_KEY(TPTCKey.Create(code, alt, shift, control)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_key_create := Nil; - End; - End; -End; - -Procedure ptc_key_destroy(obj : TPTC_KEY); - -Begin - If obj = Nil Then - Exit; - Try - TPTCKey(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_key_code(obj : TPTC_KEY) : Integer; - -Begin - Try - ptc_key_code := Integer(TPTCKey(obj).code); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_key_code := 0; - End; - End; -End; - -Function ptc_key_alt(obj : TPTC_KEY) : Boolean; - -Begin - Try - ptc_key_alt := TPTCKey(obj).alt; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_key_alt := False; - End; - End; -End; - -Function ptc_key_shift(obj : TPTC_KEY) : Boolean; - -Begin - Try - ptc_key_shift := TPTCKey(obj).shift; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_key_shift := False; - End; - End; -End; - -Function ptc_key_control(obj : TPTC_KEY) : Boolean; - -Begin - Try - ptc_key_control := TPTCKey(obj).control; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_key_control := False; - End; - End; -End; - -Procedure ptc_key_assign(obj : TPTC_KEY; key : TPTC_KEY); - -Begin - Try - TPTCKey(obj).ASSign(TPTCKey(key)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_key_equals(obj : TPTC_KEY; key : TPTC_KEY) : Boolean; - -Begin - Try - ptc_key_equals := TPTCKey(obj).Equals(TPTCKey(key)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_key_equals := False; - End; - End; -End; diff --git a/packages/ptc/src/c_api/mode.inc b/packages/ptc/src/c_api/mode.inc deleted file mode 100644 index 7bc7369b16..0000000000 --- a/packages/ptc/src/c_api/mode.inc +++ /dev/null @@ -1,121 +0,0 @@ -Function ptc_mode_create(width, height : Integer; format : TPTC_FORMAT) : TPTC_MODE; - -Begin - Try - ptc_mode_create := TPTC_MODE(TPTCMode.Create(width, height, TPTCFormat(format))); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_mode_create := Nil; - End; - End; -End; - -Function ptc_mode_create_invalid : TPTC_MODE; - -Begin - Try - ptc_mode_create_invalid := TPTC_MODE(TPTCMode.Create); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_mode_create_invalid := Nil; - End; - End; -End; - -Procedure ptc_mode_destroy(obj : TPTC_MODE); - -Begin - If obj = Nil Then - Exit; - Try - TPTCMode(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_mode_valid(obj : TPTC_MODE) : Boolean; - -Begin - Try - ptc_mode_valid := TPTCMode(obj).valid; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_mode_valid := False; - End; - End; -End; - -Function ptc_mode_width(obj : TPTC_MODE) : Integer; - -Begin - Try - ptc_mode_width := TPTCMode(obj).width; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_mode_width := 0; - End; - End; -End; - -Function ptc_mode_height(obj : TPTC_MODE) : Integer; - -Begin - Try - ptc_mode_height := TPTCMode(obj).height; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_mode_height := 0; - End; - End; -End; - -Function ptc_mode_format(obj : TPTC_MODE) : TPTC_FORMAT; - -Begin - Try - ptc_mode_format := TPTC_FORMAT(TPTCMode(obj).format); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_mode_format := Nil; - End; - End; -End; - -Procedure ptc_mode_assign(obj, mode : TPTC_MODE); - -Begin - Try - TPTCMode(obj).ASSign(TPTCMode(mode)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_mode_equals(obj, mode : TPTC_MODE) : Boolean; - -Begin - Try - ptc_mode_equals := TPTCMode(obj).Equals(TPTCMode(mode)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_mode_equals := False; - End; - End; -End; diff --git a/packages/ptc/src/c_api/moded.inc b/packages/ptc/src/c_api/moded.inc deleted file mode 100644 index 61c9d6f8b6..0000000000 --- a/packages/ptc/src/c_api/moded.inc +++ /dev/null @@ -1,16 +0,0 @@ -{ setup } -Function ptc_mode_create(width, height : Integer; format : TPTC_FORMAT) : TPTC_MODE; -Function ptc_mode_create_invalid : TPTC_MODE; -Procedure ptc_mode_destroy(obj : TPTC_MODE); - -{ valid mode flag } -Function ptc_mode_valid(obj : TPTC_MODE) : Boolean; - -{ data access } -Function ptc_mode_width(obj : TPTC_MODE) : Integer; -Function ptc_mode_height(obj : TPTC_MODE) : Integer; -Function ptc_mode_format(obj : TPTC_MODE) : TPTC_FORMAT; - -{ operators } -Procedure ptc_mode_assign(obj, mode : TPTC_MODE); -Function ptc_mode_equals(obj, mode : TPTC_MODE) : Boolean; diff --git a/packages/ptc/src/c_api/palette.inc b/packages/ptc/src/c_api/palette.inc deleted file mode 100644 index 6cf5e6c054..0000000000 --- a/packages/ptc/src/c_api/palette.inc +++ /dev/null @@ -1,126 +0,0 @@ -Function ptc_palette_create : TPTC_PALETTE; - -Begin - Try - ptc_palette_create := TPTC_PALETTE(TPTCPalette.Create); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_palette_create := Nil; - End; - End; -End; - -{Function ptc_palette_create_data(data : Pint32) : TPTC_PALETTE; - -Begin - Try - ptc_palette_create_data := TPTC_PALETTE(TPTCPalette.Create(data)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_palette_create_data := Nil; - End; - End; -End;} - -Procedure ptc_palette_destroy(obj : TPTC_PALETTE); - -Begin - If obj = Nil Then - Exit; - Try - TPTCPalette(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_palette_lock(obj : TPTC_PALETTE) : Pint32; - -Begin - Try - ptc_palette_lock := TPTCPalette(obj).lock; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_palette_lock := Nil; - End; - End; -End; - -Procedure ptc_palette_unlock(obj : TPTC_PALETTE); - -Begin - Try - TPTCPalette(obj).unlock; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_palette_load(obj : TPTC_PALETTE; data : Pint32); - -Begin - Try - TPTCPalette(obj).load(data); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_palette_save(obj : TPTC_PALETTE; data : Pint32); - -Begin - Try - TPTCPalette(obj).save(data); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_palette_data(obj : TPTC_PALETTE) : Pint32; - -Begin - Try - ptc_palette_data := TPTCPalette(obj).data; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_palette_data := Nil; - End; - End; -End; - -Procedure ptc_palette_assign(obj, palette : TPTC_PALETTE); - -Begin - Try - TPTCPalette(obj).ASSign(TPTCPalette(palette)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_palette_equals(obj, palette : TPTC_PALETTE) : Boolean; - -Begin - Try - ptc_palette_equals := TPTCPalette(obj).Equals(TPTCPalette(palette)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_palette_equals := False; - End; - End; -End; diff --git a/packages/ptc/src/c_api/paletted.inc b/packages/ptc/src/c_api/paletted.inc deleted file mode 100644 index ffa28ac3d0..0000000000 --- a/packages/ptc/src/c_api/paletted.inc +++ /dev/null @@ -1,21 +0,0 @@ -{ setup } -Function ptc_palette_create : TPTC_PALETTE; -{Function ptc_palette_create_data(data : Pint32) : TPTC_PALETTE;} -Procedure ptc_palette_destroy(obj : TPTC_PALETTE); - -{ memory access } -Function ptc_palette_lock(obj : TPTC_PALETTE) : Pint32; -Procedure ptc_palette_unlock(obj : TPTC_PALETTE); - -{ load palette data } -Procedure ptc_palette_load(obj : TPTC_PALETTE; data : Pint32); - -{ save palette data } -Procedure ptc_palette_save(obj : TPTC_PALETTE; data : Pint32); - -{ get palette data } -Function ptc_palette_data(obj : TPTC_PALETTE) : Pint32; - -{ operators } -Procedure ptc_palette_assign(obj, palette : TPTC_PALETTE); -Function ptc_palette_equals(obj, palette : TPTC_PALETTE) : Boolean; diff --git a/packages/ptc/src/c_api/surface.inc b/packages/ptc/src/c_api/surface.inc deleted file mode 100644 index 13e95d9043..0000000000 --- a/packages/ptc/src/c_api/surface.inc +++ /dev/null @@ -1,284 +0,0 @@ -Function ptc_surface_create(width, height : Integer; format : TPTC_FORMAT) : TPTC_SURFACE; - -Begin - Try - ptc_surface_create := TPTC_SURFACE(TPTCSurface.Create(width, height, TPTCFormat(format))); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_create := Nil; - End; - End; -End; - -Procedure ptc_surface_destroy(obj : TPTC_SURFACE); - -Begin - If obj = Nil Then - Exit; - Try - TPTCBaseSurface(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_copy(obj : TPTC_SURFACE; surface : TPTC_SURFACE); - -Begin - Try - TPTCBaseSurface(obj).copy(TPTCBaseSurface(surface)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_copy_area(obj : TPTC_SURFACE; surface : TPTC_SURFACE; source, destination : TPTC_AREA); - -Begin - Try - TPTCBaseSurface(obj).copy(TPTCBaseSurface(surface), TPTCArea(source), TPTCArea(destination)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_surface_lock(obj : TPTC_SURFACE) : Pointer; - -Begin - Try - ptc_surface_lock := TPTCBaseSurface(obj).lock; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_lock := Nil; - End; - End; -End; - -Procedure ptc_surface_unlock(obj : TPTC_SURFACE); - -Begin - Try - TPTCBaseSurface(obj).unlock; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_load(obj : TPTC_SURFACE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE); - -Begin - Try - TPTCBaseSurface(obj).load(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_load_area(obj : TPTC_SURFACE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE; source, destination : TPTC_AREA); - -Begin - Try - TPTCBaseSurface(obj).load(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette), TPTCArea(source), TPTCArea(destination)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_save(obj : TPTC_SURFACE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE); - -Begin - Try - TPTCBaseSurface(obj).save(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_save_area(obj : TPTC_SURFACE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE; source, destination : TPTC_AREA); - -Begin - Try - TPTCBaseSurface(obj).save(pixels, width, height, pitch, TPTCFormat(format), TPTCPalette(palette), TPTCArea(source), TPTCArea(destination)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_clear(obj : TPTC_SURFACE); - -Begin - Try - TPTCBaseSurface(obj).clear; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_clear_color(obj : TPTC_SURFACE; color : TPTC_COLOR); - -Begin - Try - TPTCBaseSurface(obj).clear(TPTCColor(color)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_clear_color_area(obj : TPTC_SURFACE; color : TPTC_COLOR; area : TPTC_AREA); - -Begin - Try - TPTCBaseSurface(obj).clear(TPTCColor(color), TPTCArea(area)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_surface_palette_set(obj : TPTC_SURFACE; palette : TPTC_PALETTE); - -Begin - Try - TPTCBaseSurface(obj).palette(TPTCPalette(palette)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_surface_palette_get(obj : TPTC_SURFACE) : TPTC_PALETTE; - -Begin - Try - ptc_surface_palette_get := TPTC_PALETTE(TPTCBaseSurface(obj).palette); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_palette_get := Nil; - End; - End; -End; - -Procedure ptc_surface_clip_set(obj : TPTC_SURFACE; area : TPTC_AREA); - -Begin - Try - TPTCBaseSurface(obj).clip(TPTCArea(area)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_surface_width(obj : TPTC_SURFACE) : Integer; - -Begin - Try - ptc_surface_width := TPTCBaseSurface(obj).width; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_width := 0; - End; - End; -End; - -Function ptc_surface_height(obj : TPTC_SURFACE) : Integer; - -Begin - Try - ptc_surface_height := TPTCBaseSurface(obj).height; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_height := 0; - End; - End; -End; - -Function ptc_surface_pitch(obj : TPTC_SURFACE) : Integer; - -Begin - Try - ptc_surface_pitch := TPTCBaseSurface(obj).pitch; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_pitch := 0; - End; - End; -End; - -Function ptc_surface_area(obj : TPTC_SURFACE) : TPTC_AREA; - -Begin - Try - ptc_surface_area := TPTC_AREA(TPTCBaseSurface(obj).area); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_area := Nil; - End; - End; -End; - -Function ptc_surface_clip(obj : TPTC_SURFACE) : TPTC_AREA; - -Begin - Try - ptc_surface_clip := TPTC_AREA(TPTCBaseSurface(obj).clip); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_clip := Nil; - End; - End; -End; - -Function ptc_surface_format(obj : TPTC_SURFACE) : TPTC_FORMAT; - -Begin - Try - ptc_surface_format := TPTC_FORMAT(TPTCBaseSurface(obj).format); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_format := Nil; - End; - End; -End; - -Function ptc_surface_option(obj : TPTC_SURFACE; _option : String) : Boolean; - -Begin - Try - ptc_surface_option := TPTCBaseSurface(obj).option(_option); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_surface_option := False; - End; - End; -End; diff --git a/packages/ptc/src/c_api/surfaced.inc b/packages/ptc/src/c_api/surfaced.inc deleted file mode 100644 index 986de99d8e..0000000000 --- a/packages/ptc/src/c_api/surfaced.inc +++ /dev/null @@ -1,42 +0,0 @@ -{ setup } -Function ptc_surface_create(width, height : Integer; format : TPTC_FORMAT) : TPTC_SURFACE; -Procedure ptc_surface_destroy(obj : TPTC_SURFACE); - -{ copy to surface } -Procedure ptc_surface_copy(obj : TPTC_SURFACE; surface : TPTC_SURFACE); -Procedure ptc_surface_copy_area(obj : TPTC_SURFACE; surface : TPTC_SURFACE; source, destination : TPTC_AREA); - -{ memory access } -Function ptc_surface_lock(obj : TPTC_SURFACE) : Pointer; -Procedure ptc_surface_unlock(obj : TPTC_SURFACE); - -{ load pixels to surface } -Procedure ptc_surface_load(obj : TPTC_SURFACE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE); -Procedure ptc_surface_load_area(obj : TPTC_SURFACE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE; source, destination : TPTC_AREA); - -{ save surface pixels } -Procedure ptc_surface_save(obj : TPTC_SURFACE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE); -Procedure ptc_surface_save_area(obj : TPTC_SURFACE; pixels : Pointer; width, height, pitch : Integer; format : TPTC_FORMAT; palette : TPTC_PALETTE; source, destination : TPTC_AREA); - -{ clear surface } -Procedure ptc_surface_clear(obj : TPTC_SURFACE); -Procedure ptc_surface_clear_color(obj : TPTC_SURFACE; color : TPTC_COLOR); -Procedure ptc_surface_clear_color_area(obj : TPTC_SURFACE; color : TPTC_COLOR; area : TPTC_AREA); - -{ surface palette } -Procedure ptc_surface_palette_set(obj : TPTC_SURFACE; palette : TPTC_PALETTE); -Function ptc_surface_palette_get(obj : TPTC_SURFACE) : TPTC_PALETTE; - -{ surface clip area } -Procedure ptc_surface_clip_set(obj : TPTC_SURFACE; area : TPTC_AREA); - -{ data access } -Function ptc_surface_width(obj : TPTC_SURFACE) : Integer; -Function ptc_surface_height(obj : TPTC_SURFACE) : Integer; -Function ptc_surface_pitch(obj : TPTC_SURFACE) : Integer; -Function ptc_surface_area(obj : TPTC_SURFACE) : TPTC_AREA; -Function ptc_surface_clip(obj : TPTC_SURFACE) : TPTC_AREA; -Function ptc_surface_format(obj : TPTC_SURFACE) : TPTC_FORMAT; - -{ surface option string } -Function ptc_surface_option(obj : TPTC_SURFACE; _option : String) : Boolean; diff --git a/packages/ptc/src/c_api/timer.inc b/packages/ptc/src/c_api/timer.inc deleted file mode 100644 index 32f2f6ae66..0000000000 --- a/packages/ptc/src/c_api/timer.inc +++ /dev/null @@ -1,126 +0,0 @@ -Function ptc_timer_create : TPTC_TIMER; - -Begin - Try - ptc_timer_create := TPTC_TIMER(TPTCTimer.Create); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_timer_create := Nil; - End; - End; -End; - -Procedure ptc_timer_destroy(obj : TPTC_TIMER); - -Begin - If obj = Nil Then - Exit; - Try - TPTCTimer(obj).Destroy; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_timer_set(obj : TPTC_TIMER; time : Double); - -Begin - Try - TPTCTimer(obj).settime(time); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_timer_start(obj : TPTC_TIMER); - -Begin - Try - TPTCTimer(obj).start; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Procedure ptc_timer_stop(obj : TPTC_TIMER); - -Begin - Try - TPTCTimer(obj).stop; - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_timer_time(obj : TPTC_TIMER) : Double; - -Begin - Try - ptc_timer_time := TPTCTimer(obj).time; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_timer_time := 0; - End; - End; -End; - -Function ptc_timer_delta(obj : TPTC_TIMER) : Double; - -Begin - Try - ptc_timer_delta := TPTCTimer(obj).delta; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_timer_delta := 0; - End; - End; -End; - -Function ptc_timer_resolution(obj : TPTC_TIMER) : Double; - -Begin - Try - ptc_timer_resolution := TPTCTimer(obj).resolution; - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_timer_resolution := 0; - End; - End; -End; - -Procedure ptc_timer_assign(obj, timer : TPTC_TIMER); - -Begin - Try - TPTCTimer(obj).ASSign(TPTCTimer(timer)); - Except - On error : TPTCError Do - ptc_exception_handle(error); - End; -End; - -Function ptc_timer_equals(obj, timer : TPTC_TIMER) : Boolean; - -Begin - Try - ptc_timer_equals := TPTCTimer(obj).equals(TPTCTimer(timer)); - Except - On error : TPTCError Do - Begin - ptc_exception_handle(error); - ptc_timer_equals := False; - End; - End; -End; diff --git a/packages/ptc/src/c_api/timerd.inc b/packages/ptc/src/c_api/timerd.inc deleted file mode 100644 index 731eef3ee4..0000000000 --- a/packages/ptc/src/c_api/timerd.inc +++ /dev/null @@ -1,19 +0,0 @@ -{ setup } -Function ptc_timer_create : TPTC_TIMER; -Procedure ptc_timer_destroy(obj : TPTC_TIMER); - -{ set time } -Procedure ptc_timer_set(obj : TPTC_TIMER; time : Double); - -{ control } -Procedure ptc_timer_start(obj : TPTC_TIMER); -Procedure ptc_timer_stop(obj : TPTC_TIMER); - -{ time data } -Function ptc_timer_time(obj : TPTC_TIMER) : Double; -Function ptc_timer_delta(obj : TPTC_TIMER) : Double; -Function ptc_timer_resolution(obj : TPTC_TIMER) : Double; - -{ operators } -Procedure ptc_timer_assign(obj, timer : TPTC_TIMER); -Function ptc_timer_equals(obj, timer : TPTC_TIMER) : Boolean; |
