编辑器

上传
This commit is contained in:
JianjunLiu
2022-04-20 14:33:56 +08:00
commit eb601195fe
286 changed files with 93144 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+187
View File
@@ -0,0 +1,187 @@
unit UTslVclFackInterface;
interface
{**
@nickname(底层伪接口) %%
@explan(说明)
该文件提供底层接口的说明无具体实现
该单元中的类型和函数可以直接使用 %%
**}
function getsenderdatabyid();
function gettslvariableptr(obj);
function getctypesize();
function getwinprocptr(f);
type aefclassobj_ = class
{**
@nickname(内存管理对象) %%
@explan(说明)内存操作底层接口伪类 %%
**}
function tmalloc(sz);
begin
{**
@explan(说明)内存分配 %%
@param(sz)(integer)大小 %%
@return(pointer)分配的内存的句柄 %%
**}
end
function trealloc(p,sz);
begin
{**
@explan(说明)重新内存分配 %%
@param(sz)(integer)大小 %%
@param(p)(pointer)内存地址 %%
@return(pointer)新的内存地址 %%
**}
end
function tfree(p);
begin
{**
@explan(说明) 释放内存 %%
@param(p)(pointer)内存地址 %%
**}
end
function tmcopy();
begin
end
function tmset(p,sz);
begin
{**
@explan(说明) 初始化内存 %%
@param(sz)(integer)大小 %%
@param(p)(pointer)内存地址 %%
**}
end
function readbyte(p);
begin
{**
@explan(说明) 读取一个byte %%
@param(p)(pointer)内存地址 %%
**}
end
function writebyte(p,v);
begin
{**
@explan(说明) 写入一个beyte %%
@param(p)(pointer)内存地址 %%
@param(v)(integer)值 %%
**}
end
function readint();
begin
{**
@explan(说明) 读取一个byte %%
@param(p)(pointer)内存地址 %%
**}
end
function writeint(p,v);
begin
end
function writedouble(p,v);
begin
{**
@explan(说明) 读取一个double %%
@param(p)(pointer)内存地址 %%
**}
end
function readdouble(p);
begin
{**
@explan(说明) 读取一个double %%
@param(p)(pointer)内存地址 %%
**}
end
function writellong(p,v);
begin
{**
@explan(说明) 写入一个long%%
@param(p)(pointer)内存地址 %%
**}
end
function readlong(p);
begin
{**
@explan(说明) 读取一个long %%
@param(p)(pointer)内存地址 %%
**}
end
function writeshort(p,v);
begin
{**
@explan(说明) 写入一个short%%
@param(p)(pointer)内存地址 %%
**}
end
function readshort();
begin
{**
@explan(说明) 读取一个short %%
@param(p)(pointer)内存地址 %%
**}
end
function writebytes(p,sz,v);
begin
{**
@explan(说明) 写入一组short %%
@param(p)(pointer)内存地址 %%
**}
end
function readbytes(p,sz);
begin
{**
@explan(说明) 读取一组byte %%
@param(p)(pointer)内存地址 %%
@param(sz)(pointer)大小 %%
**}
end
function writeshorts(p,sz,v);
begin
{**
@explan(说明) 写入一组short %%
@param(p)(pointer)内存地址 %%
**}
end
function readshorts(p,sz);
begin
{**
@explan(说明) 读取一组short %%
@param(p)(pointer)内存地址 %%
@param(sz)(pointer)大小 %%
**}
end
end
Implementation
function gettslvariableptr(obj);
begin
{**
@explan(说明) 获取变量的地址,在send消息使用 %%
@param(obj)(obj) tsl变量 %%
@return(integer) 变量地址 %%
**}
end
function getwinprocptr(f);
begin
{**
@explan(说明) 获取winProc函数句柄 %%
@param(f)(integer|nil) 1表示DefWindowProcA ,0 表示timeproc nil表示twinproc %%
@return(integer) 消息函数句柄 %%
**}
end
function getctypesize();
begin
{**
@explan(说明) 获取类型占用内存大小 %%
@return(array) 以类型字符串为下标的数字数组,数字表示该类型的内存大小 %%
**}
end
function getsenderdatabyid();
begin
{**
@explan(说明) 获取变量的地址,在send消息使用 %%
@return(obj) tsl变量 %%
**}
end
end.
+748
View File
@@ -0,0 +1,748 @@
unit parserch ;
{**
@explan(说明)c头文件解析对外 接口 %%
**}
interface
function pcstruct(s,f);
function parserctokens(str);
function chtotslclass();
(*
//str := data();
//echo tostn(str22array(str)[:,3]);
//for := 0 to length(str) do
//return echo tostn(getgdihdata());
s := "
typedef struct _GdiplusStartupInput {
unsigned int GdiplusVersion;
unsigned int DebugEventCallback;
BOOL SuppressBackgroundThread;
BOOL SuppressExternalCodecs;
}GdiplusStartupInput;
";
return echo tostn(parsercstruct(parserctokens(s)));
rt := parsergdifunction(parserctokens(getgdihdata()));
echo tostn(rt);
*)
Implementation
function chtotslclass();
begin
parsergdifunction(parserctokens(getgdihdata()));
end
function pcstruct(s,f);
begin
{**
@explan(说明) 解析c结构体字符串到tsl结构化数据 %%
@param(s)(string) c结构体字符串 %%
@param(f)(bool) true 转换为小写 %%
@return(array) tag字段为名称
field 为字段信息
n : 名称
t : 类型 一个数组如果 array(unsigned,int)
l : 如果为数组 数组的长度
p : 如果为指针,指针的*个数
nick 别名
**}
return parsercstruct(parserctokens(f?lowercase(s):s));
end
function parsercstruct(tokens,indx);
begin
{**
@explan(说明)结构体解析 %%
**}
//名称
//别名,可能多个
//内容
len := length(tokens);
indx := indx ?: 0;
ret := array();
while indx<len do
begin
indx++;
v := tokens[indx,0];
if v="struct" then
begin
//indx++;
//ret["tag"] := tokens[indx,0];
ret["tag"]:= v;
end else
if v="{" then
begin
ret["field"]:= getstruct(tokens,indx,len);
ret["nick"]:= getstructnickename(tokens,indx,len);
return ret;
end else
if not(v in array(" ","\r","\n","\t"))then
begin
ret["tname"]:= v;
end
end
end
function getstructnickename(tokens,indx,len);
begin
{**
@explan(说明) 获取typedef 别名
**}
ret := array();
lret := 0;
while indx<len do
begin
indx++;
tkv := tokens[i,0];
if tkv=";" then
begin
return ret;
end else
if tkv="*" then
begin
end else
if tkv="," then
begin
end else
begin
ret[lret++]:= tkv;
end
end
return nil;
end
function getstruct(tokens,indx,len);
begin
{**
@explan(说明)获取struct字段定义
**}
ret := array();
//类型
//名称
//指针
//数组长度
lx := array();
lxlx := "";
mc := "";
ct := 0;
cd := "";
zz := 0;
while indx<len do
begin
indx++;
if tokens[indx,2]="//" or tokens[indx,2]="/*" then continue;
tkv := tokens[indx,0];
if tkv="}" then
begin
return ret;
end else
if tkv=";" then
begin
if not(mc)then mc := lxlx;
ret[ct++]:= array("n":mc,"t":lx,"l":cd,"p":zz);
lxlx := "";
mc := "";
cd := "";
zz := 0;
lx := array();
end else
if tkv="*" then
begin
zz++;
end else
if tkv="[" then
begin
while indx<len do
begin
indx++;
if tokens[indx,2]="//" or tokens[indx,2]="/*" then continue;
tkvi := tokens[indx,0];
if tkvi="]" then
begin
break;
end else
begin
cd += tkvi;
end
end
end else
begin
if lxlx then lx[length(lx)]:= lxlx;
lxlx := tkv;
end
end
end
function getgdihdata(rpth);
begin
{**
@explan(说明) 获取c头文件数据
**}
rpth := "E:\\360yun\\tinysoft\\tslAPI\\gdiplus\\gdiplusflat.h";
sz := filesize("",rpth);
if readFile(rwRaw(),"",rpth,0,sz,rdd)then return rdd;
return " ";
end
function str22array(str);
begin
{**
@ignore 忽略
**}
kg := array("\r","\t"," ");
hh := "\n";
kghh := kg union array(hh);
ret := array();
c := 0;
r := 0;
vs := "";
lret := 0;
stt := 0;
for i := 1 to length(str) do
begin
vi := str[i];
ifkg := vi in kg;
if(ifkg)and vs then
begin
ret[lret++]:= array(r,c,vs);
vs := "";
c++;
continue;
end else
if(vi=hh)then
begin
if vs then
begin
ret[lret++]:= array(r,c,vs);
vs := "";
end
if lret then r++;
c := 0;
end else
if not(vi in kghh)then
begin
vs += vi;
end
end
if vs then ret[lret++]:= array(r,c,vs);
//return ret;
rt := array();
for i,v in ret do
begin
rt[v[0],v[1]]:= v[2];
end
return rt;
end
function bdstring(str,len,f,fl,pos);
begin
{**
@explan(说明)字符串匹配查找
**}
bud := true;
for i := 1 to fl do
begin
vpos := pos+i-1;
if vpos>len then return 0;
if str[vpos]<> f[i]then
begin
bud := false;
break;
end
end
if bud then
begin
pos +=(fl-1);
end
return bud;
end
function findstringv(str,f,len,pos,zy,hl);
begin
{**
@explan(说明)查找以f结尾的字符串
**}
vs := "";
fl := length(f);
while pos<len do
begin
pos++;
vi := str[pos];
if vi=hl then continue;
if bdstring(str,len,f,fl,pos)then break;
if zy=vi then
begin
vs += str[pos];
pos++;
continue;
end
vs += vi;
end
return vs;
end;
function setvalue(dt,vs,indx,tp);
begin
{**
@explan(说明)保存token
**}
if vs then dt[length(dt)]:= array(vs,indx,tp);
vs := "";
end
function parserctokens(gdis);
begin
{**
@explan(说明)c分词 %%
**}
len := length(gdis);
indx := 0;
kg := array("\n","\t"," ");
vs := "";
ret := array();
while indx<len do
begin
indx++;
vi := gdis[indx];
if vi="\r" then continue;
if vi="\\" then
begin
setvalue(ret,vs,indx,"token");
vip := gdis[indx+1];
if vip="\r" then
begin
vip := gdis[indx+2];
if vip="\n" then
begin
setvalue(ret,"\\\r\n",indx,"link");
indx += 2;
end
end else
if vip="\n" then
begin
setvalue(ret,"\\\n",indx,"link");
indx += 1;
end
end else
if vi=">" then
begin
setvalue(ret,vs,indx,"token");
vip := gdis[indx+1];
if vip="=" then
begin
indx++;
setvalue(ret,">=",indx,"sym");
end else
setvalue(ret,">",indx,"sym");
end else
if vi="<" then
begin
setvalue(ret,vs,indx,"token");
vip := gdis[indx+1];
if vip="=" then
begin
indx++;
setvalue(ret,"<=",indx,"sym");
end else
setvalue(ret,"<",indx,"sym");
end else
if vi="=" then
begin
setvalue(ret,vs,indx,"token");
vip := gdis[indx+1];
if vip="=" then
begin
indx++;
setvalue(ret,"==",indx,"sym");
end else
setvalue(ret,"=",indx,"sym");
end else
if vi="[" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,"[",indx,"sym");
end else
if vi="]" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,"]",indx,"sym");
end else
if vi="&" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,"&",indx,"sym");
end else
if vi="*" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,"*",indx,"*");
end else
if vi="," then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,",",indx,",");
end else
if vi=";" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,";",indx,";");
end else
if vi="(" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,"(",indx,"(");
end else
if vi=")" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,")",indx,")");
end else
if vi="{" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,"{",indx,"sym");
end else
if vi="}" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,"}",indx,"sym");
end else
if vi="|" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,vi,indx,"sym");
end else
if vi="?" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,vi,indx,"sym");
end else
if vi=":" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,vi,indx,"sym");
end else
if vi="'" then
begin
setvalue(ret,vs,indx,"token");
vs := findstringv(gdis,"'",len,indx,"\\");
setvalue(ret,vs,indx,"'");
end else
if vi='"' then
begin
setvalue(ret,vs,indx,"token");
vs := findstringv(gdis,'"',len,indx,'\\');
setvalue(ret,vs,indx,'"');
end else
if vi="/" then
begin
setvalue(ret,vs,indx,"token");
vip := gdis[indx+1];
if vip="/" then
begin
indx += 1;
vs := findstringv(gdis,"\n",len,indx,nil,"\r");
setvalue(ret,vs,indx,"//");
end else
if vip="*" then
begin
indx += 1;
vs := findstringv(gdis,"*/",len,indx,nil);
setvalue(ret,vs,indx,"/*");
end else
begin
setvalue(ret,"/",indx,"/");
end
end else
if vi in kg then
begin
setvalue(ret,vs,indx,"token");
end else
if vi="\n" then
begin
setvalue(ret,vs,indx,"token");
setvalue(ret,"\n",indx,"\n");
end else
vs += vi;
end
setvalue(ret,vs,indx,"token");
return ret;
//writetofile("",ret);
//parsergdifunction(ret);
end
function nexttoken(tokens,indx,f);
begin
if not(f)then indx++;
return tokens[indx];
end
function backtoken(tokens,indx,f);
begin
if not(f)then indx--;
return tokens[indx];
end
function parsergdifunction(tokens);
begin
{**
@explan(说明) 提取头文件函数
**}
len := length(tokens)-1;
indx :=-1;
isyms := array("GDIPCONST","_In_","_Out_");
ret := array();
retl := 0;
hst := array();
s := "type TGdiplusflat=class\r\n";
s += "{**
@explan(说明)gdi+ 的c接口函数 %%
**}\r\n";
zs := "";
while indx<len do
begin
indx++;
tokent := tokens[indx,2];
tokenv := tokens[indx,0];
if tokenv in isyms then continue;
if tokent="/*" then
begin
//echo tostn(tokens[indx]);
zs += "(* "+tokenv+" *)\r\n";
end else
if tokent="//" then
begin
zs += "//"+tokenv+"\r\n";
end else
if tokenv="(" then
begin
cs := parenthesis(tokens,indx,len,1,isyms);
s += zs;
s += "\tclass ";
s += createhs(hst,cs)+"\r\n";
hst := array();
zs := "";
end else
begin
hst[length(hst)]:= tokens[indx];
end
end
s += "\r\nend ";
writetofile2(pp,s);
end
function createhs(hd,bd);
begin
{**
@explan(说明)构造函数声明
**}
//echo tostn(bd);
lex := array("INT":"integer",
"REAL":"single",
"float":"single",
"INT64":"int64",
"double":"double",
"int":"integer",
"UINT":"integer",
"void":1,
"VOID":1,
"ARGB":"integer",
"GpStatus":"integer",
"GpWrapMode":"integer",
"TextRenderingHint":"integer",
"SmoothingMode":"integer",
"GpFillMode":"integer",
"COLORREF":"integer",
"COLOR16":"short",
"WCHAR":"string",
);
ret := "Function ";
havlx := true;
ct := "stdcall";
tp := nil;
for i := 0 to length(hd)-1 do
begin
hdi0 := hd[i,0];
vi := hd[i,0];
lx := lex[vi];
if vi=";" then
begin
continue;
end
if vi="*" then
begin
tp := "pointer";
end else
if hdi0="WINGDIPAPI" then
begin
ct := "stdcall"; //
break;
end else
if hdi0="WINAPI" then
begin
ct := "stdcall";
break;
end else
if havlx and ifstring(lx)then
begin
havlx := false;
tp := lx;
end else
if havlx and lx=1 then
begin
havlx := false;
tp := 1;
end else
if havlx then
begin
havlx := false;
tp := "pointer";
end
end
fn := hd[length(hd)-1,0];
if tp=1 then
begin
ret := "procedure ";
tp := "";
end else
tp := ":"+tp;
fn := fn ?: "";
ret +=(fn ?: "")+"(";
ps := "";
dpn := "pn";
havlx := true;
ddpoint := 0;
for i := 0 to length(bd)-1 do
begin
vi := bd[i,0];
tvi := bd[i,2];
if vi="," then
begin
if not(pn)then pn := dpn+inttostr(i);
ps +=((ddpoint>1)?"var ":"")+gzhparam(pn);
ps += ":"+plx;
pn := 0;
ps += ";";
plx := 0;
havlx := true;
ddpoint := 0;
end else
if plx and(tvi="token")then
begin
pn := vi;
end else
if vi="*" then
begin
ddpoint++;
if plx in array("integer","single","hbitmap")then
begin
ddpoint++;
end else
if plx="string" then
begin
end else
plx := "pointer";
end else
if havlx and lex[vi]then
begin
havlx := false;
plx := lex[vi];
end else
if havlx then
begin
havlx := false;
plx := "pointer";
end else
if vi="[" {or vi = "]"}or vi="&" then
begin
plx := "pointer";
end
end
if plx then
begin
if not(pn)then pn := dpn+inttostr(i);
ps +=((ddpoint>1)?"var ":"")+gzhparam(pn)+":"+plx;
end
ret += ps;
//echo tostn(array(tp,ct,fn));
ret += format(')%s;%s;external "gdiplus.dll" name "%s";',tp,ct,fn);
//echo tostn(ret),"\r\n";
return ret;
end
function gzhparam(p);
begin
{**
@explan(说明) 特殊参数名替换
**}
if p="order" then return "order_";
else if p="unit" then return "unit_";
else if p="on" then return "on_";
return p;
end
function parenthesis(tokens,pos,len,iffunc,isyms);
begin
{**
@explan(说明) 函数参数解析
**}
ret := array();
retl := 0;
tkv := "";
while pos<len do
begin
pos++;
tk := tokens[pos];
tkt := tk[2];
if tk[0]in isyms then continue;
if tkt=")" then
begin
//跳出
//pos++;
return ret;
end else
begin
if iffunc and tkt="(" then
begin
if ret[retl-1][2]="token" then
begin
retl--;
reindex(ret,array(retl:nil));
end
parenthesis(tokens,pos,len,0,isyms);
end else
if iffunc then
begin
ret[retl++]:= tk;
end
tkv := tk[0];
end
end
end
function writetofile(pp,dt);
begin
{**
@explan(说明)保存分词结果到文件
**}
pp := "E:\\360yun\\tinysoft\\tslAPI\\gdiplus\\gdiplusflat.txt";
s := tostn(dt);
if FileExists("",pp)then
begin
filedelete("",pp);
end
writefile(rwRaw(),"",pp,0,length(s),s);
end
function writetofile2(pp,s);
begin
{**
@explan(说明)保存gdi函数到文件
**}
pp := "E:\\GitHub\\tsluilib\\tsluifunc\\TGdiplusflat.tsf";
if FileExists("",pp)then
begin
filedelete("",pp);
end
writefile(rwRaw(),"",pp,0,length(s),s);
end
function gdiplusfname();
begin
{**
explan(说明)读取gdi函数名
**}
rpth := "E:\\360yun\\tinysoft\\tslAPI\\gdiplus\\gdiplus.def";
sz := filesize("",rpth);
if readFile(rwRaw(),"",rpth,0,sz,rdd)then
begin
str22array(rdd);
end
return " ";
end
end.
+8
View File
@@ -0,0 +1,8 @@
# tsl界面库帮助
## 文件说明
- tslvcl.tsf是界面库接口
- cstructurelib.tsf 库中包含内存管理接口
- Lpseudointerface.tsl 为底层伪接口
- tgdiplusflat.tsf 为gdiplusflat.h导出函数,以后可能移动到其他库下
- parserch.tsf 为c头文件解析相关函数,不需要使用
+5
View File
@@ -0,0 +1,5 @@
tslvcl
cstructurelib
lpseudointerface
gdiplusflat
parserch
+995
View File
@@ -0,0 +1,995 @@
type TGdiplusflat=class
{**
@explan(说明)gdi+ 的c接口函数 %%
**}
(* *************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusFlat.h
*
* Abstract:
*
* Private GDI+ header file.
*
************************************************************************* *)
//----------------------------------------------------------------------------
// GraphicsPath APIs
//----------------------------------------------------------------------------
{$ifdef linux}
//20210827 需要添加gdi功能
type TTempFile = class
function Create();
begin
bp := "/tmp/tinysoft/tslvcl/";
if not _mtool then _mtool := new aefclassobj_();
Fptr := _mtool.tmalloc(8);
FPath := bp+inttostr(systhreadid())+"_"+inttostr(Fptr);
end
function GetData(buf,f);
begin
if not ifstring(f) then f := FPath;
if fileexists("", f) then
begin
sz := filesize("",f);
return readfile(rwraw(),"",f,0,sz,buf);
end
end
function writedata(buf,f);
begin
if not ifstring(buf) then return 0;
if not ifstring(f) then f := FPath;
if fileexists("",f) then filedelete("",f);
unit(tslvcl).CreateDirWithFileName(f);
return 1=writefile(rwraw(),"",f,0,length(buf),buf);
end
function Destroy();
begin
filedelete("",FPath);
_mtool.tfree(Fptr);
end
property path read FPath ;
private
FPath;
Fptr;
static _mtool;
end
class procedure cairo_pattern_destroy(p:pointer);cdecl;external 'libgtk-3.so';
class function cairo_image_surface_create_from_png(f:string):pointer;cdecl;external 'libgtk-3.so';
class function cairo_pattern_create_for_surface(f:pointer):pointer;cdecl;external 'libgtk-3.so';
class function cairo_image_surface_get_width(sf:pointer):integer;cdecl;external 'libgtk-3.so';
class function cairo_image_surface_get_height(sf:pointer):integer;cdecl;external 'libgtk-3.so';
class function gdk_pixbuf_new_from_file(f:string;er:pointer):pointer;cdecl;external 'libgtk-3.so';
class function gdk_pixbuf_save(pixbuf:pointer;p:string;tp:string;gerr:string;p1:string; p2:string;p3:string;p4:string;p5:string):integer;cdecl;external 'libgtk-3.so';
class procedure gdk_pixbuf_unref(pixbuf);cdecl;external 'libgtk-3.so';
class procedure gdk_pixbuf_ref(pixbuf);cdecl;external 'libgtk-3.so';
class function g_object_ref(g:pointer):pointer;cdecl;external 'libgtk-3.so';
class procedure g_object_unref(g:pointer);cdecl;external 'libgtk-3.so';
class function GdipSaveImageToStream(image:pointer;var imgestr:string); //无用到
class function GdipLoadImageFromFile(filename:string;var image:pointer); //无用到
begin
r := gdk_pixbuf_new_from_file(filename,0);
if r<>0 then
begin
image := r;
r := 1;
end
return r;
end
class function GdiplusStartup(); //启动gdi+
class function GdipDisposeImage(img); //销毁image
begin
imageunref(img);
end
class function GdipSaveImageToFile(image:pointer;filename:string;clsidEncoder:pointer;encoderParams:pointer); //保存
begin
s := unit(cstructurelib).ReadStringFromPtr(clsidEncoder);
//"png","jpeg","bmp","gif","tiff"
case s of
"image/png":
begin
return gdk_pixbuf_save(image,filename,"png",nil,nil,nil,nil,nil,nil)
end
"image/jpeg":
begin
ps := array("quality":"100");
if ifarray(conf) and conf["quality"]>0 and conf["quality"]<=100 then ps["quality"] := inttostr(conf["quality"]);
return gdk_pixbuf_save(image,filename,"jpeg",nil,"quality",ps["quality"],nil,nil,nil);
end
"image/bmp":
begin
return gdk_pixbuf_save(image,filename,"bmp",nil,nil,nil,nil,nil,nil);
end
end
return 0;
end
class function GdipCreateHBITMAPFromBitmap(bitmap:pointer;var hbmReturn:pointer;background:integer); //bitmap to hbitmap
begin
hbmReturn := bitmap;
imageref(hbmReturn);
return 1;
end
class function GdipCreateBitmapFromHBITMAP(hbm:pointer;hpal:pointer;var bitmap:pointer); // hbitmap to bitmap
begin
bitmap := hbm;
imageref(bitmap);
return 1;
end
class function GdipCreateBitmapFromHICON(hicon:pointer;var bitmap:pointer); //bitmap to icon
begin
bitmap := hicon;
imageref(bitmap);
return 1;
end
class function GdipCreateHICONFromBitmap(bitmap:pointer;var hbmReturn:pointer); // icon to bitmap
begin
hbmReturn := bitmap;
imageref(hbmReturn);
return 1;
end
class function GdipGetbmpSurface(h);
begin
s := GetImageProperty(h,"surface");
if s then return s;
p := GetImageProperty(h,"file");
s := cairo_image_surface_create_from_png(p);
SetImageProperty(h,"surface",s);
return s ;
end
class function GdipGetbmppattern(h);
begin
r := GetImageProperty(h,"pattern");
if r then return r;
s := GdipGetbmpSurface(h);
r := cairo_pattern_create_for_surface(s);
SetImageProperty(h,"pattern",r);
return r;
end
class function imagetostring(h,vp,conf); //bitamp to str
begin
t := unit(cstructurelib).ReadStringFromPtr(vp._getptr_());
//"png","jpeg","bmp","gif","tiff"
case t of
"image/png":
begin
s := GetImageProperty(h,"pngdata");
if s and ifstring(s) then return s;
tf := new TTempFile();
p := GetImageProperty(h,"file");
tf.GetData(s,p);
SetImageProperty(h,"pngdata",s);
end
"image/jpeg":
begin
s := GetImageProperty(h,"jpegdata");
if s and ifstring(s) then return s;
tf := new TTempFile(p);
p := tf.path;
ps := array("quality":"100");
if ifarray(conf) and conf["quality"]>0 and conf["quality"]<=100 then ps["quality"] := inttostr(conf["quality"]);
if 1<> gdk_pixbuf_save(pixbuf,p,"jpeg",nil,"quality",ps["quality"],nil,nil,nil) then return 0;
tf.GetData(s);
SetImageProperty(h,"jpegdata",s);
end
"image/ico":
begin
s := GetImageProperty(h,"icodata");
if s and ifstring(s) then return s;
tf := new TTempFile(p);
p := tf.path;
ps := array("depth":"32","x_hot":"16","y_hot":"16");
if ifarray(conf) and conf["depth"]>0 and conf["depth"]<=512 then ps["depth"] := inttostr(conf["depth"]);
if ifarray(conf) and conf["x_hot"]>0 and conf["x_hot"]<=128 then ps["x_hot"] := inttostr(conf["x_hot"]);
if ifarray(conf) and conf["y_hot"]>0 and conf["y_hot"]<=128 then ps["y_hot"] := inttostr(conf["y_hot"]);
if 1<> gdk_pixbuf_save(pixbuf,p,"ico","depth",ps["depth"],"x_hot",ps["x_hot"],"y_hot",ps["y_hot"]) then return 0;
tf.GetData(s);
SetImageProperty(h,"icogdata",s);
end
"image/bmp":
begin
s := GetImageProperty(h,"bmpdata");
if s and ifstring(s) then return s;
tf := new TTempFile(p);
p := tf.path;
if 1<> gdk_pixbuf_save(pixbuf,p,"bmp",nil,nil,nil,nil,nil,nil) then return 0;
tf.GetData(s);
SetImageProperty(h,"bmpdata",s);
end
end
return s;
end
class function stringtoimage(b,hd); //string to bitmap
begin
tf := new TTempFile(p);
p := tf.path;
if 1<>writefile(rwraw(),"",p,0,length(b),b) then return 0;
hd := gdk_pixbuf_new_from_file(p,0);
if hd then r := 0;
else return -1;
np := unit(tslvcl).getmsgd_Crc32(p);
nnp := "/tmp/tinysoft/tslvcl/"+np[1]+"/"+np[2]+"/"+np+".png";
imageref(hd);
SetImageProperty(hd,"file",nnp);
unit(tslvcl).CreateDirWithFileName(nnp);
gdk_pixbuf_save(hd,nnp,"png",nil,nil,nil,nil,nil,nil);
return r;
end
private
class function SetImageProperty(img,p,pv); //保存属性
begin
global g_gtk_images_propertys;
if not ifarray(g_gtk_images_propertys) then g_gtk_images_propertys := array();
return g_gtk_images_propertys[inttostr(img),p] := pv;
end
class function GetImageProperty(img,p); //获得属性
begin
global g_gtk_images_propertys;
if not ifarray(g_gtk_images_propertys) then g_gtk_images_propertys := array();
return g_gtk_images_propertys[inttostr(img),p];
end
class function imageref(img); // 引用
begin
rf := GetImageProperty(img,"ref");
SetImageProperty(img,"ref",((rf>0)?(rf+1):(1)));
g_object_ref(img);
end
class function imageunref(img); //反引用
begin
rf := GetImageProperty(img,"ref");
if ifnil(rf) then return ;
if rf<=1 then
begin
return DeleteImages(img);
end
else SetImageProperty(img,"ref",rf-1);
end
class function DeleteImages(img); //删除
begin
global g_gtk_images_propertys;
if not ifarray(g_gtk_images_propertys) then return ;
id := inttostr(img);
idfile := g_gtk_images_propertys[id,"file"];
if not idfile then return ;
if fileexists("",idfile) then //删除文件
begin
filedelete("",idfile);
end
pt := GetImageProperty(img,"pattern");
if pt then
begin
cairo_pattern_destroy(pt); //移除pattern
end
sf := GetImageProperty(img,"surface");
if sf then
begin
//cairo_surface_destroy(sf); //移除surface
end
reindex(g_gtk_images_propertys,array(id:nil));
g_object_unref(img);
end
{$else}
//stream 处理
class function imagetostring(h,vp,conf);
begin
CreateStreamOnHGlobal(0,true,st);
r := GdipSaveImageToStream(h,st,vp._getptr_,0);
if r<>0 then exit;
GetHGlobalFromStream(st,memo);
len := GlobalSize(memo);
s := "";
lm := GlobalLock(memo);
setlength(s,len);
memcpy2(s,lm,len);
tuicloseistream(st);
return s;
end
class function stringtoimage(b,hd);
begin
len := length(b);
hm := GlobalAlloc(2,len+1);//分配内容
lm := GlobalLock(hm);//枷锁
if lm <> 0 then
begin
memcpy(lm,b,len);//内存拷贝
GlobalUnlock(hm);//解锁
end
CreateStreamOnHGlobal(hm,true,st);
r := GdipLoadImageFromStream(st,hd);
tuicloseistream(st);
return r;
end
class function CreateStreamOnHGlobal(hGlobal:pointer;fDeleteOnRelease:integer; var ppstm:pointer):pointer;stdcall;external "Ole32.dll" name "CreateStreamOnHGlobal";
class function GetHGlobalFromStream(pstm:pointer; var phglobal:pointer):pointer;stdcall;external "Ole32.dll" name "GetHGlobalFromStream";
class function GlobalLock(mem :pointer):pointer;stdcall;external "Kernel32.dll" name "GlobalLock";
class function GlobalUnlock(mem :pointer):integer;stdcall;external "Kernel32.dll" name "GlobalUnlock";
class function GlobalSize(menm:pointer):integer;stdcall;external "Kernel32.dll" name "GlobalSize";
class function memcpy(dst:pointer;src:string;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy";
class function memcpy2(var dst:string;src:pointer;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy";
class function tuicloseistream(sm:pointer):integer;cdecl;external "TSLUIL.dll" name "tuicloseistream";
class function GlobalAlloc(uFlags :integer;dwBytes:integer):pointer;stdcall;external "Kernel32.dll" name "GlobalAlloc";
class Function GdipCreatePath(brushMode:integer;var path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePath";
class Function GdipCreatePath2(pn2:pointer;pn5:pointer;pn7:integer;pn9:integer;var path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePath2";
class Function GdipCreatePath2I(pn2:pointer;pn5:pointer;pn7:integer;pn9:integer;var path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePath2I";
class Function GdipClonePath(path:pointer;var clonePath:pointer):integer;stdcall;external "gdiplus.dll" name "GdipClonePath";
class Function GdipDeletePath(path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeletePath";
class Function GdipResetPath(path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipResetPath";
class Function GdipGetPointCount(path:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPointCount";
class Function GdipGetPathTypes(path:pointer;types:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathTypes";
class Function GdipGetPathPoints(pn2:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathPoints";
class Function GdipGetPathPointsI(pn2:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathPointsI";
class Function GdipGetPathFillMode(path:pointer;var fillmode:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathFillMode";
class Function GdipSetPathFillMode(path:pointer;fillmode:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathFillMode";
class Function GdipGetPathData(path:pointer;pathData:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathData";
class Function GdipStartPathFigure(path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipStartPathFigure";
class Function GdipClosePathFigure(path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipClosePathFigure";
class Function GdipClosePathFigures(path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipClosePathFigures";
class Function GdipSetPathMarker(path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathMarker";
class Function GdipClearPathMarkers(path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipClearPathMarkers";
class Function GdipReversePath(path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipReversePath";
class Function GdipGetPathLastPoint(path:pointer;lastPoint:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathLastPoint";
class Function GdipAddPathLine(path:pointer;x1:single;y1:single;x2:single;y2:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathLine";
class Function GdipAddPathLine2(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathLine2";
class Function GdipAddPathArc(path:pointer;x:single;y:single;width:single;height:single;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathArc";
class Function GdipAddPathBezier(path:pointer;x1:single;y1:single;x2:single;y2:single;x3:single;y3:single;x4:single;y4:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathBezier";
class Function GdipAddPathBeziers(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathBeziers";
class Function GdipAddPathCurve(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathCurve";
class Function GdipAddPathCurve2(path:pointer;points:pointer;count:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathCurve2";
class Function GdipAddPathCurve3(path:pointer;points:pointer;count:integer;offset:integer;numberOfSegments:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathCurve3";
class Function GdipAddPathClosedCurve(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathClosedCurve";
class Function GdipAddPathClosedCurve2(path:pointer;points:pointer;count:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathClosedCurve2";
class Function GdipAddPathRectangle(path:pointer;x:single;y:single;width:single;height:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathRectangle";
class Function GdipAddPathRectangles(path:pointer;rects:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathRectangles";
class Function GdipAddPathEllipse(path:pointer;x:single;y:single;width:single;height:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathEllipse";
class Function GdipAddPathPie(path:pointer;x:single;y:single;width:single;height:single;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathPie";
class Function GdipAddPathPolygon(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathPolygon";
class Function GdipAddPathPath(path:pointer;addingPath:pointer;connect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathPath";
class Function GdipAddPathString(path:pointer;string:string;length:integer;family:pointer;style:integer;emSize:single;layoutRect:pointer;format:pointer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathString";
class Function GdipAddPathStringI(path:pointer;string:string;length:integer;family:pointer;style:integer;emSize:single;layoutRect:pointer;format:pointer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathStringI";
class Function GdipAddPathLineI(path:pointer;x1:integer;y1:integer;x2:integer;y2:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathLineI";
class Function GdipAddPathLine2I(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathLine2I";
class Function GdipAddPathArcI(path:pointer;x:integer;y:integer;width:integer;height:integer;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathArcI";
class Function GdipAddPathBezierI(path:pointer;x1:integer;y1:integer;x2:integer;y2:integer;x3:integer;y3:integer;x4:integer;y4:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathBezierI";
class Function GdipAddPathBeziersI(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathBeziersI";
class Function GdipAddPathCurveI(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathCurveI";
class Function GdipAddPathCurve2I(path:pointer;points:pointer;count:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathCurve2I";
class Function GdipAddPathCurve3I(path:pointer;points:pointer;count:integer;offset:integer;numberOfSegments:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathCurve3I";
class Function GdipAddPathClosedCurveI(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathClosedCurveI";
class Function GdipAddPathClosedCurve2I(path:pointer;points:pointer;count:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathClosedCurve2I";
class Function GdipAddPathRectangleI(path:pointer;x:integer;y:integer;width:integer;height:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathRectangleI";
class Function GdipAddPathRectanglesI(path:pointer;rects:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathRectanglesI";
class Function GdipAddPathEllipseI(path:pointer;x:integer;y:integer;width:integer;height:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathEllipseI";
class Function GdipAddPathPieI(path:pointer;x:integer;y:integer;width:integer;height:integer;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipAddPathPieI";
class Function GdipAddPathPolygonI(path:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipAddPathPolygonI";
class Function GdipFlattenPath(path:pointer;matrix:pointer;flatness:single):integer;stdcall;external "gdiplus.dll" name "GdipFlattenPath";
class Function GdipWindingModeOutline(path:pointer;matrix:pointer;flatness:single):integer;stdcall;external "gdiplus.dll" name "GdipWindingModeOutline";
class Function GdipWidenPath(nativePath:pointer;pen:pointer;matrix:pointer;flatness:single):integer;stdcall;external "gdiplus.dll" name "GdipWidenPath";
class Function GdipWarpPath(path:pointer;matrix:pointer;points:pointer;count:integer;srcx:single;srcy:single;srcwidth:single;srcheight:single;warpMode:pointer;flatness:single):integer;stdcall;external "gdiplus.dll" name "GdipWarpPath";
class Function GdipTransformPath(path:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipTransformPath";
class Function GdipGetPathWorldBounds(path:pointer;bounds:pointer;matrix:pointer;pen:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathWorldBounds";
class Function GdipGetPathWorldBoundsI(path:pointer;bounds:pointer;matrix:pointer;pen:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathWorldBoundsI";
class Function GdipIsVisiblePathPoint(path:pointer;x:single;y:single;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisiblePathPoint";
class Function GdipIsVisiblePathPointI(path:pointer;x:integer;y:integer;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisiblePathPointI";
class Function GdipIsOutlineVisiblePathPoint(path:pointer;x:single;y:single;pen:pointer;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsOutlineVisiblePathPoint";
class Function GdipIsOutlineVisiblePathPointI(path:pointer;x:integer;y:integer;pen:pointer;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsOutlineVisiblePathPointI";
//----------------------------------------------------------------------------
// PathIterator APIs
//----------------------------------------------------------------------------
class Function GdipCreatePathIter(var iterator:pointer;path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePathIter";
class Function GdipDeletePathIter(iterator:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeletePathIter";
class Function GdipPathIterNextSubpath(iterator:pointer;var resultCount:integer;var startIndex:integer;var endIndex:integer;isClosed:pointer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterNextSubpath";
class Function GdipPathIterNextSubpathPath(iterator:pointer;var resultCount:integer;path:pointer;isClosed:pointer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterNextSubpathPath";
class Function GdipPathIterNextPathType(iterator:pointer;var resultCount:integer;pathType:pointer;var startIndex:integer;var endIndex:integer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterNextPathType";
class Function GdipPathIterNextMarker(iterator:pointer;var resultCount:integer;var startIndex:integer;var endIndex:integer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterNextMarker";
class Function GdipPathIterNextMarkerPath(iterator:pointer;var resultCount:integer;path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterNextMarkerPath";
class Function GdipPathIterGetCount(iterator:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterGetCount";
class Function GdipPathIterGetSubpathCount(iterator:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterGetSubpathCount";
class Function GdipPathIterIsValid(iterator:pointer;valid:pointer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterIsValid";
class Function GdipPathIterHasCurve(iterator:pointer;hasCurve:pointer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterHasCurve";
class Function GdipPathIterRewind(iterator:pointer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterRewind";
class Function GdipPathIterEnumerate(iterator:pointer;var resultCount:integer;points:pointer;types:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterEnumerate";
class Function GdipPathIterCopyData(iterator:pointer;var resultCount:integer;points:pointer;types:pointer;startIndex:integer;endIndex:integer):integer;stdcall;external "gdiplus.dll" name "GdipPathIterCopyData";
//----------------------------------------------------------------------------
// Matrix APIs
//----------------------------------------------------------------------------
class Function GdipCreateMatrix(var matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateMatrix";
class Function GdipCreateMatrix2(m11:single;m12:single;m21:single;m22:single;dx:single;dy:single;var matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateMatrix2";
class Function GdipCreateMatrix3(rect:pointer;dstplg:pointer;var matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateMatrix3";
class Function GdipCreateMatrix3I(rect:pointer;dstplg:pointer;var matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateMatrix3I";
class Function GdipCloneMatrix(matrix:pointer;var cloneMatrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneMatrix";
class Function GdipDeleteMatrix(matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeleteMatrix";
class Function GdipSetMatrixElements(matrix:pointer;m11:single;m12:single;m21:single;m22:single;dx:single;dy:single):integer;stdcall;external "gdiplus.dll" name "GdipSetMatrixElements";
class Function GdipMultiplyMatrix(matrix:pointer;matrix2:pointer;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipMultiplyMatrix";
class Function GdipTranslateMatrix(matrix:pointer;offsetX:single;offsetY:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipTranslateMatrix";
class Function GdipScaleMatrix(matrix:pointer;scaleX:single;scaleY:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipScaleMatrix";
class Function GdipRotateMatrix(matrix:pointer;angle:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRotateMatrix";
class Function GdipShearMatrix(matrix:pointer;shearX:single;shearY:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipShearMatrix";
class Function GdipInvertMatrix(matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipInvertMatrix";
class Function GdipTransformMatrixPoints(matrix:pointer;pts:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipTransformMatrixPoints";
class Function GdipTransformMatrixPointsI(matrix:pointer;pts:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipTransformMatrixPointsI";
class Function GdipVectorTransformMatrixPoints(matrix:pointer;pts:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipVectorTransformMatrixPoints";
class Function GdipVectorTransformMatrixPointsI(matrix:pointer;pts:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipVectorTransformMatrixPointsI";
class Function GdipGetMatrixElements(matrix:pointer;var matrixOut:single):integer;stdcall;external "gdiplus.dll" name "GdipGetMatrixElements";
class Function GdipIsMatrixInvertible(matrix:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsMatrixInvertible";
class Function GdipIsMatrixIdentity(matrix:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsMatrixIdentity";
class Function GdipIsMatrixEqual(matrix:pointer;matrix2:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsMatrixEqual";
//----------------------------------------------------------------------------
// Region APIs
//----------------------------------------------------------------------------
class Function GdipCreateRegion(var region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateRegion";
class Function GdipCreateRegionRect(rect:pointer;var region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateRegionRect";
class Function GdipCreateRegionRectI(rect:pointer;var region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateRegionRectI";
class Function GdipCreateRegionPath(path:pointer;var region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateRegionPath";
class Function GdipCreateRegionRgnData(regionData:pointer;size:integer;var region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateRegionRgnData";
class Function GdipCreateRegionHrgn(hRgn:pointer;var region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateRegionHrgn";
class Function GdipCloneRegion(region:pointer;var cloneRegion:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneRegion";
class Function GdipDeleteRegion(region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeleteRegion";
class Function GdipSetInfinite(region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetInfinite";
class Function GdipSetEmpty(region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetEmpty";
class Function GdipCombineRegionRect(region:pointer;rect:pointer;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCombineRegionRect";
class Function GdipCombineRegionRectI(region:pointer;rect:pointer;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCombineRegionRectI";
class Function GdipCombineRegionPath(region:pointer;path:pointer;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCombineRegionPath";
class Function GdipCombineRegionRegion(region:pointer;region2:pointer;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCombineRegionRegion";
class Function GdipTranslateRegion(region:pointer;dx:single;dy:single):integer;stdcall;external "gdiplus.dll" name "GdipTranslateRegion";
class Function GdipTranslateRegionI(region:pointer;dx:integer;dy:integer):integer;stdcall;external "gdiplus.dll" name "GdipTranslateRegionI";
class Function GdipTransformRegion(region:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipTransformRegion";
class Function GdipGetRegionBounds(region:pointer;graphics:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetRegionBounds";
class Function GdipGetRegionBoundsI(region:pointer;graphics:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetRegionBoundsI";
class Function GdipGetRegionHRgn(region:pointer;graphics:pointer;hRgn:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetRegionHRgn";
class Function GdipIsEmptyRegion(region:pointer;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsEmptyRegion";
class Function GdipIsInfiniteRegion(region:pointer;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsInfiniteRegion";
class Function GdipIsEqualRegion(region:pointer;region2:pointer;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsEqualRegion";
class Function GdipGetRegionDataSize(region:pointer;var bufferSize:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetRegionDataSize";
class Function GdipGetRegionData(region:pointer;buffer:pointer;bufferSize:integer;sizeFilled:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetRegionData";
class Function GdipIsVisibleRegionPoint(region:pointer;x:single;y:single;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisibleRegionPoint";
class Function GdipIsVisibleRegionPointI(region:pointer;x:integer;y:integer;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisibleRegionPointI";
class Function GdipIsVisibleRegionRect(region:pointer;x:single;y:single;width:single;height:single;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisibleRegionRect";
class Function GdipIsVisibleRegionRectI(region:pointer;x:integer;y:integer;width:integer;height:integer;graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisibleRegionRectI";
class Function GdipGetRegionScansCount(region:pointer;var count:integer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetRegionScansCount";
class Function GdipGetRegionScans(region:pointer;rects:pointer;var count:integer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetRegionScans";
class Function GdipGetRegionScansI(region:pointer;rects:pointer;var count:integer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetRegionScansI";
//----------------------------------------------------------------------------
// Brush APIs
//----------------------------------------------------------------------------
class Function GdipCloneBrush(brush:pointer;var cloneBrush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneBrush";
class Function GdipDeleteBrush(brush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeleteBrush";
class Function GdipGetBrushType(brush:pointer;type:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetBrushType";
//----------------------------------------------------------------------------
// HatchBrush APIs
//----------------------------------------------------------------------------
class Function GdipCreateHatchBrush(hatchstyle:pointer;forecol:integer;backcol:integer;var brush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateHatchBrush";
class Function GdipGetHatchStyle(brush:pointer;hatchstyle:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetHatchStyle";
class Function GdipGetHatchForegroundColor(brush:pointer;var forecol:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetHatchForegroundColor";
class Function GdipGetHatchBackgroundColor(brush:pointer;var backcol:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetHatchBackgroundColor";
//----------------------------------------------------------------------------
// TextureBrush APIs
//----------------------------------------------------------------------------
class Function GdipCreateTexture(image:pointer;wrapmode:integer;var texture:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateTexture";
class Function GdipCreateTexture2(image:pointer;wrapmode:integer;x:single;y:single;width:single;height:single;var texture:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateTexture2";
class Function GdipCreateTextureIA(image:pointer;imageAttributes:pointer;x:single;y:single;width:single;height:single;var texture:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateTextureIA";
class Function GdipCreateTexture2I(image:pointer;wrapmode:integer;x:integer;y:integer;width:integer;height:integer;var texture:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateTexture2I";
class Function GdipCreateTextureIAI(image:pointer;imageAttributes:pointer;x:integer;y:integer;width:integer;height:integer;var texture:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateTextureIAI";
class Function GdipGetTextureTransform(brush:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetTextureTransform";
class Function GdipSetTextureTransform(brush:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetTextureTransform";
class Function GdipResetTextureTransform(brush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipResetTextureTransform";
class Function GdipMultiplyTextureTransform(brush:pointer;matrix:pointer;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipMultiplyTextureTransform";
class Function GdipTranslateTextureTransform(brush:pointer;dx:single;dy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipTranslateTextureTransform";
class Function GdipScaleTextureTransform(brush:pointer;sx:single;sy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipScaleTextureTransform";
class Function GdipRotateTextureTransform(brush:pointer;angle:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRotateTextureTransform";
class Function GdipSetTextureWrapMode(brush:pointer;wrapmode:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetTextureWrapMode";
class Function GdipGetTextureWrapMode(brush:pointer;var wrapmode:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetTextureWrapMode";
class Function GdipGetTextureImage(brush:pointer;var image:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetTextureImage";
//----------------------------------------------------------------------------
// SolidBrush APIs
//----------------------------------------------------------------------------
class Function GdipCreateSolidFill(color:integer;var brush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateSolidFill";
class Function GdipSetSolidFillColor(brush:pointer;color:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetSolidFillColor";
class Function GdipGetSolidFillColor(brush:pointer;var color:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetSolidFillColor";
//----------------------------------------------------------------------------
// LineBrush APIs
//----------------------------------------------------------------------------
class Function GdipCreateLineBrush(point1:pointer;point2:pointer;color1:integer;color2:integer;wrapMode:integer;var lineGradient:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateLineBrush";
class Function GdipCreateLineBrushI(point1:pointer;point2:pointer;color1:integer;color2:integer;wrapMode:integer;var lineGradient:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateLineBrushI";
class Function GdipCreateLineBrushFromRect(rect:pointer;color1:integer;color2:integer;mode:pointer;wrapMode:integer;var lineGradient:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateLineBrushFromRect";
class Function GdipCreateLineBrushFromRectI(rect:pointer;color1:integer;color2:integer;mode:pointer;wrapMode:integer;var lineGradient:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateLineBrushFromRectI";
class Function GdipCreateLineBrushFromRectWithAngle(rect:pointer;color1:integer;color2:integer;angle:single;isAngleScalable:pointer;wrapMode:integer;var lineGradient:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateLineBrushFromRectWithAngle";
class Function GdipCreateLineBrushFromRectWithAngleI(rect:pointer;color1:integer;color2:integer;angle:single;isAngleScalable:pointer;wrapMode:integer;var lineGradient:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateLineBrushFromRectWithAngleI";
class Function GdipSetLineColors(brush:pointer;color1:integer;color2:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetLineColors";
class Function GdipGetLineColors(brush:pointer;var colors:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetLineColors";
class Function GdipGetLineRect(brush:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetLineRect";
class Function GdipGetLineRectI(brush:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetLineRectI";
class Function GdipSetLineGammaCorrection(brush:pointer;useGammaCorrection:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetLineGammaCorrection";
class Function GdipGetLineGammaCorrection(brush:pointer;useGammaCorrection:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetLineGammaCorrection";
class Function GdipGetLineBlendCount(brush:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetLineBlendCount";
class Function GdipGetLineBlend(brush:pointer;var blend:single;var positions:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetLineBlend";
class Function GdipSetLineBlend(brush:pointer;var blend:single;var positions:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetLineBlend";
class Function GdipGetLinePresetBlendCount(brush:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetLinePresetBlendCount";
class Function GdipGetLinePresetBlend(brush:pointer;var blend:integer;var positions:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetLinePresetBlend";
class Function GdipSetLinePresetBlend(brush:pointer;var blend:integer;var positions:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetLinePresetBlend";
class Function GdipSetLineSigmaBlend(brush:pointer;focus:single;scale:single):integer;stdcall;external "gdiplus.dll" name "GdipSetLineSigmaBlend";
class Function GdipSetLineLinearBlend(brush:pointer;focus:single;scale:single):integer;stdcall;external "gdiplus.dll" name "GdipSetLineLinearBlend";
class Function GdipSetLineWrapMode(brush:pointer;wrapmode:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetLineWrapMode";
class Function GdipGetLineWrapMode(brush:pointer;var wrapmode:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetLineWrapMode";
class Function GdipGetLineTransform(brush:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetLineTransform";
class Function GdipSetLineTransform(brush:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetLineTransform";
class Function GdipResetLineTransform(brush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipResetLineTransform";
class Function GdipMultiplyLineTransform(brush:pointer;matrix:pointer;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipMultiplyLineTransform";
class Function GdipTranslateLineTransform(brush:pointer;dx:single;dy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipTranslateLineTransform";
class Function GdipScaleLineTransform(brush:pointer;sx:single;sy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipScaleLineTransform";
class Function GdipRotateLineTransform(brush:pointer;angle:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRotateLineTransform";
//----------------------------------------------------------------------------
// PathGradientBrush APIs
//----------------------------------------------------------------------------
class Function GdipCreatePathGradient(points:pointer;count:integer;wrapMode:integer;var polyGradient:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePathGradient";
class Function GdipCreatePathGradientI(points:pointer;count:integer;wrapMode:integer;var polyGradient:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePathGradientI";
class Function GdipCreatePathGradientFromPath(path:pointer;var polyGradient:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePathGradientFromPath";
class Function GdipGetPathGradientCenterColor(brush:pointer;var colors:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientCenterColor";
class Function GdipSetPathGradientCenterColor(brush:pointer;colors:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientCenterColor";
class Function GdipGetPathGradientSurroundColorsWithCount(brush:pointer;var color:integer;count:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientSurroundColorsWithCount";
class Function GdipSetPathGradientSurroundColorsWithCount(brush:pointer;var color:integer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientSurroundColorsWithCount";
class Function GdipGetPathGradientPath(brush:pointer;path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientPath";
class Function GdipSetPathGradientPath(brush:pointer;path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientPath";
class Function GdipGetPathGradientCenterPoint(brush:pointer;points:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientCenterPoint";
class Function GdipGetPathGradientCenterPointI(brush:pointer;points:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientCenterPointI";
class Function GdipSetPathGradientCenterPoint(brush:pointer;points:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientCenterPoint";
class Function GdipSetPathGradientCenterPointI(brush:pointer;points:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientCenterPointI";
class Function GdipGetPathGradientRect(brush:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientRect";
class Function GdipGetPathGradientRectI(brush:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientRectI";
class Function GdipGetPathGradientPointCount(brush:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientPointCount";
class Function GdipGetPathGradientSurroundColorCount(brush:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientSurroundColorCount";
class Function GdipSetPathGradientGammaCorrection(brush:pointer;useGammaCorrection:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientGammaCorrection";
class Function GdipGetPathGradientGammaCorrection(brush:pointer;useGammaCorrection:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientGammaCorrection";
class Function GdipGetPathGradientBlendCount(brush:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientBlendCount";
class Function GdipGetPathGradientBlend(brush:pointer;var blend:single;var positions:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientBlend";
class Function GdipSetPathGradientBlend(brush:pointer;var blend:single;var positions:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientBlend";
class Function GdipGetPathGradientPresetBlendCount(brush:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientPresetBlendCount";
class Function GdipGetPathGradientPresetBlend(brush:pointer;var blend:integer;var positions:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientPresetBlend";
class Function GdipSetPathGradientPresetBlend(brush:pointer;var blend:integer;var positions:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientPresetBlend";
class Function GdipSetPathGradientSigmaBlend(brush:pointer;focus:single;scale:single):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientSigmaBlend";
class Function GdipSetPathGradientLinearBlend(brush:pointer;focus:single;scale:single):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientLinearBlend";
class Function GdipGetPathGradientWrapMode(brush:pointer;var wrapmode:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientWrapMode";
class Function GdipSetPathGradientWrapMode(brush:pointer;wrapmode:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientWrapMode";
class Function GdipGetPathGradientTransform(brush:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientTransform";
class Function GdipSetPathGradientTransform(brush:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientTransform";
class Function GdipResetPathGradientTransform(brush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipResetPathGradientTransform";
class Function GdipMultiplyPathGradientTransform(brush:pointer;matrix:pointer;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipMultiplyPathGradientTransform";
class Function GdipTranslatePathGradientTransform(brush:pointer;dx:single;dy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipTranslatePathGradientTransform";
class Function GdipScalePathGradientTransform(brush:pointer;sx:single;sy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipScalePathGradientTransform";
class Function GdipRotatePathGradientTransform(brush:pointer;angle:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRotatePathGradientTransform";
class Function GdipGetPathGradientFocusScales(brush:pointer;var xScale:single;var yScale:single):integer;stdcall;external "gdiplus.dll" name "GdipGetPathGradientFocusScales";
class Function GdipSetPathGradientFocusScales(brush:pointer;xScale:single;yScale:single):integer;stdcall;external "gdiplus.dll" name "GdipSetPathGradientFocusScales";
//----------------------------------------------------------------------------
// Pen APIs
//----------------------------------------------------------------------------
class Function GdipCreatePen1(color:integer;width:single;unit_:pointer;var pen:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePen1";
class Function GdipCreatePen2(brush:pointer;width:single;unit_:pointer;var pen:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePen2";
class Function GdipClonePen(pen:pointer;var clonepen:pointer):integer;stdcall;external "gdiplus.dll" name "GdipClonePen";
class Function GdipDeletePen(pen:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeletePen";
class Function GdipSetPenWidth(pen:pointer;width:single):integer;stdcall;external "gdiplus.dll" name "GdipSetPenWidth";
class Function GdipGetPenWidth(pen:pointer;var width:single):integer;stdcall;external "gdiplus.dll" name "GdipGetPenWidth";
class Function GdipSetPenUnit(pen:pointer;unit_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenUnit";
class Function GdipGetPenUnit(pen:pointer;unit_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenUnit";
class Function GdipSetPenLineCap197819(pen:pointer;startCap:pointer;endCap:pointer;dashCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenLineCap197819";
class Function GdipSetPenStartCap(pen:pointer;startCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenStartCap";
class Function GdipSetPenEndCap(pen:pointer;endCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenEndCap";
class Function GdipSetPenDashCap197819(pen:pointer;dashCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenDashCap197819";
class Function GdipGetPenStartCap(pen:pointer;startCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenStartCap";
class Function GdipGetPenEndCap(pen:pointer;endCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenEndCap";
class Function GdipGetPenDashCap197819(pen:pointer;dashCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenDashCap197819";
class Function GdipSetPenLineJoin(pen:pointer;lineJoin:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenLineJoin";
class Function GdipGetPenLineJoin(pen:pointer;lineJoin:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenLineJoin";
class Function GdipSetPenCustomStartCap(pen:pointer;customCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenCustomStartCap";
class Function GdipGetPenCustomStartCap(pen:pointer;var customCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenCustomStartCap";
class Function GdipSetPenCustomEndCap(pen:pointer;customCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenCustomEndCap";
class Function GdipGetPenCustomEndCap(pen:pointer;var customCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenCustomEndCap";
class Function GdipSetPenMiterLimit(pen:pointer;miterLimit:single):integer;stdcall;external "gdiplus.dll" name "GdipSetPenMiterLimit";
class Function GdipGetPenMiterLimit(pen:pointer;var miterLimit:single):integer;stdcall;external "gdiplus.dll" name "GdipGetPenMiterLimit";
class Function GdipSetPenMode(pen:pointer;penMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenMode";
class Function GdipGetPenMode(pen:pointer;penMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenMode";
class Function GdipSetPenTransform(pen:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenTransform";
class Function GdipGetPenTransform(pen:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenTransform";
class Function GdipResetPenTransform(pen:pointer):integer;stdcall;external "gdiplus.dll" name "GdipResetPenTransform";
class Function GdipMultiplyPenTransform(pen:pointer;matrix:pointer;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipMultiplyPenTransform";
class Function GdipTranslatePenTransform(pen:pointer;dx:single;dy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipTranslatePenTransform";
class Function GdipScalePenTransform(pen:pointer;sx:single;sy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipScalePenTransform";
class Function GdipRotatePenTransform(pen:pointer;angle:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRotatePenTransform";
class Function GdipSetPenColor(pen:pointer;argb:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenColor";
class Function GdipGetPenColor(pen:pointer;var argb:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenColor";
class Function GdipSetPenBrushFill(pen:pointer;brush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenBrushFill";
class Function GdipGetPenBrushFill(pen:pointer;var brush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenBrushFill";
class Function GdipGetPenFillType(pen:pointer;type:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenFillType";
class Function GdipGetPenDashStyle(pen:pointer;dashstyle:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenDashStyle";
class Function GdipSetPenDashStyle(pen:pointer;dashstyle:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenDashStyle";
class Function GdipGetPenDashOffset(pen:pointer;var offset:single):integer;stdcall;external "gdiplus.dll" name "GdipGetPenDashOffset";
class Function GdipSetPenDashOffset(pen:pointer;offset:single):integer;stdcall;external "gdiplus.dll" name "GdipSetPenDashOffset";
class Function GdipGetPenDashCount(pen:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenDashCount";
class Function GdipSetPenDashArray(pen:pointer;var dash:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenDashArray";
class Function GdipGetPenDashArray(pen:pointer;var dash:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenDashArray";
class Function GdipGetPenCompoundCount(pen:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenCompoundCount";
class Function GdipSetPenCompoundArray(pen:pointer;var dash:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetPenCompoundArray";
class Function GdipGetPenCompoundArray(pen:pointer;var dash:single;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPenCompoundArray";
//----------------------------------------------------------------------------
// CustomLineCap APIs
//----------------------------------------------------------------------------
class Function GdipCreateCustomLineCap(fillPath:pointer;strokePath:pointer;baseCap:pointer;baseInset:single;var customCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateCustomLineCap";
class Function GdipDeleteCustomLineCap(customCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeleteCustomLineCap";
class Function GdipCloneCustomLineCap(customCap:pointer;var clonedCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneCustomLineCap";
class Function GdipGetCustomLineCapType(customCap:pointer;capType:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetCustomLineCapType";
class Function GdipSetCustomLineCapStrokeCaps(customCap:pointer;startCap:pointer;endCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetCustomLineCapStrokeCaps";
class Function GdipGetCustomLineCapStrokeCaps(customCap:pointer;startCap:pointer;endCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetCustomLineCapStrokeCaps";
class Function GdipSetCustomLineCapStrokeJoin(customCap:pointer;lineJoin:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetCustomLineCapStrokeJoin";
class Function GdipGetCustomLineCapStrokeJoin(customCap:pointer;lineJoin:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetCustomLineCapStrokeJoin";
class Function GdipSetCustomLineCapBaseCap(customCap:pointer;baseCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetCustomLineCapBaseCap";
class Function GdipGetCustomLineCapBaseCap(customCap:pointer;baseCap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetCustomLineCapBaseCap";
class Function GdipSetCustomLineCapBaseInset(customCap:pointer;inset:single):integer;stdcall;external "gdiplus.dll" name "GdipSetCustomLineCapBaseInset";
class Function GdipGetCustomLineCapBaseInset(customCap:pointer;var inset:single):integer;stdcall;external "gdiplus.dll" name "GdipGetCustomLineCapBaseInset";
class Function GdipSetCustomLineCapWidthScale(customCap:pointer;widthScale:single):integer;stdcall;external "gdiplus.dll" name "GdipSetCustomLineCapWidthScale";
class Function GdipGetCustomLineCapWidthScale(customCap:pointer;var widthScale:single):integer;stdcall;external "gdiplus.dll" name "GdipGetCustomLineCapWidthScale";
//----------------------------------------------------------------------------
// AdjustableArrowCap APIs
//----------------------------------------------------------------------------
class Function GdipCreateAdjustableArrowCap(height:single;width:single;isFilled:pointer;var cap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateAdjustableArrowCap";
class Function GdipSetAdjustableArrowCapHeight(cap:pointer;height:single):integer;stdcall;external "gdiplus.dll" name "GdipSetAdjustableArrowCapHeight";
class Function GdipGetAdjustableArrowCapHeight(cap:pointer;var height:single):integer;stdcall;external "gdiplus.dll" name "GdipGetAdjustableArrowCapHeight";
class Function GdipSetAdjustableArrowCapWidth(cap:pointer;width:single):integer;stdcall;external "gdiplus.dll" name "GdipSetAdjustableArrowCapWidth";
class Function GdipGetAdjustableArrowCapWidth(cap:pointer;var width:single):integer;stdcall;external "gdiplus.dll" name "GdipGetAdjustableArrowCapWidth";
class Function GdipSetAdjustableArrowCapMiddleInset(cap:pointer;middleInset:single):integer;stdcall;external "gdiplus.dll" name "GdipSetAdjustableArrowCapMiddleInset";
class Function GdipGetAdjustableArrowCapMiddleInset(cap:pointer;var middleInset:single):integer;stdcall;external "gdiplus.dll" name "GdipGetAdjustableArrowCapMiddleInset";
class Function GdipSetAdjustableArrowCapFillState(cap:pointer;fillState:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetAdjustableArrowCapFillState";
class Function GdipGetAdjustableArrowCapFillState(cap:pointer;fillState:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetAdjustableArrowCapFillState";
//----------------------------------------------------------------------------
// Image APIs
//----------------------------------------------------------------------------
class Function GdipLoadImageFromStream(stream:pointer;var image:pointer):integer;stdcall;external "gdiplus.dll" name "GdipLoadImageFromStream";
class Function GdipLoadImageFromFile(filename:string;var image:pointer):integer;stdcall;external "gdiplus.dll" name "GdipLoadImageFromFile";
class Function GdipLoadImageFromStreamICM(stream:pointer;var image:pointer):integer;stdcall;external "gdiplus.dll" name "GdipLoadImageFromStreamICM";
class Function GdipLoadImageFromFileICM(filename:string;var image:pointer):integer;stdcall;external "gdiplus.dll" name "GdipLoadImageFromFileICM";
class Function GdipCloneImage(image:pointer;var cloneImage:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneImage";
class Function GdipDisposeImage(image:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDisposeImage";
class Function GdipSaveImageToFile(image:pointer;filename:string;clsidEncoder:pointer;encoderParams:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSaveImageToFile";
class Function GdipSaveImageToStream(image:pointer;stream:pointer;clsidEncoder:pointer;encoderParams:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSaveImageToStream";
class Function GdipSaveAdd(image:pointer;encoderParams:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSaveAdd";
class Function GdipSaveAddImage(image:pointer;newImage:pointer;encoderParams:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSaveAddImage";
class Function GdipGetImageGraphicsContext(image:pointer;var graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageGraphicsContext";
class Function GdipGetImageBounds(image:pointer;srcRect:pointer;srcUnit:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageBounds";
class Function GdipGetImageDimension(image:pointer;var width:single;var height:single):integer;stdcall;external "gdiplus.dll" name "GdipGetImageDimension";
class Function GdipGetImageType(image:pointer;type:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageType";
class Function GdipGetImageWidth(image:pointer;var width:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageWidth";
class Function GdipGetImageHeight(image:pointer;var height:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageHeight";
class Function GdipGetImageHorizontalResolution(image:pointer;var resolution:single):integer;stdcall;external "gdiplus.dll" name "GdipGetImageHorizontalResolution";
class Function GdipGetImageVerticalResolution(image:pointer;var resolution:single):integer;stdcall;external "gdiplus.dll" name "GdipGetImageVerticalResolution";
class Function GdipGetImageFlags(image:pointer;var flags:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageFlags";
class Function GdipGetImageRawFormat(image:pointer;format:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageRawFormat";
class Function GdipGetImagePixelFormat(image:pointer;format:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetImagePixelFormat";
class Function GdipGetImageThumbnail(image:pointer;thumbWidth:integer;thumbHeight:integer;var thumbImage:pointer;callback:pointer;callbackData:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageThumbnail";
class Function GdipGetEncoderParameterListSize(image:pointer;clsidEncoder:pointer;var size:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetEncoderParameterListSize";
class Function GdipGetEncoderParameterList(image:pointer;clsidEncoder:pointer;size:integer;buffer:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetEncoderParameterList";
class Function GdipImageGetFrameDimensionsCount(image:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipImageGetFrameDimensionsCount";
class Function GdipImageGetFrameDimensionsList(image:pointer;dimensionIDs:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipImageGetFrameDimensionsList";
class Function GdipImageGetFrameCount(image:pointer;dimensionID:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipImageGetFrameCount";
class Function GdipImageSelectActiveFrame(image:pointer;dimensionID:pointer;frameIndex:integer):integer;stdcall;external "gdiplus.dll" name "GdipImageSelectActiveFrame";
class Function GdipImageRotateFlip(image:pointer;rfType:pointer):integer;stdcall;external "gdiplus.dll" name "GdipImageRotateFlip";
class Function GdipGetImagePalette(image:pointer;palette:pointer;size:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetImagePalette";
class Function GdipSetImagePalette(image:pointer;palette:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetImagePalette";
class Function GdipGetImagePaletteSize(image:pointer;var size:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetImagePaletteSize";
class Function GdipGetPropertyCount(image:pointer;var numOfProperty:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPropertyCount";
class Function GdipGetPropertyIdList(image:pointer;numOfProperty:integer;list:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPropertyIdList";
class Function GdipGetPropertyItemSize(image:pointer;propId:pointer;var size:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPropertyItemSize";
class Function GdipGetPropertyItem(image:pointer;propId:pointer;propSize:integer;buffer:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPropertyItem";
class Function GdipGetPropertySize(image:pointer;var totalBufferSize:integer;var numProperties:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetPropertySize";
class Function GdipGetAllPropertyItems(image:pointer;totalBufferSize:integer;numProperties:integer;allItems:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetAllPropertyItems";
class Function GdipRemovePropertyItem(image:pointer;propId:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRemovePropertyItem";
class Function GdipSetPropertyItem(image:pointer;item:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPropertyItem";
class Function GdipImageForceValidation(image:pointer):integer;stdcall;external "gdiplus.dll" name "GdipImageForceValidation";
//----------------------------------------------------------------------------
// Bitmap APIs
//----------------------------------------------------------------------------
class Function GdipCreateBitmapFromStream(stream:pointer;var bitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromStream";
class Function GdipCreateBitmapFromFile(filename:string;var bitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromFile";
class Function GdipCreateBitmapFromStreamICM(stream:pointer;var bitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromStreamICM";
class Function GdipCreateBitmapFromFileICM(filename:string;var bitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromFileICM";
class Function GdipCreateBitmapFromScan0(width:integer;height:integer;stride:integer;format:pointer;):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromScan0";
class Function GdipCreateBitmapFromGraphics(width:integer;height:integer;target:pointer;var bitmap:pointer):pointer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromGraphics";
class Function GdipCreateBitmapFromDirectDrawSurface(surface:pointer;var bitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromDirectDrawSurface";
class Function GdipCreateBitmapFromGdiDib(gdiBitmapInfo:pointer;gdiBitmapData:pointer;var bitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromGdiDib";
class Function GdipCreateBitmapFromHBITMAP(hbm:pointer;hpal:pointer;var bitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromHBITMAP";
class Function GdipCreateHBITMAPFromBitmap(bitmap:pointer;var hbmReturn:pointer;background:integer):integer;stdcall;external "gdiplus.dll" name "GdipCreateHBITMAPFromBitmap";
class Function GdipCreateBitmapFromHICON(hicon:pointer;var bitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromHICON";
class Function GdipCreateHICONFromBitmap(bitmap:pointer;var hbmReturn:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateHICONFromBitmap";
class Function GdipCreateBitmapFromResource(hInstance:pointer;lpBitmapName:string;var bitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateBitmapFromResource";
class Function GdipCloneBitmapArea(x:single;y:single;width:single;height:single;format:pointer;srcBitmap:pointer;var dstBitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneBitmapArea";
class Function GdipCloneBitmapAreaI(x:integer;y:integer;width:integer;height:integer;format:pointer;srcBitmap:pointer;var dstBitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneBitmapAreaI";
class Function GdipBitmapLockBits(bitmap:pointer;rect:pointer;flags:integer;format:pointer;lockedBitmapData:pointer):integer;stdcall;external "gdiplus.dll" name "GdipBitmapLockBits";
class Function GdipBitmapUnlockBits(bitmap:pointer;lockedBitmapData:pointer):integer;stdcall;external "gdiplus.dll" name "GdipBitmapUnlockBits";
class Function GdipBitmapGetPixel(bitmap:pointer;x:integer;y:integer;var color:integer):integer;stdcall;external "gdiplus.dll" name "GdipBitmapGetPixel";
class Function GdipBitmapSetPixel(bitmap:pointer;x:integer;y:integer;color:integer):integer;stdcall;external "gdiplus.dll" name "GdipBitmapSetPixel";
class Function GdipBitmapSetResolution(bitmap:pointer;xdpi:single;ydpi:single):integer;stdcall;external "gdiplus.dll" name "GdipBitmapSetResolution";
//----------------------------------------------------------------------------
// ImageAttributes APIs
//----------------------------------------------------------------------------
class Function GdipCreateImageAttributes(var imageattr:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateImageAttributes";
class Function GdipCloneImageAttributes(imageattr:pointer;var cloneImageattr:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneImageAttributes";
class Function GdipDisposeImageAttributes(imageattr:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDisposeImageAttributes";
class Function GdipSetImageAttributesToIdentity(imageattr:pointer;type:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesToIdentity";
class Function GdipResetImageAttributes(imageattr:pointer;type:pointer):integer;stdcall;external "gdiplus.dll" name "GdipResetImageAttributes";
class Function GdipSetImageAttributesColorMatrix(imageattr:pointer;type:pointer;enableFlag:pointer;colorMatrix:pointer;grayMatrix:pointer;flags:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesColorMatrix";
class Function GdipSetImageAttributesThreshold(imageattr:pointer;type:pointer;enableFlag:pointer;threshold:single):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesThreshold";
class Function GdipSetImageAttributesGamma(imageattr:pointer;type:pointer;enableFlag:pointer;gamma:single):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesGamma";
class Function GdipSetImageAttributesNoOp(imageattr:pointer;type:pointer;enableFlag:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesNoOp";
class Function GdipSetImageAttributesColorKeys(imageattr:pointer;type:pointer;enableFlag:pointer;colorLow:integer;colorHigh:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesColorKeys";
class Function GdipSetImageAttributesOutputChannel(imageattr:pointer;type:pointer;enableFlag:pointer;channelFlags:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesOutputChannel";
class Function GdipSetImageAttributesOutputChannelColorProfile(imageattr:pointer;type:pointer;enableFlag:pointer;colorProfileFilename:string):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesOutputChannelColorProfile";
class Function GdipSetImageAttributesRemapTable(imageattr:pointer;type:pointer;enableFlag:pointer;mapSize:integer;map:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesRemapTable";
class Function GdipSetImageAttributesWrapMode(imageAttr:pointer;wrap:pointer;argb:integer;clamp:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesWrapMode";
class Function GdipSetImageAttributesICMMode(imageAttr:pointer;on_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesICMMode";
class Function GdipGetImageAttributesAdjustedPalette(imageAttr:pointer;colorPalette:pointer;colorAdjustType:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageAttributesAdjustedPalette";
//----------------------------------------------------------------------------
// Graphics APIs
//----------------------------------------------------------------------------
class Function GdipFlush(graphics:pointer;intention:pointer):integer;stdcall;external "gdiplus.dll" name "GdipFlush";
class Function GdipCreateFromHDC(hdc:pointer;var graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateFromHDC";
class Function GdipCreateFromHDC2(hdc:pointer;hDevice:pointer;var graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateFromHDC2";
class Function GdipCreateFromHWND(hwnd:pointer;var graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateFromHWND";
class Function GdipCreateFromHWNDICM(hwnd:pointer;var graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateFromHWNDICM";
class Function GdipDeleteGraphics(graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeleteGraphics";
class Function GdipGetDC(graphics:pointer;hdc:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetDC";
class Function GdipReleaseDC(graphics:pointer;hdc:pointer):integer;stdcall;external "gdiplus.dll" name "GdipReleaseDC";
class Function GdipSetCompositingMode(graphics:pointer;compositingMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetCompositingMode";
class Function GdipGetCompositingMode(graphics:pointer;compositingMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetCompositingMode";
class Function GdipSetRenderingOrigin(graphics:pointer;x:integer;y:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetRenderingOrigin";
class Function GdipGetRenderingOrigin(graphics:pointer;var x:integer;var y:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetRenderingOrigin";
class Function GdipSetCompositingQuality(graphics:pointer;compositingQuality:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetCompositingQuality";
class Function GdipGetCompositingQuality(graphics:pointer;compositingQuality:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetCompositingQuality";
class Function GdipSetSmoothingMode(graphics:pointer;smoothingMode:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetSmoothingMode";
class Function GdipGetSmoothingMode(graphics:pointer;var smoothingMode:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetSmoothingMode";
class Function GdipSetPixelOffsetMode(graphics:pointer;pixelOffsetMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPixelOffsetMode";
class Function GdipGetPixelOffsetMode(graphics:pointer;pixelOffsetMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPixelOffsetMode";
class Function GdipSetTextRenderingHint(graphics:pointer;mode:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetTextRenderingHint";
class Function GdipGetTextRenderingHint(graphics:pointer;var mode:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetTextRenderingHint";
class Function GdipSetTextContrast(graphics:pointer;contrast:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetTextContrast";
class Function GdipGetTextContrast(graphics:pointer;var contrast:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetTextContrast";
class Function GdipSetInterpolationMode(graphics:pointer;interpolationMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetInterpolationMode";
class Function GdipGetInterpolationMode(graphics:pointer;interpolationMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetInterpolationMode";
class Function GdipSetWorldTransform(graphics:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetWorldTransform";
class Function GdipResetWorldTransform(graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipResetWorldTransform";
class Function GdipMultiplyWorldTransform(graphics:pointer;matrix:pointer;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipMultiplyWorldTransform";
class Function GdipTranslateWorldTransform(graphics:pointer;dx:single;dy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipTranslateWorldTransform";
class Function GdipScaleWorldTransform(graphics:pointer;sx:single;sy:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipScaleWorldTransform";
class Function GdipRotateWorldTransform(graphics:pointer;angle:single;order_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRotateWorldTransform";
class Function GdipGetWorldTransform(graphics:pointer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetWorldTransform";
class Function GdipResetPageTransform(graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipResetPageTransform";
class Function GdipGetPageUnit(graphics:pointer;unit_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetPageUnit";
class Function GdipGetPageScale(graphics:pointer;var scale:single):integer;stdcall;external "gdiplus.dll" name "GdipGetPageScale";
class Function GdipSetPageUnit(graphics:pointer;unit_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetPageUnit";
class Function GdipSetPageScale(graphics:pointer;scale:single):integer;stdcall;external "gdiplus.dll" name "GdipSetPageScale";
class Function GdipGetDpiX(graphics:pointer;var dpi:single):integer;stdcall;external "gdiplus.dll" name "GdipGetDpiX";
class Function GdipGetDpiY(graphics:pointer;var dpi:single):integer;stdcall;external "gdiplus.dll" name "GdipGetDpiY";
class Function GdipTransformPoints(graphics:pointer;destSpace:pointer;srcSpace:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipTransformPoints";
class Function GdipTransformPointsI(graphics:pointer;destSpace:pointer;srcSpace:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipTransformPointsI";
class Function GdipGetNearestColor(graphics:pointer;var argb:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetNearestColor";
// Creates the Win9x Halftone Palette (even on NT) with correct Desktop colors
class Function GdipCreateHalftonePalette():pointer;stdcall;external "gdiplus.dll" name "GdipCreateHalftonePalette";
class Function GdipDrawLine(graphics:pointer;pen:pointer;x1:single;y1:single;x2:single;y2:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawLine";
class Function GdipDrawLineI(graphics:pointer;pen:pointer;x1:integer;y1:integer;x2:integer;y2:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawLineI";
class Function GdipDrawLines(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawLines";
class Function GdipDrawLinesI(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawLinesI";
class Function GdipDrawArc(graphics:pointer;pen:pointer;x:single;y:single;width:single;height:single;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawArc";
class Function GdipDrawArcI(graphics:pointer;pen:pointer;x:integer;y:integer;width:integer;height:integer;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawArcI";
class Function GdipDrawBezier(graphics:pointer;pen:pointer;x1:single;y1:single;x2:single;y2:single;x3:single;y3:single;x4:single;y4:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawBezier";
class Function GdipDrawBezierI(graphics:pointer;pen:pointer;x1:integer;y1:integer;x2:integer;y2:integer;x3:integer;y3:integer;x4:integer;y4:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawBezierI";
class Function GdipDrawBeziers(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawBeziers";
class Function GdipDrawBeziersI(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawBeziersI";
class Function GdipDrawRectangle(graphics:pointer;pen:pointer;x:single;y:single;width:single;height:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawRectangle";
class Function GdipDrawRectangleI(graphics:pointer;pen:pointer;x:integer;y:integer;width:integer;height:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawRectangleI";
class Function GdipDrawRectangles(graphics:pointer;pen:pointer;rects:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawRectangles";
class Function GdipDrawRectanglesI(graphics:pointer;pen:pointer;rects:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawRectanglesI";
class Function GdipDrawEllipse(graphics:pointer;pen:pointer;x:single;y:single;width:single;height:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawEllipse";
class Function GdipDrawEllipseI(graphics:pointer;pen:pointer;x:integer;y:integer;width:integer;height:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawEllipseI";
class Function GdipDrawPie(graphics:pointer;pen:pointer;x:single;y:single;width:single;height:single;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawPie";
class Function GdipDrawPieI(graphics:pointer;pen:pointer;x:integer;y:integer;width:integer;height:integer;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawPieI";
class Function GdipDrawPolygon(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawPolygon";
class Function GdipDrawPolygonI(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawPolygonI";
class Function GdipDrawPath(graphics:pointer;pen:pointer;path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDrawPath";
class Function GdipDrawCurve(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawCurve";
class Function GdipDrawCurveI(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawCurveI";
class Function GdipDrawCurve2(graphics:pointer;pen:pointer;points:pointer;count:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawCurve2";
class Function GdipDrawCurve2I(graphics:pointer;pen:pointer;points:pointer;count:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawCurve2I";
class Function GdipDrawCurve3(graphics:pointer;pen:pointer;points:pointer;count:integer;offset:integer;numberOfSegments:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawCurve3";
class Function GdipDrawCurve3I(graphics:pointer;pen:pointer;points:pointer;count:integer;offset:integer;numberOfSegments:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawCurve3I";
class Function GdipDrawClosedCurve(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawClosedCurve";
class Function GdipDrawClosedCurveI(graphics:pointer;pen:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawClosedCurveI";
class Function GdipDrawClosedCurve2(graphics:pointer;pen:pointer;points:pointer;count:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawClosedCurve2";
class Function GdipDrawClosedCurve2I(graphics:pointer;pen:pointer;points:pointer;count:integer;tension:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawClosedCurve2I";
class Function GdipGraphicsClear(graphics:pointer;color:integer):integer;stdcall;external "gdiplus.dll" name "GdipGraphicsClear";
class Function GdipFillRectangle(graphics:pointer;brush:pointer;x:single;y:single;width:single;height:single):integer;stdcall;external "gdiplus.dll" name "GdipFillRectangle";
class Function GdipFillRectangleI(graphics:pointer;brush:pointer;x:integer;y:integer;width:integer;height:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillRectangleI";
class Function GdipFillRectangles(graphics:pointer;brush:pointer;rects:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillRectangles";
class Function GdipFillRectanglesI(graphics:pointer;brush:pointer;rects:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillRectanglesI";
class Function GdipFillPolygon(graphics:pointer;brush:pointer;points:pointer;count:integer;fillMode:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillPolygon";
class Function GdipFillPolygonI(graphics:pointer;brush:pointer;points:pointer;count:integer;fillMode:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillPolygonI";
class Function GdipFillPolygon2(graphics:pointer;brush:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillPolygon2";
class Function GdipFillPolygon2I(graphics:pointer;brush:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillPolygon2I";
class Function GdipFillEllipse(graphics:pointer;brush:pointer;x:single;y:single;width:single;height:single):integer;stdcall;external "gdiplus.dll" name "GdipFillEllipse";
class Function GdipFillEllipseI(graphics:pointer;brush:pointer;x:integer;y:integer;width:integer;height:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillEllipseI";
class Function GdipFillPie(graphics:pointer;brush:pointer;x:single;y:single;width:single;height:single;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipFillPie";
class Function GdipFillPieI(graphics:pointer;brush:pointer;x:integer;y:integer;width:integer;height:integer;startAngle:single;sweepAngle:single):integer;stdcall;external "gdiplus.dll" name "GdipFillPieI";
class Function GdipFillPath(graphics:pointer;brush:pointer;path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipFillPath";
class Function GdipFillClosedCurve(graphics:pointer;brush:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillClosedCurve";
class Function GdipFillClosedCurveI(graphics:pointer;brush:pointer;points:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillClosedCurveI";
class Function GdipFillClosedCurve2(graphics:pointer;brush:pointer;points:pointer;count:integer;tension:single;fillMode:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillClosedCurve2";
class Function GdipFillClosedCurve2I(graphics:pointer;brush:pointer;points:pointer;count:integer;tension:single;fillMode:integer):integer;stdcall;external "gdiplus.dll" name "GdipFillClosedCurve2I";
class Function GdipFillRegion(graphics:pointer;brush:pointer;region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipFillRegion";
class Function GdipDrawImage(graphics:pointer;image:pointer;x:single;y:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawImage";
class Function GdipDrawImageI(graphics:pointer;image:pointer;x:integer;y:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImageI";
class Function GdipDrawImageRect(graphics:pointer;image:pointer;x:single;y:single;width:single;height:single):integer;stdcall;external "gdiplus.dll" name "GdipDrawImageRect";
class Function GdipDrawImageRectI(graphics:pointer;image:pointer;x:integer;y:integer;width:integer;height:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImageRectI";
class Function GdipDrawImagePoints(graphics:pointer;image:pointer;dstpoints:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImagePoints";
class Function GdipDrawImagePointsI(graphics:pointer;image:pointer;dstpoints:pointer;count:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImagePointsI";
class Function GdipDrawImagePointRect(graphics:pointer;image:pointer;x:single;y:single;srcx:single;srcy:single;srcwidth:single;srcheight:single;srcUnit:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImagePointRect";
class Function GdipDrawImagePointRectI(graphics:pointer;image:pointer;x:integer;y:integer;srcx:integer;srcy:integer;srcwidth:integer;srcheight:integer;srcUnit:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImagePointRectI";
class Function GdipDrawImageRectRect(graphics:pointer;image:pointer;dstx:single;dsty:single;dstwidth:single;dstheight:single;srcx:single;srcy:single;srcwidth:single;srcheight:single;srcUnit:pointer;imageAttributes:pointer;callback:pointer;callbackData:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImageRectRect";
class Function GdipDrawImageRectRectI(graphics:pointer;image:pointer;dstx:integer;dsty:integer;dstwidth:integer;dstheight:integer;srcx:integer;srcy:integer;srcwidth:integer;srcheight:integer;srcUnit:pointer;imageAttributes:pointer;callback:pointer;callbackData:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImageRectRectI";
class Function GdipDrawImagePointsRect(graphics:pointer;image:pointer;points:pointer;count:integer;srcx:single;srcy:single;srcwidth:single;srcheight:single;srcUnit:pointer;imageAttributes:pointer;callback:pointer;callbackData:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImagePointsRect";
class Function GdipDrawImagePointsRectI(graphics:pointer;image:pointer;points:pointer;count:integer;srcx:integer;srcy:integer;srcwidth:integer;srcheight:integer;srcUnit:pointer;imageAttributes:pointer;callback:pointer;callbackData:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDrawImagePointsRectI";
class Function GdipEnumerateMetafileDestPoint(graphics:pointer;metafile:pointer;destPoint:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileDestPoint";
class Function GdipEnumerateMetafileDestPointI(graphics:pointer;metafile:pointer;destPoint:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileDestPointI";
class Function GdipEnumerateMetafileDestRect(graphics:pointer;metafile:pointer;destRect:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileDestRect";
class Function GdipEnumerateMetafileDestRectI(graphics:pointer;metafile:pointer;destRect:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileDestRectI";
class Function GdipEnumerateMetafileDestPoints(graphics:pointer;metafile:pointer;destPoints:pointer;count:integer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileDestPoints";
class Function GdipEnumerateMetafileDestPointsI(graphics:pointer;metafile:pointer;destPoints:pointer;count:integer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileDestPointsI";
class Function GdipEnumerateMetafileSrcRectDestPoint(graphics:pointer;metafile:pointer;destPoint:pointer;srcRect:pointer;srcUnit:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileSrcRectDestPoint";
class Function GdipEnumerateMetafileSrcRectDestPointI(graphics:pointer;metafile:pointer;destPoint:pointer;srcRect:pointer;srcUnit:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileSrcRectDestPointI";
class Function GdipEnumerateMetafileSrcRectDestRect(graphics:pointer;metafile:pointer;destRect:pointer;srcRect:pointer;srcUnit:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileSrcRectDestRect";
class Function GdipEnumerateMetafileSrcRectDestRectI(graphics:pointer;metafile:pointer;destRect:pointer;srcRect:pointer;srcUnit:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileSrcRectDestRectI";
class Function GdipEnumerateMetafileSrcRectDestPoints(graphics:pointer;metafile:pointer;destPoints:pointer;count:integer;srcRect:pointer;srcUnit:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileSrcRectDestPoints";
class Function GdipEnumerateMetafileSrcRectDestPointsI(graphics:pointer;metafile:pointer;destPoints:pointer;count:integer;srcRect:pointer;srcUnit:pointer;callback:pointer;callbackData:pointer;imageAttributes:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEnumerateMetafileSrcRectDestPointsI";
class Function GdipPlayMetafileRecord(metafile:pointer;recordType:pointer;flags:integer;dataSize:integer;data:pointer):integer;stdcall;external "gdiplus.dll" name "GdipPlayMetafileRecord";
class Function GdipSetClipGraphics(graphics:pointer;srcgraphics:pointer;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetClipGraphics";
class Function GdipSetClipRect(graphics:pointer;x:single;y:single;width:single;height:single;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetClipRect";
class Function GdipSetClipRectI(graphics:pointer;x:integer;y:integer;width:integer;height:integer;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetClipRectI";
class Function GdipSetClipPath(graphics:pointer;path:pointer;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetClipPath";
class Function GdipSetClipRegion(graphics:pointer;region:pointer;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetClipRegion";
class Function GdipSetClipHrgn(graphics:pointer;hRgn:pointer;combineMode:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetClipHrgn";
class Function GdipResetClip(graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipResetClip";
class Function GdipTranslateClip(graphics:pointer;dx:single;dy:single):integer;stdcall;external "gdiplus.dll" name "GdipTranslateClip";
class Function GdipTranslateClipI(graphics:pointer;dx:integer;dy:integer):integer;stdcall;external "gdiplus.dll" name "GdipTranslateClipI";
class Function GdipGetClip(graphics:pointer;region:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetClip";
class Function GdipGetClipBounds(graphics:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetClipBounds";
class Function GdipGetClipBoundsI(graphics:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetClipBoundsI";
class Function GdipIsClipEmpty(graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsClipEmpty";
class Function GdipGetVisibleClipBounds(graphics:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetVisibleClipBounds";
class Function GdipGetVisibleClipBoundsI(graphics:pointer;rect:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetVisibleClipBoundsI";
class Function GdipIsVisibleClipEmpty(graphics:pointer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisibleClipEmpty";
class Function GdipIsVisiblePoint(graphics:pointer;x:single;y:single;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisiblePoint";
class Function GdipIsVisiblePointI(graphics:pointer;x:integer;y:integer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisiblePointI";
class Function GdipIsVisibleRect(graphics:pointer;x:single;y:single;width:single;height:single;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisibleRect";
class Function GdipIsVisibleRectI(graphics:pointer;x:integer;y:integer;width:integer;height:integer;result:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsVisibleRectI";
class Function GdipSaveGraphics(graphics:pointer;state:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSaveGraphics";
class Function GdipRestoreGraphics(graphics:pointer;state:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRestoreGraphics";
class Function GdipBeginContainer(graphics:pointer;dstrect:pointer;srcrect:pointer;unit_:pointer;state:pointer):integer;stdcall;external "gdiplus.dll" name "GdipBeginContainer";
class Function GdipBeginContainerI(graphics:pointer;dstrect:pointer;srcrect:pointer;unit_:pointer;state:pointer):integer;stdcall;external "gdiplus.dll" name "GdipBeginContainerI";
class Function GdipBeginContainer2(graphics:pointer;state:pointer):integer;stdcall;external "gdiplus.dll" name "GdipBeginContainer2";
class Function GdipEndContainer(graphics:pointer;state:pointer):integer;stdcall;external "gdiplus.dll" name "GdipEndContainer";
class Function GdipGetMetafileHeaderFromWmf(hWmf:pointer;wmfPlaceableFileHeader:pointer;header:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetMetafileHeaderFromWmf";
class Function GdipGetMetafileHeaderFromEmf(hEmf:pointer;header:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetMetafileHeaderFromEmf";
class Function GdipGetMetafileHeaderFromFile(filename:string;header:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetMetafileHeaderFromFile";
class Function GdipGetMetafileHeaderFromStream(stream:pointer;header:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetMetafileHeaderFromStream";
class Function GdipGetMetafileHeaderFromMetafile(metafile:pointer;header:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetMetafileHeaderFromMetafile";
class Function GdipGetHemfFromMetafile(metafile:pointer;hEmf:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetHemfFromMetafile";
class Function GdipCreateStreamOnFile(filename:string;access:integer;var stream:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateStreamOnFile";
class Function GdipCreateMetafileFromWmf(hWmf:pointer;deleteWmf:pointer;wmfPlaceableFileHeader:pointer;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateMetafileFromWmf";
class Function GdipCreateMetafileFromEmf(hEmf:pointer;deleteEmf:pointer;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateMetafileFromEmf";
class Function GdipCreateMetafileFromFile(file:string;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateMetafileFromFile";
class Function GdipCreateMetafileFromWmfFile(file:string;wmfPlaceableFileHeader:pointer;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateMetafileFromWmfFile";
class Function GdipCreateMetafileFromStream(stream:pointer;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateMetafileFromStream";
class Function GdipRecordMetafile(referenceHdc:pointer;type:pointer;frameRect:pointer;frameUnit:pointer;description:string;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRecordMetafile";
class Function GdipRecordMetafileI(referenceHdc:pointer;type:pointer;frameRect:pointer;frameUnit:pointer;description:string;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRecordMetafileI";
class Function GdipRecordMetafileFileName(fileName:string;referenceHdc:pointer;type:pointer;frameRect:pointer;frameUnit:pointer;description:string;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRecordMetafileFileName";
class Function GdipRecordMetafileFileNameI(fileName:string;referenceHdc:pointer;type:pointer;frameRect:pointer;frameUnit:pointer;description:string;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRecordMetafileFileNameI";
class Function GdipRecordMetafileStream(stream:pointer;referenceHdc:pointer;type:pointer;frameRect:pointer;frameUnit:pointer;description:string;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRecordMetafileStream";
class Function GdipRecordMetafileStreamI(stream:pointer;referenceHdc:pointer;type:pointer;frameRect:pointer;frameUnit:pointer;description:string;var metafile:pointer):integer;stdcall;external "gdiplus.dll" name "GdipRecordMetafileStreamI";
class Function GdipSetMetafileDownLevelRasterizationLimit(metafile:pointer;metafileRasterizationLimitDpi:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetMetafileDownLevelRasterizationLimit";
class Function GdipGetMetafileDownLevelRasterizationLimit(metafile:pointer;var metafileRasterizationLimitDpi:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetMetafileDownLevelRasterizationLimit";
class Function GdipGetImageDecodersSize(var numDecoders:integer;pn4:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageDecodersSize";
class Function GdipGetImageDecoders(numDecoders:integer;size:integer;decoders:pointer):pointer;stdcall;external "gdiplus.dll" name "GdipGetImageDecoders";
class Function GdipGetImageEncodersSize(var numEncoders:integer;pn4:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetImageEncodersSize";
class Function GdipGetImageEncoders(numEncoders:integer;size:integer;encoders:pointer):pointer;stdcall;external "gdiplus.dll" name "GdipGetImageEncoders";
class Function GdipComment(graphics:pointer;sizeData:integer;data:pointer):integer;stdcall;external "gdiplus.dll" name "GdipComment";
//----------------------------------------------------------------------------
// FontFamily APIs
//----------------------------------------------------------------------------
class Function GdipCreateFontFamilyFromName(name:string;fontCollection:pointer;var fontFamily:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateFontFamilyFromName";
class Function GdipDeleteFontFamily(fontFamily:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeleteFontFamily";
class Function GdipCloneFontFamily(fontFamily:pointer;var clonedFontFamily:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneFontFamily";
class Function GdipGetGenericFontFamilySansSerif(var nativeFamily:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetGenericFontFamilySansSerif";
class Function GdipGetGenericFontFamilySerif(var nativeFamily:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetGenericFontFamilySerif";
class Function GdipGetGenericFontFamilyMonospace(var nativeFamily:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetGenericFontFamilyMonospace";
class Function GdipGetFamilyName(family:pointer;name:pointer;language:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetFamilyName";
class Function GdipIsStyleAvailable(family:pointer;style:integer;IsStyleAvailable:pointer):integer;stdcall;external "gdiplus.dll" name "GdipIsStyleAvailable";
class Function GdipFontCollectionEnumerable(fontCollection:pointer;graphics:pointer;var numFound:integer):integer;stdcall;external "gdiplus.dll" name "GdipFontCollectionEnumerable";
class Function GdipFontCollectionEnumerate(fontCollection:pointer;numSought:integer;gpfamilies:pointer;var numFound:integer;graphics:pointer):integer;stdcall;external "gdiplus.dll" name "GdipFontCollectionEnumerate";
class Function GdipGetEmHeight(family:pointer;style:integer;EmHeight:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetEmHeight";
class Function GdipGetCellAscent(family:pointer;style:integer;CellAscent:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetCellAscent";
class Function GdipGetCellDescent(family:pointer;style:integer;CellDescent:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetCellDescent";
class Function GdipGetLineSpacing(family:pointer;style:integer;LineSpacing:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetLineSpacing";
//----------------------------------------------------------------------------
// Font APIs
//----------------------------------------------------------------------------
class Function GdipCreateFontFromDC(hdc:pointer;var font:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateFontFromDC";
class Function GdipCreateFontFromLogfontA(hdc:pointer;logfont:pointer;var font:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateFontFromLogfontA";
class Function GdipCreateFontFromLogfontW(hdc:pointer;logfont:pointer;var font:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateFontFromLogfontW";
class Function GdipCreateFont(fontFamily:pointer;emSize:single;style:integer;unit_:pointer;var font:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateFont";
class Function GdipCloneFont(font:pointer;var cloneFont:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneFont";
class Function GdipDeleteFont(font:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeleteFont";
class Function GdipGetFamily(font:pointer;var family:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetFamily";
class Function GdipGetFontStyle(font:pointer;var style:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetFontStyle";
class Function GdipGetFontSize(font:pointer;var size:single):integer;stdcall;external "gdiplus.dll" name "GdipGetFontSize";
class Function GdipGetFontUnit(font:pointer;unit_:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetFontUnit";
class Function GdipGetFontHeight(font:pointer;graphics:pointer;var height:single):integer;stdcall;external "gdiplus.dll" name "GdipGetFontHeight";
class Function GdipGetFontHeightGivenDPI(font:pointer;dpi:single;var height:single):integer;stdcall;external "gdiplus.dll" name "GdipGetFontHeightGivenDPI";
class Function GdipGetLogFontA(font:pointer;graphics:pointer;logfontA:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetLogFontA";
class Function GdipGetLogFontW(font:pointer;graphics:pointer;logfontW:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetLogFontW";
class Function GdipNewInstalledFontCollection(var fontCollection:pointer):integer;stdcall;external "gdiplus.dll" name "GdipNewInstalledFontCollection";
class Function GdipNewPrivateFontCollection(var fontCollection:pointer):integer;stdcall;external "gdiplus.dll" name "GdipNewPrivateFontCollection";
class Function GdipDeletePrivateFontCollection(var fontCollection:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeletePrivateFontCollection";
class Function GdipGetFontCollectionFamilyCount(fontCollection:pointer;var numFound:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetFontCollectionFamilyCount";
class Function GdipGetFontCollectionFamilyList(fontCollection:pointer;numSought:integer;gpfamilies:pointer;var numFound:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetFontCollectionFamilyList";
class Function GdipPrivateAddFontFile(fontCollection:pointer;filename:string):integer;stdcall;external "gdiplus.dll" name "GdipPrivateAddFontFile";
class Function GdipPrivateAddMemoryFont(fontCollection:pointer;memory:pointer;length:integer):integer;stdcall;external "gdiplus.dll" name "GdipPrivateAddMemoryFont";
//----------------------------------------------------------------------------
// Text APIs
//----------------------------------------------------------------------------
class Function GdipDrawString(graphics:pointer;string:string;length:integer;font:pointer;layoutRect:pointer;stringFormat:pointer;brush:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDrawString";
class Function GdipMeasureString(graphics:pointer;string:string;length:integer;font:pointer;layoutRect:pointer;stringFormat:pointer;boundingBox:pointer;var codepointsFitted:integer;var linesFilled:integer):integer;stdcall;external "gdiplus.dll" name "GdipMeasureString";
class Function GdipMeasureCharacterRanges(graphics:pointer;string:string;length:integer;font:pointer;layoutRect:pointer;stringFormat:pointer;regionCount:integer;var regions:pointer):integer;stdcall;external "gdiplus.dll" name "GdipMeasureCharacterRanges";
class Function GdipDrawDriverString(graphics:pointer;text:pointer;length:integer;font:pointer;brush:pointer;positions:pointer;flags:integer;matrix:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDrawDriverString";
class Function GdipMeasureDriverString(graphics:pointer;text:pointer;length:integer;font:pointer;positions:pointer;flags:integer;matrix:pointer;boundingBox:pointer):integer;stdcall;external "gdiplus.dll" name "GdipMeasureDriverString";
//----------------------------------------------------------------------------
// String format APIs
//----------------------------------------------------------------------------
class Function GdipCreateStringFormat(formatAttributes:integer;language:pointer;var format:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateStringFormat";
class Function GdipStringFormatGetGenericDefault(var format:pointer):integer;stdcall;external "gdiplus.dll" name "GdipStringFormatGetGenericDefault";
class Function GdipStringFormatGetGenericTypographic(var format:pointer):integer;stdcall;external "gdiplus.dll" name "GdipStringFormatGetGenericTypographic";
class Function GdipDeleteStringFormat(format:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeleteStringFormat";
class Function GdipCloneStringFormat(format:pointer;var newFormat:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCloneStringFormat";
class Function GdipSetStringFormatFlags(format:pointer;flags:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetStringFormatFlags";
class Function GdipGetStringFormatFlags(format:pointer;var flags:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetStringFormatFlags";
class Function GdipSetStringFormatAlign(format:pointer;align:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetStringFormatAlign";
class Function GdipGetStringFormatAlign(format:pointer;align:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetStringFormatAlign";
class Function GdipSetStringFormatLineAlign(format:pointer;align:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetStringFormatLineAlign";
class Function GdipGetStringFormatLineAlign(format:pointer;align:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetStringFormatLineAlign";
class Function GdipSetStringFormatTrimming(format:pointer;trimming:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetStringFormatTrimming";
class Function GdipGetStringFormatTrimming(format:pointer;trimming:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetStringFormatTrimming";
class Function GdipSetStringFormatHotkeyPrefix(format:pointer;hotkeyPrefix:integer):integer;stdcall;external "gdiplus.dll" name "GdipSetStringFormatHotkeyPrefix";
class Function GdipGetStringFormatHotkeyPrefix(format:pointer;var hotkeyPrefix:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetStringFormatHotkeyPrefix";
class Function GdipSetStringFormatTabStops(format:pointer;firstTabOffset:single;count:integer;var tabStops:single):integer;stdcall;external "gdiplus.dll" name "GdipSetStringFormatTabStops";
class Function GdipGetStringFormatTabStops(format:pointer;count:integer;var firstTabOffset:single;var tabStops:single):integer;stdcall;external "gdiplus.dll" name "GdipGetStringFormatTabStops";
class Function GdipGetStringFormatTabStopCount(format:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetStringFormatTabStopCount";
class Function GdipSetStringFormatDigitSubstitution(format:pointer;language:pointer;substitute:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetStringFormatDigitSubstitution";
class Function GdipGetStringFormatDigitSubstitution(format:pointer;language:pointer;substitute:pointer):integer;stdcall;external "gdiplus.dll" name "GdipGetStringFormatDigitSubstitution";
class Function GdipGetStringFormatMeasurableCharacterRangeCount(format:pointer;var count:integer):integer;stdcall;external "gdiplus.dll" name "GdipGetStringFormatMeasurableCharacterRangeCount";
class Function GdipSetStringFormatMeasurableCharacterRanges(format:pointer;rangeCount:integer;ranges:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetStringFormatMeasurableCharacterRanges";
//----------------------------------------------------------------------------
// Cached Bitmap APIs
//----------------------------------------------------------------------------
class Function GdipCreateCachedBitmap(bitmap:pointer;graphics:pointer;var cachedBitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreateCachedBitmap";
class Function GdipDeleteCachedBitmap(cachedBitmap:pointer):integer;stdcall;external "gdiplus.dll" name "GdipDeleteCachedBitmap";
class Function GdipDrawCachedBitmap(graphics:pointer;cachedBitmap:pointer;x:integer;y:integer):integer;stdcall;external "gdiplus.dll" name "GdipDrawCachedBitmap";
class Function GdipEmfToWmfBits(hemf:pointer;cbData16:integer;pData16:pointer;iMapMode:integer;eFlags:integer):integer;stdcall;external "gdiplus.dll" name "GdipEmfToWmfBits";
class Function GdipSetImageAttributesCachedBackground(imageattr:pointer;enableFlag:pointer):integer;stdcall;external "gdiplus.dll" name "GdipSetImageAttributesCachedBackground";
class Function GdipTestControl(control:pointer;param:pointer):integer;stdcall;external "gdiplus.dll" name "GdipTestControl";
class Function GdiplusNotificationHook(token:pointer):integer;stdcall;external "gdiplus.dll" name "GdiplusNotificationHook";
class procedure GdiplusNotificationUnhook(token:pointer);stdcall;external "gdiplus.dll" name "GdiplusNotificationUnhook";
class Function GdiplusStartup(var token:pointer;input:pointer;var output:integer){@explan(说明)启动gdi+%%}:integer;stdcall;external "gdiplus.dll" name "GdiplusStartup";
class procedure GdiplusShutdown(token:pointer){@explan(说明)关闭gdi+%%};stdcall;external "gdiplus.dll" name "GdiplusShutdown";
{$endif}
end
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+367
View File
@@ -0,0 +1,367 @@
unit uvclthreadworker;
{**
@explan(说明)支持工作线程
注意:工作线程中仅仅支持运算,不支持窗口的操作,
**}
//20210902 添加未初始化之前postmessage的缓存
interface
uses cstructurelib;
function RunThreadWorkerClient(this); //运行子任务
function RunThreadWorkerHost(); //分发worker消息
type tworkerclient = class(TArray)
{**
@explan(说明) 工作线程 %%
**}
function Create(ph);
begin
inherited create();
FConnectHandle := ph;
uisetthreadworkerdata(ph,0x30,self.handle); //构造
end
function close(); //请求关闭 0x10
begin
uisetthreadworkerdata(FConnectHandle,0x10,0);
end
function PostMessage(d);
begin
uisetthreadworkerdata(FConnectHandle,0x20,d);
end
function DoOnMessage(d); //执行onmessage 任务
begin
if datatype(FOnMessage)=7 then
begin
try
return call(FOnMessage,self,d);
except
uisetthreadworkerdata(FConnectHandle,0x40,exceptobject.ErrInfo);
end;
end
end
property ConnectHandle read FConnectHandle;
property OnMessage read FOnMessage write FOnMessage;
{**
@param(OnMessage)(function[tworkerclient,data]) 消息回调 %%
**}
function destroy();override;
begin
FOnMessage := nil;
inherited;
end
private
FOnMessage; //onpost message
FConnectHandle; //句柄
end
type TCustomThreadworker = class()
{**
@explan(说明) 工作线程宿主 %%
**}
function Create(s,lib,declaration);
begin
if not ifarray(FThreaders) then FThreaders := array();
FThreader := new tworkerHost();
FThreaders[inttostr(FThreader.handle)] := FThreader;
if not (checkok(s,libs,declaration)) then raise "工作线程构造失败!";
uibeginthreadworker(FScript);
end
function Operator [](idx);
begin
{**
@explan(说明) get数据 %%
**}
return FThreader[idx];
end
function Operator [1](idx,v);
begin
{**
@explan(说明) set数据 %%
**}
FThreader[idx] := v;
end
function Close(); //关闭
begin
destroy();
end
function terminate();
begin
Close();
end
function PostMessage(d);
begin
{**
@expaln(说明) 发送数据给子线程 %%
@param(d)(any) 发送数据,基础数据,不能传送对象 %%
**}
FThreader.PostMessage(d);
end
class function dispatch();
begin
if not FThreaders then return ;
for idx,i in mrows( FThreaders,1) do
begin
o := FThreaders[i];
if uifeachthreadworkerdata(o.handle,msg,data) then
begin
case msg of
0x30: //构成成功
begin
o.ClientReady(data);
end
0x10: //请求关闭
begin
o.close();
end
0x12: //成功关闭
begin
uideleteworkerdata(o.handle); //删除数据
o.ClientReady(0);
DeleteWorker(i);
o.destroy();
end
0x40: //错误
begin
o.DoOnError(data);
end
0x20 : //传输数据
begin
o.DoOnMessage(data);
end
end ;
break;
end
end
end
function destroy();override;
begin
if FThreader then
begin
FThreader.close();
end
inherited;
end
property OnMessage read GetOnMessage write SetOnMessage;
property OnError read GetOnError write SetOnError;
property OnStart read GetOnStart Write SetOnStart;
{**
@param(OnMessage)(function[TThreadWorker,data]) 消息回调 %%
@param(OnStart)(function[TThreadWorker]) 子线程启动 %%
@param(OnError)(function[TThreadWorker,d]) 子线程启动 %%
**}
protected
function Check_TslCode(FScript,err);virtual;
begin
return true;
end
private
class function DeleteWorker(h);
begin
if h then
reindex( FThreaders,array(h:nil));
end
function checkok(s,libs,declaration);
begin
if ifstring(s) then
begin
lib := "";
if ifarray(libs) and libs then
begin
lib := ","+array2str(libs,",");
end
dc := "";
if ifstring(declaration) then
begin
dc := declaration;
end
FScript := format( %%
uses uvclthreadworker%s;
this := new unit(uvclthreadworker).tworkerclient(%s);
%s;
unit(uvclthreadworker).RunThreadWorkerClient(this);
%s;
%%,lib,inttostr(FThreader.handle),s,dc);
r := Check_TslCode(FScript,err);
if not r then FScript := "";
end
return r;
end
function GetOnMessage();
begin
return FThreader.OnMessage;
end
function SetOnMessage(m);
begin
FThreader.OnMessage := m;
end
function GetOnError()begin
return FThreader.OnError ;
end
function SetOnError(e)begin
FThreader.OnError := e ;
end
function GetOnStart()begin
return FThreader.OnStart ;
end
function SetOnStart(e)begin
FThreader.OnStart := e ;
end
static FThreaders;
FScript; //脚本
FThreader;//host对象
end
implementation
function RunThreadWorkerHost();
begin
class(TCustomThreadworker).dispatch();
end
function RunThreadWorkerClient(this);
begin
{**
@explan(说明) 工作线程主循环 %%
**}
h := this.handle;
ph := this.ConnectHandle;
while true do
begin
if uifeachthreadworkerdata(h,msg,d) then
begin
case msg of
0x11 : //关闭
begin
uisetthreadworkerdata(ph,0x12,0); //关闭完成
uideleteworkerdata(h); //删除消息
return;
end
0x20 : //post
begin
this.DoOnMessage(d);
end
end
end else
begin
sleep(20);
end
end
end
type TArray = class
function create();
begin
FData := array();
fobj := new tcbytearray(4);
FHandle := fobj._getptr_() ;
end
function Operator [](idx);
begin
return FData[idx];
end
function Operator [1](idx,v);
begin
FData[idx] := v;
end
function destroy();virtual;
begin
FData := array();
fobj := nil;
end
property handle read FHandle ;
private
FData;
FHandle;
fobj;
end
type tworkerHost = class(TArray)
function Create();
begin
inherited;
FConnectHandle := 0;
FCatcheData := array();
end
property OnMessage read FOnMessage write FOnMessage;
property OnStart read FOnStart write FOnStart;
property OnError read FOnError write FOnError;
function close(); //关闭命令 0x10
begin
if FConnectHandle then
begin
uisetthreadworkerdata(FConnectHandle,0x11,0);
end
end
function ClientReady(h); //任务句柄改变
begin
FConnectHandle := h;
if h then
begin
if datatype(FOnStart)=7 then
begin
try
call(FOnStart,self);
except
end;
end
if FCatcheData then
begin
for i,v in FCatcheData do
begin
uisetthreadworkerdata(FConnectHandle,0x20,v);
end
FCatcheData := array();
end
end
end
function PostMessage(d); //发送数据
begin
if FConnectHandle then
begin
if FCatcheData then
begin
for i,v in FCatcheData do
begin
uisetthreadworkerdata(FConnectHandle,0x20,v);
end
FCatcheData := array();
end
uisetthreadworkerdata(FConnectHandle,0x20,d);
end else
begin
FCatcheData[length(FCatcheData)] := d;
end
end
function DoOnError(d);//处理错误
begin
if datatype(FOnError)=7 then
begin
try
return call(FOnError,self,d);
except
end;
end
end
function DoOnMessage(d); //处理数据
begin
if datatype(FOnMessage)=7 then
begin
try
return call(FOnMessage,self,d);
except
end;
end
end
function destroy();override;
begin
FOnMessage := nil;
FOnError := nil;
OnStart := nil;
FCatcheData := array();
inherited;
end
private
FCatcheData; //构造数据
FOnMessage; //onpost message
FOnError;
FOnStart;
FConnectHandle; //句柄
end
initialization
end.
File diff suppressed because it is too large Load Diff