mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-18 15:49:17 +02:00
* new translation of libgd headers, including windows support. because of some ABI changes, I didn't delete the old gd.pp header file. The new one is called libgd.pas
git-svn-id: trunk@12517 -
This commit is contained in:
parent
6c7d64620c
commit
33ae673041
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -3112,6 +3112,7 @@ packages/libgd/examples/gdtest.pp svneol=native#text/plain
|
|||||||
packages/libgd/examples/gdtestcgi.pp svneol=native#text/plain
|
packages/libgd/examples/gdtestcgi.pp svneol=native#text/plain
|
||||||
packages/libgd/fpmake.pp svneol=native#text/plain
|
packages/libgd/fpmake.pp svneol=native#text/plain
|
||||||
packages/libgd/src/gd.pp svneol=native#text/plain
|
packages/libgd/src/gd.pp svneol=native#text/plain
|
||||||
|
packages/libgd/src/libgd.pas svneol=native#text/plain
|
||||||
packages/libndsfpc/Makefile svneol=native#text/plain
|
packages/libndsfpc/Makefile svneol=native#text/plain
|
||||||
packages/libndsfpc/Makefile.fpc svneol=native#text/plain
|
packages/libndsfpc/Makefile.fpc svneol=native#text/plain
|
||||||
packages/libndsfpc/examples/devkitPro/Graphics/2D/16bit_color_bmp/data/drunkenlogo.git svneol=native#text/plain
|
packages/libndsfpc/examples/devkitPro/Graphics/2D/16bit_color_bmp/data/drunkenlogo.git svneol=native#text/plain
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/12/12]
|
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/01/04]
|
||||||
#
|
#
|
||||||
default: all
|
default: all
|
||||||
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
|
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
|
||||||
@ -265,178 +265,178 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(F
|
|||||||
override PACKAGE_NAME=libgd
|
override PACKAGE_NAME=libgd
|
||||||
override PACKAGE_VERSION=2.2.2
|
override PACKAGE_VERSION=2.2.2
|
||||||
ifeq ($(FULL_TARGET),i386-linux)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-go32v2)
|
ifeq ($(FULL_TARGET),i386-go32v2)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-win32)
|
ifeq ($(FULL_TARGET),i386-win32)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-os2)
|
ifeq ($(FULL_TARGET),i386-os2)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-freebsd)
|
ifeq ($(FULL_TARGET),i386-freebsd)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-beos)
|
ifeq ($(FULL_TARGET),i386-beos)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-haiku)
|
ifeq ($(FULL_TARGET),i386-haiku)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-netbsd)
|
ifeq ($(FULL_TARGET),i386-netbsd)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-solaris)
|
ifeq ($(FULL_TARGET),i386-solaris)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-qnx)
|
ifeq ($(FULL_TARGET),i386-qnx)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-netware)
|
ifeq ($(FULL_TARGET),i386-netware)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-openbsd)
|
ifeq ($(FULL_TARGET),i386-openbsd)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-wdosx)
|
ifeq ($(FULL_TARGET),i386-wdosx)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-darwin)
|
ifeq ($(FULL_TARGET),i386-darwin)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-emx)
|
ifeq ($(FULL_TARGET),i386-emx)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-watcom)
|
ifeq ($(FULL_TARGET),i386-watcom)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-netwlibc)
|
ifeq ($(FULL_TARGET),i386-netwlibc)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-wince)
|
ifeq ($(FULL_TARGET),i386-wince)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-embedded)
|
ifeq ($(FULL_TARGET),i386-embedded)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-symbian)
|
ifeq ($(FULL_TARGET),i386-symbian)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-linux)
|
ifeq ($(FULL_TARGET),m68k-linux)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-freebsd)
|
ifeq ($(FULL_TARGET),m68k-freebsd)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-netbsd)
|
ifeq ($(FULL_TARGET),m68k-netbsd)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-amiga)
|
ifeq ($(FULL_TARGET),m68k-amiga)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-atari)
|
ifeq ($(FULL_TARGET),m68k-atari)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-openbsd)
|
ifeq ($(FULL_TARGET),m68k-openbsd)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-palmos)
|
ifeq ($(FULL_TARGET),m68k-palmos)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-embedded)
|
ifeq ($(FULL_TARGET),m68k-embedded)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-linux)
|
ifeq ($(FULL_TARGET),powerpc-linux)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-amiga)
|
ifeq ($(FULL_TARGET),powerpc-amiga)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-macos)
|
ifeq ($(FULL_TARGET),powerpc-macos)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-darwin)
|
ifeq ($(FULL_TARGET),powerpc-darwin)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-morphos)
|
ifeq ($(FULL_TARGET),powerpc-morphos)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-embedded)
|
ifeq ($(FULL_TARGET),powerpc-embedded)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-linux)
|
ifeq ($(FULL_TARGET),sparc-linux)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-netbsd)
|
ifeq ($(FULL_TARGET),sparc-netbsd)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-solaris)
|
ifeq ($(FULL_TARGET),sparc-solaris)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-embedded)
|
ifeq ($(FULL_TARGET),sparc-embedded)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-linux)
|
ifeq ($(FULL_TARGET),x86_64-linux)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-darwin)
|
ifeq ($(FULL_TARGET),x86_64-darwin)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-win64)
|
ifeq ($(FULL_TARGET),x86_64-win64)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-embedded)
|
ifeq ($(FULL_TARGET),x86_64-embedded)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-linux)
|
ifeq ($(FULL_TARGET),arm-linux)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-palmos)
|
ifeq ($(FULL_TARGET),arm-palmos)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-darwin)
|
ifeq ($(FULL_TARGET),arm-darwin)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-wince)
|
ifeq ($(FULL_TARGET),arm-wince)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-gba)
|
ifeq ($(FULL_TARGET),arm-gba)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-nds)
|
ifeq ($(FULL_TARGET),arm-nds)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-embedded)
|
ifeq ($(FULL_TARGET),arm-embedded)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-symbian)
|
ifeq ($(FULL_TARGET),arm-symbian)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc64-darwin)
|
ifeq ($(FULL_TARGET),powerpc64-darwin)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc64-embedded)
|
ifeq ($(FULL_TARGET),powerpc64-embedded)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),avr-embedded)
|
ifeq ($(FULL_TARGET),avr-embedded)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),armeb-linux)
|
ifeq ($(FULL_TARGET),armeb-linux)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),armeb-embedded)
|
ifeq ($(FULL_TARGET),armeb-embedded)
|
||||||
override TARGET_UNITS+=gd
|
override TARGET_UNITS+=libgd
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-linux)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override TARGET_EXAMPLEDIRS+=examples
|
override TARGET_EXAMPLEDIRS+=examples
|
||||||
|
@ -10,7 +10,7 @@ version=2.2.2
|
|||||||
libc=y
|
libc=y
|
||||||
|
|
||||||
[target]
|
[target]
|
||||||
units=gd
|
units=libgd
|
||||||
exampledirs=examples
|
exampledirs=examples
|
||||||
|
|
||||||
[install]
|
[install]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
program gdtest;
|
program gdtest;
|
||||||
|
|
||||||
uses gd;
|
uses libgd;
|
||||||
|
|
||||||
var
|
var
|
||||||
f:pFile;
|
f:pFile;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
program gdtestcgi;
|
program gdtestcgi;
|
||||||
|
|
||||||
uses gd;
|
uses libgd;
|
||||||
|
|
||||||
var
|
var
|
||||||
f:pFile;
|
f:pFile;
|
||||||
|
967
packages/libgd/src/libgd.pas
Normal file
967
packages/libgd/src/libgd.pas
Normal file
@ -0,0 +1,967 @@
|
|||||||
|
{
|
||||||
|
Translation of the libgd headers for FreePascal
|
||||||
|
Copyright(C) 2009 by Ivo Steinmann
|
||||||
|
}
|
||||||
|
|
||||||
|
unit libgd;
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
{$macro on}
|
||||||
|
{$h+}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
ctypes;
|
||||||
|
|
||||||
|
{$IFDEF WINDOWS}
|
||||||
|
{$DEFINE DYNLINK}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF DYNLINK}
|
||||||
|
const
|
||||||
|
{$IF Defined(WINDOWS)}
|
||||||
|
gdlib = 'bgd.dll';
|
||||||
|
clib = 'msvcrt.dll';
|
||||||
|
{$ELSEIF Defined(UNIX)}
|
||||||
|
gdlib = 'libgd.so';
|
||||||
|
clib = 'libc.so';
|
||||||
|
{$ELSE}
|
||||||
|
{$MESSAGE ERROR 'DYNLINK not supported'}
|
||||||
|
{$IFEND}
|
||||||
|
{$ELSE}
|
||||||
|
{$LINKLIB gd}
|
||||||
|
{$LINKLIB c}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$DEFINE BGD_DECLARE := external {$IFDEF DYNLINK}gdlib{$ENDIF}}
|
||||||
|
{$DEFINE BGD_DECLARE_CLIB := external {$IFDEF DYNLINK}clib{$ENDIF}}
|
||||||
|
|
||||||
|
{$IF Defined(WINDOWS)}
|
||||||
|
{$DEFINE GDCALL := stdcall}
|
||||||
|
{$ELSEIF Defined(UNIX)}
|
||||||
|
{$DEFINE GDCALL := cdecl}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
type
|
||||||
|
ppcint = ^pcint;
|
||||||
|
ppbyte = ^pbyte;
|
||||||
|
PFILE = pointer;
|
||||||
|
|
||||||
|
const
|
||||||
|
GD_MAJOR_VERSION = 2;
|
||||||
|
GD_MINOR_VERSION = 0;
|
||||||
|
GD_RELEASE_VERSION = 35;
|
||||||
|
GD_EXTRA_VERSION = '';
|
||||||
|
GD_VERSION_STRING = '2.0.35';
|
||||||
|
|
||||||
|
|
||||||
|
(* gd.h: declarations file for the graphic-draw module.
|
||||||
|
* Permission to use, copy, modify, and distribute this software and its
|
||||||
|
* documentation for any purpose and without fee is hereby granted, provided
|
||||||
|
* that the above copyright notice appear in all copies and that both that
|
||||||
|
* copyright notice and this permission notice appear in supporting
|
||||||
|
* documentation. This software is provided "AS IS." Thomas Boutell and
|
||||||
|
* Boutell.Com, Inc. disclaim all warranties, either express or implied,
|
||||||
|
* including but not limited to implied warranties of merchantability and
|
||||||
|
* fitness for a particular purpose, with respect to this code and accompanying
|
||||||
|
* documentation. *)
|
||||||
|
|
||||||
|
(* stdio is needed for file I/O. *)
|
||||||
|
//#include <stdio.h>
|
||||||
|
//#include "gd_io.h"
|
||||||
|
type
|
||||||
|
gdIOCtxPtr = ^gdIOCtx;
|
||||||
|
gdIOCtx = record
|
||||||
|
getC : function(ctx: gdIOCtxPtr): cint; GDCALL;
|
||||||
|
getBuf : function(ctx: gdIOCtxPtr; buf: pointer; len: cint): cint; GDCALL;
|
||||||
|
putC : procedure(ctx: gdIOCtxPtr; len: cint); GDCALL;
|
||||||
|
putBuf : procedure(ctx: gdIOCtxPtr; buf: pointer; len: cint); GDCALL;
|
||||||
|
(* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! *)
|
||||||
|
seek : function(ctx: gdIOCtxPtr; pos: cint): cint; GDCALL;
|
||||||
|
tell : function(ctx: gdIOCtxPtr): clong; GDCALL;
|
||||||
|
gd_free : procedure(ctx: gdIOCtxPtr); GDCALL;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function fopen(filename, rights: pchar): PFile; GDCALL; BGD_DECLARE_CLIB;
|
||||||
|
procedure fclose(f: PFile); GDCALL; BGD_DECLARE_CLIB;
|
||||||
|
|
||||||
|
(* The maximum number of palette entries in palette-based images.
|
||||||
|
In the wonderful new world of gd 2.0, you can of course have
|
||||||
|
many more colors when using truecolor mode. *)
|
||||||
|
|
||||||
|
const
|
||||||
|
gdMaxColors = 256;
|
||||||
|
|
||||||
|
(* Image type. See functions below; you will not need to change
|
||||||
|
the elements directly. Use the provided macros to
|
||||||
|
access sx, sy, the color table, and colorsTotal for
|
||||||
|
read-only purposes. *)
|
||||||
|
|
||||||
|
(* If 'truecolor' is set true, the image is truecolor;
|
||||||
|
pixels are represented by integers, which
|
||||||
|
must be 32 bits wide or more.
|
||||||
|
|
||||||
|
True colors are repsented as follows:
|
||||||
|
|
||||||
|
ARGB
|
||||||
|
|
||||||
|
Where 'A'(alpha channel) occupies only the
|
||||||
|
LOWER 7 BITS of the MSB. This very small
|
||||||
|
loss of alpha channel resolution allows gd 2.x
|
||||||
|
to keep backwards compatibility by allowing
|
||||||
|
signed integers to be used to represent colors,
|
||||||
|
and negative numbers to represent special cases,
|
||||||
|
just as in gd 1.x. *)
|
||||||
|
|
||||||
|
const
|
||||||
|
gdAlphaMax = 127;
|
||||||
|
gdAlphaOpaque = 0;
|
||||||
|
gdAlphaTransparent = 127;
|
||||||
|
gdRedMax = 255;
|
||||||
|
gdGreenMax = 255;
|
||||||
|
gdBlueMax = 255;
|
||||||
|
|
||||||
|
function gdTrueColorGetAlpha(c: cint): cint; inline;
|
||||||
|
function gdTrueColorGetRed(c: cint): cint; inline;
|
||||||
|
function gdTrueColorGetGreen(c: cint): cint; inline;
|
||||||
|
function gdTrueColorGetBlue(c: cint): cint; inline;
|
||||||
|
|
||||||
|
(* This function accepts truecolor pixel values only. The
|
||||||
|
source color is composited with the destination color
|
||||||
|
based on the alpha channel value of the source color.
|
||||||
|
The resulting color is opaque. *)
|
||||||
|
|
||||||
|
function gdAlphaBlend(dest: cint; src: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdAlphaBlend@8'{$ENDIF};
|
||||||
|
|
||||||
|
type
|
||||||
|
gdImagePtr = ^gdImage;
|
||||||
|
gdImage = record
|
||||||
|
|
||||||
|
(* Palette-based image pixels *)
|
||||||
|
pixels: ppbyte;
|
||||||
|
sx: cint;
|
||||||
|
sy: cint;
|
||||||
|
(* These are valid in palette images only. See also
|
||||||
|
'alpha', which appears later in the structure to
|
||||||
|
preserve binary backwards compatibility *)
|
||||||
|
colorsTotal: cint;
|
||||||
|
red: array[0..gdMaxColors-1] of cint;
|
||||||
|
green: array[0..gdMaxColors-1] of cint;
|
||||||
|
blue: array[0..gdMaxColors-1] of cint;
|
||||||
|
open: array[0..gdMaxColors-1] of cint;
|
||||||
|
(* For backwards compatibility, this is set to the
|
||||||
|
first palette entry with 100% transparency,
|
||||||
|
and is also set and reset by the
|
||||||
|
gdImageColorTransparent function. Newer
|
||||||
|
applications can allocate palette entries
|
||||||
|
with any desired level of transparency; however,
|
||||||
|
bear in mind that many viewers, notably
|
||||||
|
many web browsers, fail to implement
|
||||||
|
full alpha channel for PNG and provide
|
||||||
|
support for full opacity or transparency only. *)
|
||||||
|
transparent: cint;
|
||||||
|
polyInts: pcint;
|
||||||
|
polyAllocated: cint;
|
||||||
|
brush: gdImagePtr;
|
||||||
|
tile: gdImagePtr;
|
||||||
|
brushColorMap: array[0..gdMaxColors-1] of cint;
|
||||||
|
tileColorMap: array[0..gdMaxColors-1] of cint;
|
||||||
|
styleLength: cint;
|
||||||
|
stylePos: cint;
|
||||||
|
style: pcint;
|
||||||
|
interlace: cint;
|
||||||
|
(* New in 2.0: thickness of line. Initialized to 1. *)
|
||||||
|
thick: cint;
|
||||||
|
(* New in 2.0: alpha channel for palettes. Note that only
|
||||||
|
Macintosh Internet Explorer and(possibly) Netscape 6
|
||||||
|
really support multiple levels of transparency in
|
||||||
|
palettes, to my knowledge, as of 2/15/01. Most
|
||||||
|
common browsers will display 100% opaque and
|
||||||
|
100% transparent correctly, and do something
|
||||||
|
unpredictable and/or undesirable for levels
|
||||||
|
in between. TBB *)
|
||||||
|
alpha: array[0..gdMaxColors-1] of cint;
|
||||||
|
(* Truecolor flag and pixels. New 2.0 fields appear here at the
|
||||||
|
end to minimize breakage of existing object code. *)
|
||||||
|
trueColor: cint;
|
||||||
|
tpixels: ppcint;
|
||||||
|
(* Should alpha channel be copied, or applied, each time a
|
||||||
|
pixel is drawn? This applies to truecolor images only.
|
||||||
|
No attempt is made to alpha-blend in palette images,
|
||||||
|
even if semitransparent palette entries exist.
|
||||||
|
To do that, build your image as a truecolor image,
|
||||||
|
then quantize down to 8 bits. *)
|
||||||
|
alphaBlendingFlag: cint;
|
||||||
|
(* Should the alpha channel of the image be saved? This affects
|
||||||
|
PNG at the moment; other future formats may also
|
||||||
|
have that capability. JPEG doesn't. *)
|
||||||
|
saveAlphaFlag: cint;
|
||||||
|
|
||||||
|
(* There should NEVER BE ACCESSOR MACROS FOR ITEMS BELOW HERE, so this
|
||||||
|
part of the structure can be safely changed in new releases. *)
|
||||||
|
|
||||||
|
(* 2.0.12: anti-aliased globals. 2.0.26: just a few vestiges after
|
||||||
|
switching to the fast, memory-cheap implementation from PHP-gd. *)
|
||||||
|
AA: cint;
|
||||||
|
AA_color: cint;
|
||||||
|
AA_dont_blend: cint;
|
||||||
|
|
||||||
|
(* 2.0.12: simple clipping rectangle. These values
|
||||||
|
must be checked for safety when set; please use
|
||||||
|
gdImageSetClip *)
|
||||||
|
cx1: cint;
|
||||||
|
cy1: cint;
|
||||||
|
cx2: cint;
|
||||||
|
cy2: cint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
gdFontPtr = ^gdFont;
|
||||||
|
gdFont = record
|
||||||
|
(* # of characters in font *)
|
||||||
|
nchars: cint;
|
||||||
|
(* First character is numbered...(usually 32 = space) *)
|
||||||
|
offset: cint;
|
||||||
|
(* Character width and height *)
|
||||||
|
w: cint;
|
||||||
|
h: cint;
|
||||||
|
(* Font data; array of characters, one row after another.
|
||||||
|
Easily included in code, also easily loaded from
|
||||||
|
data files. *)
|
||||||
|
data: pchar;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
(* For backwards compatibility only. Use gdImageSetStyle()
|
||||||
|
for MUCH more flexible line drawing. Also see
|
||||||
|
gdImageSetBrush(). *)
|
||||||
|
const
|
||||||
|
gdDashSize = 4;
|
||||||
|
|
||||||
|
(* Special colors. *)
|
||||||
|
|
||||||
|
gdStyled =(-2);
|
||||||
|
gdBrushed =(-3);
|
||||||
|
gdStyledBrushed =(-4);
|
||||||
|
gdTiled =(-5);
|
||||||
|
|
||||||
|
(* NOT the same as the transparent color index.
|
||||||
|
This is used in line styles only. *)
|
||||||
|
gdTransparent =(-6);
|
||||||
|
|
||||||
|
gdAntiAliased =(-7);
|
||||||
|
|
||||||
|
(* Functions to manipulate images. *)
|
||||||
|
|
||||||
|
(* Creates a palette-based image(up to 256 colors). *)
|
||||||
|
function gdImageCreate(sx: cint; sy: cint): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreate@8'{$ENDIF};
|
||||||
|
|
||||||
|
(* An alternate name for the above(2.0). *)
|
||||||
|
function gdImageCreatePalette(sx: cint; sy: cint): gdImagePtr;
|
||||||
|
|
||||||
|
(* Creates a truecolor image(millions of colors). *)
|
||||||
|
function gdImageCreateTrueColor(sx: cint; sy: cint): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateTrueColor@8'{$ENDIF};
|
||||||
|
|
||||||
|
(* Creates an image from various file types. These functions
|
||||||
|
return a palette or truecolor image based on the
|
||||||
|
nature of the file being loaded. Truecolor PNG
|
||||||
|
stays truecolor; palette PNG stays palette-based;
|
||||||
|
JPEG is always truecolor. *)
|
||||||
|
function gdImageCreateFromPng(fd: PFILE): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromPng@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromPngCtx(_in: gdIOCtxPtr): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromPngCtx@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromPngPtr(size: cint; data: pointer): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromPngPtr@8'{$ENDIF};
|
||||||
|
|
||||||
|
(* These read the first frame only *)
|
||||||
|
function gdImageCreateFromGif(fd: PFILE): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGif@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromGifCtx(_in: gdIOCtxPtr): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGifCtx@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromGifPtr(size: cint; data: pointer): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGifPtr@8'{$ENDIF};
|
||||||
|
function gdImageCreateFromWBMP(fd: PFILE): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromWBMP@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromWBMPCtx(_in: gdIOCtxPtr): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromWBMPCtx@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromWBMPPtr(size: cint; data: pointer): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromWBMPPtr@8'{$ENDIF};
|
||||||
|
function gdImageCreateFromJpeg(fd: PFILE): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromJpeg@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromJpegCtx(_in: gdIOCtxPtr): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromJpegCtx@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromJpegPtr(size: cint; data: pointer): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromJpegPtr@8'{$ENDIF};
|
||||||
|
|
||||||
|
(* A custom data source. *)
|
||||||
|
(* The source function must return -1 on error, otherwise the number
|
||||||
|
of bytes fetched. 0 is EOF, not an error! *)
|
||||||
|
(* context will be passed to your source function. *)
|
||||||
|
|
||||||
|
type
|
||||||
|
gdSourcePtr = ^gdSource;
|
||||||
|
gdSource = record
|
||||||
|
source : function(context: pointer; buffer: pchar; len: cint): cint; GDCALL;
|
||||||
|
context : pointer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
(* Deprecated in favor of gdImageCreateFromPngCtx *)
|
||||||
|
function gdImageCreateFromPngSource(_in: gdSourcePtr): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromPngSource@4'{$ENDIF};
|
||||||
|
|
||||||
|
function gdImageCreateFromGd(_in: PFILE): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGd@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromGdCtx(_in: gdIOCtxPtr): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGdCtx@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromGdPtr(size: cint; data: pointer): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGdPtr@8'{$ENDIF};
|
||||||
|
|
||||||
|
function gdImageCreateFromGd2(_in: PFILE): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGd2@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromGd2Ctx(_in: gdIOCtxPtr): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGd2Ctx@4'{$ENDIF};
|
||||||
|
function gdImageCreateFromGd2Ptr(size: cint; data: pointer): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGd2Ptr@8'{$ENDIF};
|
||||||
|
|
||||||
|
function gdImageCreateFromGd2Part(_in: PFILE; srcx: cint; srcy: cint; w: cint; h: cint): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGd2Part@20'{$ENDIF};
|
||||||
|
function gdImageCreateFromGd2PartCtx(_in: gdIOCtxPtr; srcx: cint; srcy: cint; w: cint; h: cint): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGd2PartCtx@20'{$ENDIF};
|
||||||
|
function gdImageCreateFromGd2PartPtr(size: cint; data: pointer; srcx: cint; srcy: cint; w: cint; h: cint): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromGd2PartCtx@24'{$ENDIF};
|
||||||
|
(* 2.0.10: prototype was missing *)
|
||||||
|
function gdImageCreateFromXbm(_in: PFILE): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromXbm@4'{$ENDIF};
|
||||||
|
|
||||||
|
(* NOTE: filename, not FILE *)
|
||||||
|
function gdImageCreateFromXpm(filename: pchar): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreateFromXpm@4'{$ENDIF};
|
||||||
|
|
||||||
|
procedure gdImageDestroy(im: gdImagePtr); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageDestroy@4'{$ENDIF};
|
||||||
|
|
||||||
|
(* Replaces or blends with the background depending on the
|
||||||
|
most recent call to gdImageAlphaBlending and the
|
||||||
|
alpha channel value of 'color'; default is to overwrite.
|
||||||
|
Tiling and line styling are also implemented
|
||||||
|
here. All other gd drawing functions pass through this call,
|
||||||
|
allowing for many useful effects. *)
|
||||||
|
|
||||||
|
procedure gdImageSetPixel(im: gdImagePtr; x: cint; y: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageSetPixel@16'{$ENDIF};
|
||||||
|
(* FreeType 2 text output with hook to extra flags *)
|
||||||
|
|
||||||
|
function gdImageGetPixel(im: gdImagePtr; x: cint; y: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGetPixel@12'{$ENDIF};
|
||||||
|
function gdImageGetTrueColorPixel(im: gdImagePtr; x: cint; y: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGetTrueColorPixel@12'{$ENDIF};
|
||||||
|
|
||||||
|
procedure gdImageAABlend(im: gdImagePtr); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageAABlend@4'{$ENDIF};
|
||||||
|
|
||||||
|
procedure gdImageLine(im: gdImagePtr; x1: cint; y1: cint; x2: cint; y2: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageLine@24'{$ENDIF};
|
||||||
|
|
||||||
|
(* For backwards compatibility only. Use gdImageSetStyle()
|
||||||
|
for much more flexible line drawing. *)
|
||||||
|
procedure gdImageDashedLine(im: gdImagePtr; x1: cint; y1: cint; x2: cint; y2: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageDashedLine@24'{$ENDIF};
|
||||||
|
(* Corners specified(not width and height). Upper left first, lower right
|
||||||
|
second. *)
|
||||||
|
procedure gdImageRectangle(im: gdImagePtr; x1: cint; y1: cint; x2: cint; y2: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageRectangle@24'{$ENDIF};
|
||||||
|
(* Solid bar. Upper left corner first, lower right corner second. *)
|
||||||
|
procedure gdImageFilledRectangle(im: gdImagePtr; x1: cint; y1: cint; x2: cint; y2: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageFilledRectangle@24'{$ENDIF};
|
||||||
|
procedure gdImageSetClip(im: gdImagePtr; x1: cint; y1: cint; x2: cint; y2: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageSetClip@20'{$ENDIF};
|
||||||
|
procedure gdImageGetClip(im: gdImagePtr; var x1: cint; var y1: cint; var x2: cint; var y2: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGetClip@20'{$ENDIF};
|
||||||
|
function gdImageBoundsSafe(im: gdImagePtr; x: cint; y: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageBoundsSafe@12'{$ENDIF};
|
||||||
|
procedure gdImageChar(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; c: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageChar@24'{$ENDIF};
|
||||||
|
procedure gdImageCharUp(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; c: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCharUp@24'{$ENDIF};
|
||||||
|
procedure gdImageString(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: pchar; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageString@24'{$ENDIF};
|
||||||
|
procedure gdImageStringUp(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: pchar; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageStringUp@24'{$ENDIF};
|
||||||
|
procedure gdImageString16(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: pwidechar; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageString16@24'{$ENDIF};
|
||||||
|
procedure gdImageStringUp16(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: pwidechar; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageStringUp16@24'{$ENDIF};
|
||||||
|
|
||||||
|
(* 2.0.16: for thread-safe use of gdImageStringFT and friends,
|
||||||
|
call this before allowing any thread to call gdImageStringFT.
|
||||||
|
Otherwise it is invoked by the first thread to invoke
|
||||||
|
gdImageStringFT, with a very small but real risk of a race condition.
|
||||||
|
Return 0 on success, nonzero on failure to initialize freetype. *)
|
||||||
|
function gdFontCacheSetup(): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdFontCacheSetup@0'{$ENDIF};
|
||||||
|
|
||||||
|
(* Optional: clean up after application is done using fonts in
|
||||||
|
BGD_DECLARE( ) gdImageStringFT(). *)
|
||||||
|
procedure gdFontCacheShutdown(); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdFontCacheShutdown@0'{$ENDIF};
|
||||||
|
(* 2.0.20: for backwards compatibility. A few applications did start calling
|
||||||
|
this function when it first appeared although it was never documented.
|
||||||
|
Simply invokes gdFontCacheShutdown. *)
|
||||||
|
procedure gdFreeFontCache(); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdFreeFontCache@0'{$ENDIF};
|
||||||
|
|
||||||
|
(* Calls gdImageStringFT. Provided for backwards compatibility only. *)
|
||||||
|
function gdImageStringTTF(im: gdImagePtr; brect: pcint; fg: cint; fontlist: pchar; ptsize: double; angle: double; x: cint; y: cint; str: pchar): pchar; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageStringTTF@36'{$ENDIF};
|
||||||
|
|
||||||
|
(* FreeType 2 text output *)
|
||||||
|
function gdImageStringFT(im: gdImagePtr; brect: pcint; fg: cint; fontlist: pchar; ptsize: double; angle: double; x: cint; y: cint; str: pchar): pchar; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageStringFT@36'{$ENDIF};
|
||||||
|
|
||||||
|
(* 2.0.5: provides an extensible way to pass additional parameters.
|
||||||
|
Thanks to Wez Furlong, sorry for the delay. *)
|
||||||
|
|
||||||
|
type
|
||||||
|
gdFTStringExtraPtr = ^gdFTStringExtra;
|
||||||
|
gdFTStringExtra = record
|
||||||
|
flags: cint; (* Logical OR of gdFTEX_ values *)
|
||||||
|
linespacing: double; (* fine tune line spacing for '\n' *)
|
||||||
|
charmap: cint;
|
||||||
|
(* TBB: 2.0.12: may be gdFTEX_Unicode,
|
||||||
|
gdFTEX_Shift_JIS, gdFTEX_Big5,
|
||||||
|
or gdFTEX_Adobe_Custom;
|
||||||
|
when not specified, maps are searched
|
||||||
|
for in the above order. *)
|
||||||
|
hdpi: cint; (* if(flags & gdFTEX_RESOLUTION) *)
|
||||||
|
vdpi: cint; (* if(flags & gdFTEX_RESOLUTION) *)
|
||||||
|
xshow: pchar;
|
||||||
|
(* if(flags & gdFTEX_XSHOW)
|
||||||
|
then, on return, xshow is a malloc'ed
|
||||||
|
string contining xshow position data for
|
||||||
|
the last string.
|
||||||
|
|
||||||
|
NB. The caller is responsible for gdFree'ing
|
||||||
|
the xshow string.
|
||||||
|
*)
|
||||||
|
fontpath: pchar; (* if(flags & gdFTEX_RETURNFONTPATHNAME)
|
||||||
|
then, on return, fontpath is a malloc'ed
|
||||||
|
string containing the actual font file path name
|
||||||
|
used, which can be interesting when fontconfig
|
||||||
|
is in use.
|
||||||
|
|
||||||
|
The caller is responsible for gdFree'ing the
|
||||||
|
fontpath string.
|
||||||
|
*)
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
gdFTEX_LINESPACE = 1;
|
||||||
|
gdFTEX_CHARMAP = 2;
|
||||||
|
gdFTEX_RESOLUTION = 4;
|
||||||
|
gdFTEX_DISABLE_KERNING = 8;
|
||||||
|
gdFTEX_XSHOW = 16;
|
||||||
|
(* The default unless gdFTUseFontConfig(1); has been called:
|
||||||
|
fontlist is a full or partial font file pathname or list thereof
|
||||||
|
(i.e. just like before 2.0.29) *)
|
||||||
|
gdFTEX_FONTPATHNAME = 32;
|
||||||
|
(* Necessary to use fontconfig patterns instead of font pathnames
|
||||||
|
as the fontlist argument, unless gdFTUseFontConfig(1); has
|
||||||
|
been called. New in 2.0.29 *)
|
||||||
|
gdFTEX_FONTCONFIG = 64;
|
||||||
|
(* Sometimes interesting when fontconfig is used: the fontpath
|
||||||
|
element of the structure above will contain a gdMalloc'd string
|
||||||
|
copy of the actual font file pathname used, if this flag is set
|
||||||
|
when the call is made *)
|
||||||
|
gdFTEX_RETURNFONTPATHNAME = 128;
|
||||||
|
|
||||||
|
(* If flag is nonzero, the fontlist parameter to gdImageStringFT
|
||||||
|
and gdImageStringFTEx shall be assumed to be a fontconfig font pattern
|
||||||
|
if fontconfig was compiled into gd. This function returns zero
|
||||||
|
if fontconfig is not available, nonzero otherwise. *)
|
||||||
|
function gdFTUseFontConfig(flag: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdFTUseFontConfig@4'{$ENDIF};
|
||||||
|
|
||||||
|
(* These are NOT flags; set one in 'charmap' if you set the
|
||||||
|
gdFTEX_CHARMAP bit in 'flags'. *)
|
||||||
|
const
|
||||||
|
gdFTEX_Unicode = 0;
|
||||||
|
gdFTEX_Shift_JIS = 1;
|
||||||
|
gdFTEX_Big5 = 2;
|
||||||
|
gdFTEX_Adobe_Custom = 3;
|
||||||
|
|
||||||
|
function gdImageStringFTEx(im: gdImagePtr; brect: pcint; fg: cint; fontlist: pchar; ptsize: double; angle: double; x: cint; y: cint; str: pchar; strex: gdFTStringExtraPtr): pchar; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageStringFTEx@40'{$ENDIF};
|
||||||
|
|
||||||
|
(* Point type for use in polygon drawing. *)
|
||||||
|
type
|
||||||
|
gdPointPtr = ^gdPoint;
|
||||||
|
gdPoint = record
|
||||||
|
x, y: cint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure gdImagePolygon(im: gdImagePtr; p: gdPointPtr; n: cint; c: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImagePolygon@16'{$ENDIF};
|
||||||
|
procedure gdImageOpenPolygon(im: gdImagePtr; p: gdPointPtr; n: cint; c: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageOpenPolygon@16'{$ENDIF};
|
||||||
|
procedure gdImageFilledPolygon(im: gdImagePtr; p: gdPointPtr; n: cint; c: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageFilledPolygon@16'{$ENDIF};
|
||||||
|
|
||||||
|
(* These functions still work with truecolor images,
|
||||||
|
for which they never return error. *)
|
||||||
|
function gdImageColorAllocate(im: gdImagePtr; r: cint; g: cint; b: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorAllocate@16'{$ENDIF};
|
||||||
|
(* gd 2.0: palette entries with non-opaque transparency are permitted. *)
|
||||||
|
function gdImageColorAllocateAlpha(im: gdImagePtr; r: cint; g: cint; b: cint; a: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorAllocateAlpha@20'{$ENDIF};
|
||||||
|
(* Assumes opaque is the preferred alpha channel value *)
|
||||||
|
function gdImageColorClosest(im: gdImagePtr; r: cint; g: cint; b: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorClosest@16'{$ENDIF};
|
||||||
|
(* Closest match taking all four parameters into account.
|
||||||
|
A slightly different color with the same transparency
|
||||||
|
beats the exact same color with radically different
|
||||||
|
transparency *)
|
||||||
|
function gdImageColorClosestAlpha(im: gdImagePtr; r: cint; g: cint; b: cint; a: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorClosestAlpha@20'{$ENDIF};
|
||||||
|
(* An alternate method *)
|
||||||
|
function gdImageColorClosestHWB(im: gdImagePtr; r: cint; g: cint; b: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorClosestHWB@16'{$ENDIF};
|
||||||
|
(* Returns exact, 100% opaque matches only *)
|
||||||
|
function gdImageColorExact(im: gdImagePtr; r: cint; g: cint; b: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorExact@16'{$ENDIF};
|
||||||
|
(* Returns an exact match only, including alpha *)
|
||||||
|
function gdImageColorExactAlpha(im: gdImagePtr; r: cint; g: cint; b: cint; a: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorExactAlpha@20'{$ENDIF};
|
||||||
|
(* Opaque only *)
|
||||||
|
function gdImageColorResolve(im: gdImagePtr; r: cint; g: cint; b: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorResolve@16'{$ENDIF};
|
||||||
|
(* Based on gdImageColorExactAlpha and gdImageColorClosestAlpha *)
|
||||||
|
function gdImageColorResolveAlpha(im: gdImagePtr; r: cint; g: cint; b: cint; a: cint): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorResolveAlpha@20'{$ENDIF};
|
||||||
|
|
||||||
|
(* A simpler way to obtain an opaque truecolor value for drawing on a
|
||||||
|
truecolor image. Not for use with palette images! *)
|
||||||
|
function gdTrueColor(r: cint; g: cint; b: cint): cint;
|
||||||
|
|
||||||
|
(* Returns a truecolor value with an alpha channel component.
|
||||||
|
gdAlphaMax(127, **NOT 255** ) is transparent, 0 is completely
|
||||||
|
opaque. *)
|
||||||
|
function gdTrueColorAlpha(r: cint; g: cint; b: cint; a: cint): cint;
|
||||||
|
|
||||||
|
procedure gdImageColorDeallocate(im: gdImagePtr; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorDeallocate@8'{$ENDIF};
|
||||||
|
|
||||||
|
(* Converts a truecolor image to a palette-based image,
|
||||||
|
using a high-quality two-pass quantization routine
|
||||||
|
which attempts to preserve alpha channel information
|
||||||
|
as well as R/G/B color information when creating
|
||||||
|
a palette. If ditherFlag is set, the image will be
|
||||||
|
dithered to approximate colors better, at the expense
|
||||||
|
of some obvious "speckling." colorsWanted can be
|
||||||
|
anything up to 256. If the original source image
|
||||||
|
includes photographic information or anything that
|
||||||
|
came out of a JPEG, 256 is strongly recommended.
|
||||||
|
|
||||||
|
Better yet, don't use these function -- write real
|
||||||
|
truecolor PNGs and JPEGs. The disk space gain of
|
||||||
|
conversion to palette is not great(for small images
|
||||||
|
it can be negative) and the quality loss is ugly.
|
||||||
|
|
||||||
|
DIFFERENCES: gdImageCreatePaletteFromTrueColor creates and
|
||||||
|
returns a new image. gdImageTrueColorToPalette modifies
|
||||||
|
an existing image, and the truecolor pixels are discarded. *)
|
||||||
|
|
||||||
|
function gdImageCreatePaletteFromTrueColor(im: gdImagePtr; ditherFlag: cint; colorsWanted: cint): gdImagePtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCreatePaletteFromTrueColor@16'{$ENDIF};
|
||||||
|
|
||||||
|
procedure gdImageTrueColorToPalette(im: gdImagePtr; ditherFlag: cint; colorsWanted: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageTrueColorToPalette@16'{$ENDIF};
|
||||||
|
|
||||||
|
(* Specifies a color index(if a palette image) or an
|
||||||
|
RGB color(if a truecolor image) which should be
|
||||||
|
considered 100% transparent. FOR TRUECOLOR IMAGES,
|
||||||
|
THIS IS IGNORED IF AN ALPHA CHANNEL IS BEING
|
||||||
|
SAVED. Use gdImageSaveAlpha(im, 0); to
|
||||||
|
turn off the saving of a full alpha channel in
|
||||||
|
a truecolor image. Note that gdImageColorTransparent
|
||||||
|
is usually compatible with older browsers that
|
||||||
|
do not understand full alpha channels well. TBB *)
|
||||||
|
procedure gdImageColorTransparent(im: gdImagePtr; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageColorTransparent@8'{$ENDIF};
|
||||||
|
|
||||||
|
procedure gdImagePaletteCopy(dst: gdImagePtr; src: gdImagePtr); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImagePaletteCopy@8'{$ENDIF};
|
||||||
|
procedure gdImageGif(im: gdImagePtr; _out: PFILE); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGif@8'{$ENDIF};
|
||||||
|
procedure gdImagePng(im: gdImagePtr; _out: PFILE); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImagePng@8'{$ENDIF};
|
||||||
|
procedure gdImagePngCtx(im: gdImagePtr; _out: gdIOCtxPtr); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImagePngCtx@8'{$ENDIF};
|
||||||
|
procedure gdImageGifCtx(im: gdImagePtr; _out: gdIOCtxPtr); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGifCtx@8'{$ENDIF};
|
||||||
|
|
||||||
|
(* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
|
||||||
|
1 is FASTEST but produces larger files, 9 provides the best
|
||||||
|
compression(smallest files) but takes a long time to compress, and
|
||||||
|
-1 selects the default compiled into the zlib library. *)
|
||||||
|
procedure gdImagePngEx(im: gdImagePtr; _out: PFILE; level: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImagePngEx@12'{$ENDIF};
|
||||||
|
procedure gdImagePngCtxEx(im: gdImagePtr; _out: gdIOCtxPtr; level: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImagePngCtxEx@12'{$ENDIF};
|
||||||
|
|
||||||
|
procedure gdImageWBMP(image: gdImagePtr; fg: cint; _out: PFILE); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageWBMP@12'{$ENDIF};
|
||||||
|
procedure gdImageWBMPCtx(image: gdImagePtr; fg: cint; _out: gdIOCtxPtr); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageWBMPCtx@12'{$ENDIF};
|
||||||
|
|
||||||
|
(* Guaranteed to correctly free memory returned
|
||||||
|
by the gdImage*Ptr functions *)
|
||||||
|
procedure gdFree(m: pointer); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdFree@4'{$ENDIF};
|
||||||
|
|
||||||
|
(* Best to free this memory with gdFree(), not free() *)
|
||||||
|
function gdImageWBMPPtr(im: gdImagePtr; size: pcint; fg: cint): pointer; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageWBMPPtr@12'{$ENDIF};
|
||||||
|
|
||||||
|
(* 100 is highest quality(there is always a little loss with JPEG).
|
||||||
|
0 is lowest. 10 is about the lowest useful setting. *)
|
||||||
|
procedure gdImageJpeg(im: gdImagePtr; _out: PFILE; quality: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageJpeg@12'{$ENDIF};
|
||||||
|
procedure gdImageJpegCtx(im: gdImagePtr; _out: gdIOCtxPtr; quality: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageJpegCtx@12'{$ENDIF};
|
||||||
|
|
||||||
|
(* Best to free this memory with gdFree(), not free() *)
|
||||||
|
function gdImageJpegPtr(im: gdImagePtr; size: pcint; quality: cint): pointer; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageJpegPtr@12'{$ENDIF};
|
||||||
|
|
||||||
|
(* Legal values for Disposal. gdDisposalNone is always used by
|
||||||
|
the built-in optimizer if previm is passed. *)
|
||||||
|
|
||||||
|
(*
|
||||||
|
enum {
|
||||||
|
gdDisposalUnknown,
|
||||||
|
gdDisposalNone,
|
||||||
|
gdDisposalRestoreBackground,
|
||||||
|
gdDisposalRestorePrevious
|
||||||
|
};
|
||||||
|
|
||||||
|
procedure gdImageGifAnimBegin(im: gdImagePtr; _outFile: PFILE; int GlobalCM, int Loops); GDCALL; BGD_DECLARE;
|
||||||
|
procedure gdImageGifAnimAdd(im: gdImagePtr; _outFile: PFILE; int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm); GDCALL; BGD_DECLARE;
|
||||||
|
procedure gdImageGifAnimEnd(_outFile: PFILE); GDCALL; BGD_DECLARE;
|
||||||
|
procedure gdImageGifAnimBeginCtx(im: gdImagePtr; gdIOCtx *out, int GlobalCM, int Loops); GDCALL; BGD_DECLARE;
|
||||||
|
procedure gdImageGifAnimAddCtx(im: gdImagePtr; gdIOCtx *out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm); GDCALL; BGD_DECLARE;
|
||||||
|
procedure gdImageGifAnimEndCtx(gdIOCtx *out); GDCALL; BGD_DECLARE;
|
||||||
|
function gdImageGifAnimBeginPtr(im: gdImagePtr; int *size, int GlobalCM, int Loops): pointer; GDCALL; BGD_DECLARE;
|
||||||
|
function gdImageGifAnimAddPtr(im: gdImagePtr; int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm): pointer; GDCALL; BGD_DECLARE;
|
||||||
|
function gdImageGifAnimEndPtr(int *size): pointer; GDCALL; BGD_DECLARE;
|
||||||
|
*)
|
||||||
|
{$warning TODO}
|
||||||
|
|
||||||
|
(* A custom data sink. For backwards compatibility. Use
|
||||||
|
gdIOCtx instead. *)
|
||||||
|
(* The sink function must return -1 on error, otherwise the number
|
||||||
|
of bytes written, which must be equal to len. *)
|
||||||
|
(* context will be passed to your sink function. *)
|
||||||
|
type
|
||||||
|
gdSinkPtr = ^gdSink;
|
||||||
|
gdSink = record
|
||||||
|
sink : function(context: pointer; buffer: pchar; len: cint): cint; GDCALL;
|
||||||
|
context : pointer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure gdImagePngToSink(im: gdImagePtr; _out: gdSinkPtr); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImagePngToSink@8'{$ENDIF};
|
||||||
|
|
||||||
|
procedure gdImageGd(im: gdImagePtr; _out: PFILE); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGd@8'{$ENDIF};
|
||||||
|
procedure gdImageGd2(im: gdImagePtr; _out: PFILE; cs: cint; fmt: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGd2@16'{$ENDIF};
|
||||||
|
|
||||||
|
(* Best to free this memory with gdFree(), not free() *)
|
||||||
|
function gdImageGifPtr(im: gdImagePtr; var size: cint): pointer; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGifPtr@8'{$ENDIF};
|
||||||
|
|
||||||
|
(* Best to free this memory with gdFree(), not free() *)
|
||||||
|
function gdImagePngPtr(im: gdImagePtr; var size: cint): pointer; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImagePngPtr@8'{$ENDIF};
|
||||||
|
function gdImagePngPtrEx(im: gdImagePtr; var size: cint; level: cint): pointer; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImagePngPtrEx@12'{$ENDIF};
|
||||||
|
|
||||||
|
(* Best to free this memory with gdFree(), not free() *)
|
||||||
|
function gdImageGdPtr(im: gdImagePtr; var size: cint): pointer; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGdPtr@8'{$ENDIF};
|
||||||
|
|
||||||
|
(* Best to free this memory with gdFree(), not free() *)
|
||||||
|
function gdImageGd2Ptr(im: gdImagePtr; cs: cint; fmt: cint; var size: cint): pointer; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageGd2Ptr@16'{$ENDIF};
|
||||||
|
|
||||||
|
|
||||||
|
(* Style is a bitwise OR( | operator ) of these.
|
||||||
|
gdArc and gdChord are mutually exclusive;
|
||||||
|
gdChord just connects the starting and ending
|
||||||
|
angles with a straight line, while gdArc produces
|
||||||
|
a rounded edge. gdPie is a synonym for gdArc.
|
||||||
|
gdNoFill indicates that the arc or chord should be
|
||||||
|
outlined, not filled. gdEdged, used together with
|
||||||
|
gdNoFill, indicates that the beginning and ending
|
||||||
|
angles should be connected to the center; this is
|
||||||
|
a good way to outline(rather than fill) a
|
||||||
|
'pie slice'. *)
|
||||||
|
const
|
||||||
|
gdArc = 0;
|
||||||
|
gdPie = gdArc;
|
||||||
|
gdChord = 1;
|
||||||
|
gdNoFill = 2;
|
||||||
|
gdEdged = 4;
|
||||||
|
|
||||||
|
procedure gdImageFilledArc(im: gdImagePtr; cx: cint; cy: cint; w: cint; h: cint; s: cint; e: cint; color: cint; style: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageFilledArc@36'{$ENDIF};
|
||||||
|
procedure gdImageArc(im: gdImagePtr; cx: cint; cy: cint; w: cint; h: cint; s: cint; e: cint; color: cint; style: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageArc@36'{$ENDIF};
|
||||||
|
procedure gdImageEllipse(im: gdImagePtr; cx: cint; cy: cint; w: cint; h: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageEllipse@24'{$ENDIF};
|
||||||
|
procedure gdImageFilledEllipse(im: gdImagePtr; cx: cint; cy: cint; w: cint; h: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageFilledEllipse@24'{$ENDIF};
|
||||||
|
procedure gdImageFillToBorder(im: gdImagePtr; cx: cint; cy: cint; border: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageFillToBorder@20'{$ENDIF};
|
||||||
|
procedure gdImageFill(im: gdImagePtr; x: cint; y: cint; color: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageFill@16'{$ENDIF};
|
||||||
|
procedure gdImageCopy(dst: gdImagePtr; src: gdImagePtr; dstX: cint; dstY: cint; srcX: cint; srcY: cint; w: cint; h: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCopy@32'{$ENDIF};
|
||||||
|
procedure gdImageCopyMerge(dst: gdImagePtr; src: gdImagePtr; dstX: cint; dstY: cint; srcX: cint; srcY: cint; w: cint; h: cint; pct: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCopyMerge@36'{$ENDIF};
|
||||||
|
procedure gdImageCopyMergeGray(dst: gdImagePtr; src: gdImagePtr; dstX: cint; dstY: cint; srcX: cint; srcY: cint; w: cint; h: cint; pct: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCopyMergeGray@36'{$ENDIF};
|
||||||
|
|
||||||
|
(* Stretches or shrinks to fit, as needed. Does NOT attempt
|
||||||
|
to average the entire set of source pixels that scale down onto the
|
||||||
|
destination pixel. *)
|
||||||
|
procedure gdImageCopyResized(dst: gdImagePtr; src: gdImagePtr; dstX: cint; dstY: cint; srcX: cint; srcY: cint; dstW: cint; dstH: cint; srcW: cint; srcH: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCopyResized@40'{$ENDIF};
|
||||||
|
|
||||||
|
(* gd 2.0: stretches or shrinks to fit, as needed. When called with a
|
||||||
|
truecolor destination image, this function averages the
|
||||||
|
entire set of source pixels that scale down onto the
|
||||||
|
destination pixel, taking into account what portion of the
|
||||||
|
destination pixel each source pixel represents. This is a
|
||||||
|
floating point operation, but this is not a performance issue
|
||||||
|
on modern hardware, except for some embedded devices. If the
|
||||||
|
destination is a palette image, gdImageCopyResized is
|
||||||
|
substituted automatically. *)
|
||||||
|
procedure gdImageCopyResampled(dst: gdImagePtr; src: gdImagePtr; dstX: cint; dstY: cint; srcX: cint; srcY: cint; dstW: cint; dstH: cint; srcW: cint; srcH: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCopyResampled@40'{$ENDIF};
|
||||||
|
|
||||||
|
(* gd 2.0.8: gdImageCopyRotated is added. Source
|
||||||
|
is a rectangle, with its upper left corner at
|
||||||
|
srcX and srcY. Destination is the *center* of
|
||||||
|
the rotated copy. Angle is in degrees, same as
|
||||||
|
gdImageArc. Floating point destination center
|
||||||
|
coordinates allow accurate rotation of
|
||||||
|
objects of odd-numbered width or height. *)
|
||||||
|
procedure gdImageCopyRotated(dst: gdImagePtr; src: gdImagePtr; dstX: double; dstY: double; srcX: cint; srcY: cint; srcWidth: cint; srcHeight: cint; angle: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCopyRotated@36'{$ENDIF};
|
||||||
|
|
||||||
|
procedure gdImageSetBrush(im: gdImagePtr; brush: gdImagePtr); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageSetBrush@8'{$ENDIF};
|
||||||
|
procedure gdImageSetTile(im: gdImagePtr; tile: gdImagePtr); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageSetTile@8'{$ENDIF};
|
||||||
|
procedure gdImageSetAntiAliased(im: gdImagePtr; c: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageSetAntiAliased@8'{$ENDIF};
|
||||||
|
procedure gdImageSetAntiAliasedDontBlend(im: gdImagePtr; c: cint; dont_blend: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageSetAntiAliasedDontBlend@12'{$ENDIF};
|
||||||
|
procedure gdImageSetStyle(im: gdImagePtr; style: pcint; noOfPixels: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageSetStyle@12'{$ENDIF};
|
||||||
|
(* Line thickness(defaults to 1). Affects lines, ellipses,
|
||||||
|
rectangles, polygons and so forth. *)
|
||||||
|
procedure gdImageSetThickness(im: gdImagePtr; thickness: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageSetThickness@8'{$ENDIF};
|
||||||
|
(* On or off(1 or 0) for all three of these. *)
|
||||||
|
procedure gdImageInterlace(im: gdImagePtr; interlaceArg: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageInterlace@8'{$ENDIF};
|
||||||
|
procedure gdImageAlphaBlending(im: gdImagePtr; alphaBlendingArg: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageAlphaBlending@8'{$ENDIF};
|
||||||
|
procedure gdImageSaveAlpha(im: gdImagePtr; saveAlphaArg: cint); GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageSaveAlpha@8'{$ENDIF};
|
||||||
|
|
||||||
|
(* Macros to access information about images. *)
|
||||||
|
|
||||||
|
(* Returns nonzero if the image is a truecolor image,
|
||||||
|
zero for a palette image. *)
|
||||||
|
|
||||||
|
function gdImageTrueColor(im: gdImagePtr): cint; inline;
|
||||||
|
function gdImageSX(im: gdImagePtr): cint; inline;
|
||||||
|
function gdImageSY(im: gdImagePtr): cint; inline;
|
||||||
|
function gdImageColorsTotal(im: gdImagePtr): cint; inline;
|
||||||
|
function gdImageRed(im: gdImagePtr; c: cint): cint; inline;
|
||||||
|
function gdImageGreen(im: gdImagePtr; c: cint): cint; inline;
|
||||||
|
function gdImageBlue(im: gdImagePtr; c: cint): cint; inline;
|
||||||
|
function gdImageAlpha(im: gdImagePtr; c: cint): cint; inline;
|
||||||
|
function gdImageGetTransparent(im: gdImagePtr): cint; inline;
|
||||||
|
function gdImageGetInterlaced(im: gdImagePtr): cint; inline;
|
||||||
|
|
||||||
|
(* These macros provide direct access to pixels in
|
||||||
|
palette-based and truecolor images, respectively.
|
||||||
|
If you use these macros, you must perform your own
|
||||||
|
bounds checking. Use of the macro for the correct type
|
||||||
|
of image is also your responsibility. *)
|
||||||
|
function gdImagePalettePixel(im: gdImagePtr; x, y: cint): cint; inline;
|
||||||
|
function gdImageTrueColorPixel(im: gdImagePtr; x, y: cint): cint; inline;
|
||||||
|
|
||||||
|
(* I/O Support routines. *)
|
||||||
|
|
||||||
|
function gdNewFileCtx(p: PFILE): gdIOCtxPtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdNewFileCtx@4'{$ENDIF};
|
||||||
|
(* If data is null, size is ignored and an initial data buffer is
|
||||||
|
allocated automatically. NOTE: this function assumes gd has the right
|
||||||
|
to free or reallocate "data" at will! Also note that gd will free
|
||||||
|
"data" when the IO context is freed. If data is not null, it must point
|
||||||
|
to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr.
|
||||||
|
If not, see gdNewDynamicCtxEx for an alternative. *)
|
||||||
|
function gdNewDynamicCtx(size: cint; data: pointer): gdIOCtxPtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdNewDynamicCtx@8'{$ENDIF};
|
||||||
|
(* 2.0.21: if freeFlag is nonzero, gd will free and/or reallocate "data" as
|
||||||
|
needed as described above. If freeFlag is zero, gd will never free
|
||||||
|
or reallocate "data," which means that the context should only be used
|
||||||
|
for *reading* an image from a memory buffer, or writing an image to a
|
||||||
|
memory buffer which is already large enough. If the memory buffer is
|
||||||
|
not large enough and an image write is attempted, the write operation
|
||||||
|
will fail. Those wishing to write an image to a buffer in memory have
|
||||||
|
a much simpler alternative in the gdImage[something]Ptr functions. *)
|
||||||
|
function gdNewDynamicCtxEx(size: cint; data: pointer; freeFlag: cint): gdIOCtxPtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdNewDynamicCtxEx@12'{$ENDIF};
|
||||||
|
function gdNewSSCtx(_in: gdSourcePtr; _out: gdSinkPtr): gdIOCtxPtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdNewSSCtx@8'{$ENDIF};
|
||||||
|
function gdDPExtractData(ctx: gdIOCtxPtr; size: pcint): pointer; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdDPExtractData@8'{$ENDIF};
|
||||||
|
|
||||||
|
const
|
||||||
|
GD2_CHUNKSIZE = 128;
|
||||||
|
GD2_CHUNKSIZE_MIN = 64;
|
||||||
|
GD2_CHUNKSIZE_MAX = 4096;
|
||||||
|
|
||||||
|
GD2_VERS = 2;
|
||||||
|
GD2_ID = 'gd2';
|
||||||
|
|
||||||
|
GD2_FMT_RAW = 1;
|
||||||
|
GD2_FMT_COMPRESSED = 2;
|
||||||
|
|
||||||
|
(* Image comparison definitions *)
|
||||||
|
function gdImageCompare(im1: gdImagePtr; im2: gdImagePtr): cint; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdImageCompare@8'{$ENDIF};
|
||||||
|
|
||||||
|
const
|
||||||
|
GD_CMP_IMAGE = 1; (* Actual image IS different *)
|
||||||
|
GD_CMP_NUM_COLORS = 2; (* Number of Colours in pallette differ *)
|
||||||
|
GD_CMP_COLOR = 4; (* Image colours differ *)
|
||||||
|
GD_CMP_SIZE_X = 8; (* Image width differs *)
|
||||||
|
GD_CMP_SIZE_Y = 16; (* Image heights differ *)
|
||||||
|
GD_CMP_TRANSPARENT = 32; (* Transparent colour *)
|
||||||
|
GD_CMP_BACKGROUND = 64; (* Background colour *)
|
||||||
|
GD_CMP_INTERLACE = 128; (* Interlaced setting *)
|
||||||
|
GD_CMP_TRUECOLOR = 256; (* Truecolor vs palette differs *)
|
||||||
|
|
||||||
|
(* resolution affects ttf font rendering, particularly hinting *)
|
||||||
|
GD_RESOLUTION = 96; (* pixels per inch *)
|
||||||
|
|
||||||
|
(* newfangled special effects *)
|
||||||
|
//#include "gdfx.h"
|
||||||
|
|
||||||
|
function gdGetFontLarge(): gdFontPtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdGetFontLarge@0'{$ENDIF};
|
||||||
|
function gdGetFontSmall(): gdFontPtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdGetFontSmall@0'{$ENDIF};
|
||||||
|
function gdGetFontGiant(): gdFontPtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdGetFontGiant@0'{$ENDIF};
|
||||||
|
function gdGetFontMediumBold(): gdFontPtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdGetFontMediumBold@0'{$ENDIF};
|
||||||
|
function gdGetFontTiny(): gdFontPtr; GDCALL; BGD_DECLARE {$IFDEF WINDOWS}name '_gdGetFontTiny@0'{$ENDIF};
|
||||||
|
|
||||||
|
{$ifdef windows}
|
||||||
|
function gdFontLarge(): gdFontPtr; inline;
|
||||||
|
function gdFontSmall(): gdFontPtr; inline;
|
||||||
|
function gdFontGiant(): gdFontPtr; inline;
|
||||||
|
function gdFontMediumBold(): gdFontPtr; inline;
|
||||||
|
function gdFontTiny(): gdFontPtr; inline;
|
||||||
|
{$else}
|
||||||
|
var
|
||||||
|
{$ifndef darwin}
|
||||||
|
gdFontLarge : gdFontPtr; cvar; BGD_DECLARE;
|
||||||
|
gdFontSmall : gdFontPtr; cvar; BGD_DECLARE;
|
||||||
|
gdFontGiant : gdFontPtr; cvar; BGD_DECLARE;
|
||||||
|
gdFontMediumBold : gdFontPtr; cvar; BGD_DECLARE;
|
||||||
|
gdFontTiny : gdFontPtr; cvar; BGD_DECLARE;
|
||||||
|
{$else darwin}
|
||||||
|
gdFontLarge : gdFontPtr; BGD_DECLARE name 'gdFontLarge';
|
||||||
|
gdFontSmall : gdFontPtr; BGD_DECLARE name 'gdFontSmall';
|
||||||
|
gdFontGiant : gdFontPtr; BGD_DECLARE name 'gdFontGiant';
|
||||||
|
gdFontMediumBold : gdFontPtr; BGD_DECLARE name 'gdFontMediumBold';
|
||||||
|
gdFontTiny : gdFontPtr; BGD_DECLARE name 'gdFontTiny';
|
||||||
|
{$endif darwin}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
|
||||||
|
{overloaded pascal functions}
|
||||||
|
function fopen(filename, rights: String): PFile;
|
||||||
|
procedure gdImageChar(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; c: char; color: cint);
|
||||||
|
procedure gdImageCharUp(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; c: char; color: cint);
|
||||||
|
procedure gdImageString(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: AnsiString; color: cint);
|
||||||
|
procedure gdImageStringUp(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: AnsiString; color: cint);
|
||||||
|
procedure gdImageString16(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: WideString; color: cint);
|
||||||
|
procedure gdImageStringUp16(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: WideString; color: cint);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$ifdef windows}
|
||||||
|
function gdFontLarge(): gdFontPtr; inline;
|
||||||
|
begin
|
||||||
|
Result := gdFontGetLarge();
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdFontSmall(): gdFontPtr; inline;
|
||||||
|
begin
|
||||||
|
Result := gdFontGetSmall();
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdFontGiant(): gdFontPtr; inline;
|
||||||
|
begin
|
||||||
|
Result := gdFontGetGiant();
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdFontMediumBold(): gdFontPtr; inline;
|
||||||
|
begin
|
||||||
|
Result := gdFontGetMediumBold();
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdFontTiny(): gdFontPtr; inline;
|
||||||
|
begin
|
||||||
|
Result := gdFontGetTiny();
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
function gdTrueColorGetAlpha(c: cint): cint;
|
||||||
|
begin
|
||||||
|
Result :=(c and $7F000000) shr 24;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdTrueColorGetRed(c: cint): cint;
|
||||||
|
begin
|
||||||
|
Result :=(c and $FF0000) shr 16;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdTrueColorGetGreen(c: cint): cint;
|
||||||
|
begin
|
||||||
|
Result :=(c and $00FF00) shr 8;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdTrueColorGetBlue(c: cint): cint;
|
||||||
|
begin
|
||||||
|
Result := c and $0000FF;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageCreatePalette(sx: cint; sy: cint): gdImagePtr;
|
||||||
|
begin
|
||||||
|
Result := gdImageCreate(sx, sy);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdTrueColor(r: cint; g: cint; b: cint): cint;
|
||||||
|
begin
|
||||||
|
result := (r shl 16) or (g shl 8) or (b);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdTrueColorAlpha(r: cint; g: cint; b: cint; a: cint): cint;
|
||||||
|
begin
|
||||||
|
result := (a shl 24) or (r shl 16) or (g shl 8) or (b);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageTrueColor(im: gdImagePtr): cint;
|
||||||
|
begin
|
||||||
|
Result := im^.trueColor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageSX(im: gdImagePtr): cint;
|
||||||
|
begin
|
||||||
|
Result := im^.sx;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageSY(im: gdImagePtr): cint;
|
||||||
|
begin
|
||||||
|
Result := im^.sy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageColorsTotal(im: gdImagePtr): cint;
|
||||||
|
begin
|
||||||
|
Result := im^.colorsTotal;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageRed(im: gdImagePtr; c: cint): cint;
|
||||||
|
begin
|
||||||
|
if im^.trueColor <> 0 then
|
||||||
|
Result := gdTrueColorGetRed(c)
|
||||||
|
else
|
||||||
|
Result := im^.red[c];
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageGreen(im: gdImagePtr; c: cint): cint;
|
||||||
|
begin
|
||||||
|
if im^.trueColor <> 0 then
|
||||||
|
Result := gdTrueColorGetGreen(c)
|
||||||
|
else
|
||||||
|
Result := im^.green[c];
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageBlue(im: gdImagePtr; c: cint): cint;
|
||||||
|
begin
|
||||||
|
if im^.trueColor <> 0 then
|
||||||
|
Result := gdTrueColorGetBlue(c)
|
||||||
|
else
|
||||||
|
Result := im^.blue[c];
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageAlpha(im: gdImagePtr; c: cint): cint;
|
||||||
|
begin
|
||||||
|
if im^.trueColor <> 0 then
|
||||||
|
Result := gdTrueColorGetAlpha(c)
|
||||||
|
else
|
||||||
|
Result := im^.alpha[c];
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageGetTransparent(im: gdImagePtr): cint;
|
||||||
|
begin
|
||||||
|
Result := im^.transparent;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageGetInterlaced(im: gdImagePtr): cint;
|
||||||
|
begin
|
||||||
|
Result := im^.interlace;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImagePalettePixel(im: gdImagePtr; x, y: cint): cint;
|
||||||
|
begin
|
||||||
|
Result := im^.pixels[y][x];
|
||||||
|
end;
|
||||||
|
|
||||||
|
function gdImageTrueColorPixel(im: gdImagePtr; x, y: cint): cint;
|
||||||
|
begin
|
||||||
|
Result := im^.tpixels[y][x];
|
||||||
|
end;
|
||||||
|
|
||||||
|
function fopen(filename, rights: String): PFile;
|
||||||
|
begin
|
||||||
|
Result := fopen(PChar(filename), PChar(rights));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure gdImageChar(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; c: char; color: cint);
|
||||||
|
begin
|
||||||
|
gdImageChar(im,f,x,y,ord(c),color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure gdImageCharUp(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; c: char; color: cint);
|
||||||
|
begin
|
||||||
|
gdImageCharUp(im,f,x,y,ord(c),color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure gdImageString(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: AnsiString; color: cint);
|
||||||
|
begin
|
||||||
|
gdImageString(im,f,x,y,PAnsiChar(s),color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure gdImageStringUp(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: AnsiString; color: cint);
|
||||||
|
begin
|
||||||
|
gdImageStringUp(im,f,x,y,PAnsiChar(s),color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure gdImageString16(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: WideString; color: cint);
|
||||||
|
begin
|
||||||
|
gdImageString16(im,f,x,y,PWideChar(s),color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure gdImageStringUp16(im: gdImagePtr; f: gdFontPtr; x: cint; y: cint; s: WideString; color: cint);
|
||||||
|
begin
|
||||||
|
gdImageStringUp16(im,f,x,y,PWideChar(s),color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user