资 源 简 介
Delphi 实现图像热点功能,实现一张图片上不同形状区域的热点,定义椭圆形、四边形、三角形的区域变量的热点,相关代码如下:
var
thepoint:array [1..8] of tpoint;//存储多边形顶点坐标
count:integer;
pointnum:array [1..2] of integer;
begin
//四边形顶点坐标,首末点封闭
thepoint[1]:=point(135,99);
thepoint[2]:=point(105,183);
thepoint[3]:=point(129,201);
thepoint[4]:=point(188,92);
thepoint[5]:=point(135,99);
count:=5;//四边形顶点数目,首末点为一点
fourE_rgn:=CreatePolygonRgn(thepoint,count,WINDING);//生成四边形区域
elli_rgn:=CreateEllipticRgn(64,221,231,263);// 生成椭圆形区域
//第一个三角形顶点坐标
thepoint[1]:=point(118,67);
thepoint[2]:=point(32,28);
thepoint[3]:=point(17,90);
thepoint[4]:=point(118,67);
//第二个三角形顶点坐标
thepoint[5]:=point(155,44);
thepoint[6]:=point(202,91);
thepoint[7]:=point(277,44);
thepoint[8]:=point(155,44);
pointnum[1]:=4;//第一个三角形顶点数目
pointnum[2]:=4;//第二个三角形顶点数目
count:=2;//三角形数目
//生成由两个三角形构成的三角形区域
tri_rgn:=CreatePolyPolygonRgn(thepoint,pointnum,count,WINDING);
end;