📄 iagaloled.pas
字号:
setlength(FInnerPointsxy,4);
setlength(FOuterPointsxy,4);
FLedPointsxy[0].x:=dx+FledWidth div 4;FLedpointsxy[0].y:=dx;
FLedPointsxy[1].x:=dx+3*FledWidth div 4;FLedpointsxy[1].y:=dx;
FLedPointsxy[2].x:=dx+FLedWidth; FLedpointsxy[2].y:=dx+FledHeight;
FLedPointsxy[3].x:=dx; FLedpointsxy[3].y:=dx+FLedHeight;
FGapPointsxy[0].x:=FLedPointsxy[0].x-fgap div 2; FGapPointsxy[0].y:=FLedpointsxy[0].y-FGap;
FGapPointsxy[1].x:=FLedPointsxy[1].x+fgap div 2; FGapPointsxy[1].y:=FLedpointsxy[1].y-FGap;
FGapPointsxy[2].x:=FLedPointsxy[2].x+FGap; FGapPointsxy[2].y:=FLedpointsxy[2].y+FGap;
FGapPointsxy[3].x:=FLedPointsxy[3].x-Fgap; FGapPointsxy[3].y:=FLedpointsxy[3].y+FGap;
if FInnerBorderStyle<>iablsNone then
begin
FInnerPointsxy[0].x:=FGapPointsxy[0].x-FInnerBorderDepth div 2;FInnerPointsxy[0].y:=FGapPointsxy[0].y-FInnerBorderDepth;
FInnerPointsxy[1].x:=FGapPointsxy[1].x+FInnerBorderDepth div 2;FInnerPointsxy[1].y:=FGapPointsxy[1].y-FInnerBorderDepth;
FInnerPointsxy[2].x:=FGapPointsxy[2].x+FInnerBorderDepth;FInnerPointsxy[2].y:=FGapPointsxy[2].y+FInnerBorderDepth;
FInnerPointsxy[3].x:=FGapPointsxy[3].x-FInnerBorderDepth;FInnerPointsxy[3].y:=FGapPointsxy[3].y+FInnerBorderDepth;
end else
begin
FInnerPointsxy[0].x:=FGapPointsxy[0].x;FInnerPointsxy[0].y:=FGapPointsxy[0].y;
FInnerPointsxy[1].x:=FGapPointsxy[1].x;FInnerPointsxy[1].y:=FGapPointsxy[1].y;
FInnerPointsxy[2].x:=FGapPointsxy[2].x;FInnerPointsxy[2].y:=FGapPointsxy[2].y;
FInnerPointsxy[3].x:=FGapPointsxy[3].x;FInnerPointsxy[3].y:=FGapPointsxy[3].y;
end;
if FOuterBorderStyle<>iablsNone then
begin
FOuterPointsxy[0].x:=FInnerPointsxy[0].x-FOuterBorderDepth div 2;FOuterPointsxy[0].y:=FInnerPointsxy[0].y-FOuterBorderDepth;
FOuterPointsxy[1].x:=FInnerPointsxy[1].x+FOuterBorderDepth div 2;FOuterPointsxy[1].y:=FInnerPointsxy[1].y-FOuterBorderDepth;
FOuterPointsxy[2].x:=FInnerPointsxy[2].x+FOuterBorderDepth;FOuterPointsxy[2].y:=FInnerPointsxy[2].y+FOuterBorderDepth;
FOuterPointsxy[3].x:=FInnerPointsxy[3].x-FOuterBorderDepth;FOuterPointsxy[3].y:=FInnerPointsxy[3].y+FOuterBorderDepth;
end else
begin
FOuterPointsxy[0].x:=FInnerPointsxy[0].x;FOuterPointsxy[0].y:=FInnerPointsxy[0].y;
FOuterPointsxy[1].x:=FInnerPointsxy[1].x;FOuterPointsxy[1].y:=FInnerPointsxy[1].y;
FOuterPointsxy[2].x:=FInnerPointsxy[2].x;FOuterPointsxy[2].y:=FInnerPointsxy[2].y;
FOuterPointsxy[3].x:=FInnerPointsxy[3].x;FOuterPointsxy[3].y:=FInnerPointsxy[3].y;
end;
RotatePolyPoints(FLedPointsxy);
RotatePolyPoints(FGapPointsxy);
RotatePolyPoints(FInnerPointsxy);
RotatePolyPoints(FOuterPointsxy);
end;
ialcTriangle :
begin
setlength(FLedPointsxy ,3);
setlength(FGapPointsxy ,3);
setlength(FInnerPointsxy,3);
setlength(FOuterPointsxy,3);
FLedPointsxy[0].x:=dx+FledWidth div 2;FLedpointsxy[0].y:=dx;
FLedPointsxy[1].x:=dx+FLedWidth; FLedpointsxy[1].y:=dx+FledHeight;
FLedPointsxy[2].x:=dx; FLedpointsxy[2].y:=dx+FLedHeight;
FGapPointsxy[0].x:=FLedPointsxy[0].x; FGapPointsxy[0].y:=FLedpointsxy[0].y-FGap;
FGapPointsxy[1].x:=FLedPointsxy[1].x+FGap; FGapPointsxy[1].y:=FLedpointsxy[1].y+FGap;
FGapPointsxy[2].x:=FLedPointsxy[2].x-Fgap; FGapPointsxy[2].y:=FLedpointsxy[2].y+FGap;
if FInnerBorderStyle<>iablsNone then
begin
FInnerPointsxy[0].x:=FGapPointsxy[0].x; FInnerPointsxy[0].y:=FGapPointsxy[0].y-FInnerBorderDepth;
FInnerPointsxy[1].x:=FGapPointsxy[1].x+FInnerBorderDepth;FInnerPointsxy[1].y:=FGapPointsxy[1].y+FInnerBorderDepth;
FInnerPointsxy[2].x:=FGapPointsxy[2].x-FInnerBorderDepth;FInnerPointsxy[2].y:=FGapPointsxy[2].y+FInnerBorderDepth;
end else
begin
FInnerPointsxy[0].x:=FGapPointsxy[0].x;FInnerPointsxy[0].y:=FGapPointsxy[0].y;
FInnerPointsxy[1].x:=FGapPointsxy[1].x;FInnerPointsxy[1].y:=FGapPointsxy[1].y;
FInnerPointsxy[2].x:=FGapPointsxy[2].x;FInnerPointsxy[2].y:=FGapPointsxy[2].y;
end;
if FOuterBorderStyle<>iablsNone then
begin
FOuterPointsxy[0].x:=FInnerPointsxy[0].x; FOuterPointsxy[0].y:=FInnerPointsxy[0].y-FOuterBorderDepth;
FOuterPointsxy[1].x:=FInnerPointsxy[1].x+FOuterBorderDepth;FOuterPointsxy[1].y:=FInnerPointsxy[1].y+FOuterBorderDepth;
FOuterPointsxy[2].x:=FInnerPointsxy[2].x-FOuterBorderDepth;FOuterPointsxy[2].y:=FInnerPointsxy[2].y+FOuterBorderDepth;
end else
begin
FOuterPointsxy[0].x:=FInnerPointsxy[0].x;FOuterPointsxy[0].y:=FInnerPointsxy[0].y;
FOuterPointsxy[1].x:=FInnerPointsxy[1].x;FOuterPointsxy[1].y:=FInnerPointsxy[1].y;
FOuterPointsxy[2].x:=FInnerPointsxy[2].x;FOuterPointsxy[2].y:=FInnerPointsxy[2].y;
end;
RotatePolyPoints(FLedPointsxy);
RotatePolyPoints(FGapPointsxy);
RotatePolyPoints(FInnerPointsxy);
RotatePolyPoints(FOuterPointsxy);
end;
ialcRomb :
begin
setlength(FLedPointsxy ,4);
setlength(FGapPointsxy ,4);
setlength(FInnerPointsxy,4);
setlength(FOuterPointsxy,4);
FLedPointsxy[0].x:=dx+FledWidth div 2;FLedpointsxy[0].y:=dx;
FLedPointsxy[1].x:=dx+FLedWidth; FLedpointsxy[1].y:=dx+FledHeight div 2;
FLedPointsxy[2].x:=dx+FLedWidth div 2;FLedpointsxy[2].y:=dx+FLedHeight;
FLedPointsxy[3].x:=dx; FLedpointsxy[3].y:=dx+FledHeight div 2;
FGapPointsxy[0].x:=FLedPointsxy[0].x; FGapPointsxy[0].y:=FLedpointsxy[0].y-FGap;
FGapPointsxy[1].x:=FLedPointsxy[1].x+FGap; FGapPointsxy[1].y:=FLedpointsxy[1].y;
FGapPointsxy[2].x:=FLedPointsxy[2].x; FGapPointsxy[2].y:=FLedpointsxy[2].y+FGap;
FGapPointsxy[3].x:=FLedPointsxy[3].x-FGap; FGapPointsxy[3].y:=FLedpointsxy[3].y;
if FInnerBorderStyle<>iablsNone then
begin
FInnerPointsxy[0].x:=FGapPointsxy[0].x;FInnerPointsxy[0].y:=FGapPointsxy[0].y-FInnerBorderDepth;
FInnerPointsxy[1].x:=FGapPointsxy[1].x+FInnerBorderDepth;FInnerPointsxy[1].y:=FGapPointsxy[1].y;
FInnerPointsxy[2].x:=FGapPointsxy[2].x;FInnerPointsxy[2].y:=FGapPointsxy[2].y+FInnerBorderDepth;
FInnerPointsxy[3].x:=FGapPointsxy[3].x-FInnerBorderDepth;FInnerPointsxy[3].y:=FGapPointsxy[3].y;
end else
begin
FInnerPointsxy[0].x:=FGapPointsxy[0].x;FInnerPointsxy[0].y:=FGapPointsxy[0].y;
FInnerPointsxy[1].x:=FGapPointsxy[1].x;FInnerPointsxy[1].y:=FGapPointsxy[1].y;
FInnerPointsxy[2].x:=FGapPointsxy[2].x;FInnerPointsxy[2].y:=FGapPointsxy[2].y;
FInnerPointsxy[3].x:=FGapPointsxy[3].x;FInnerPointsxy[3].y:=FGapPointsxy[3].y;
end;
if FOuterBorderStyle<>iablsNone then
begin
FOuterPointsxy[0].x:=FInnerPointsxy[0].x;FOuterPointsxy[0].y:=FInnerPointsxy[0].y-FOuterBorderDepth;
FOuterPointsxy[1].x:=FInnerPointsxy[1].x+FOuterBorderDepth;FOuterPointsxy[1].y:=FInnerPointsxy[1].y;
FOuterPointsxy[2].x:=FInnerPointsxy[2].x;FOuterPointsxy[2].y:=FInnerPointsxy[2].y+FOuterBorderDepth;
FOuterPointsxy[3].x:=FInnerPointsxy[3].x-FOuterBorderDepth;FOuterPointsxy[3].y:=FInnerPointsxy[3].y;
end else
begin
FOuterPointsxy[0].x:=FInnerPointsxy[0].x;FOuterPointsxy[0].y:=FInnerPointsxy[0].y;
FOuterPointsxy[1].x:=FInnerPointsxy[1].x;FOuterPointsxy[1].y:=FInnerPointsxy[1].y;
FOuterPointsxy[2].x:=FInnerPointsxy[2].x;FOuterPointsxy[2].y:=FInnerPointsxy[2].y;
FOuterPointsxy[3].x:=FInnerPointsxy[3].x;FOuterPointsxy[3].y:=FInnerPointsxy[3].y;
end;
RotatePolyPoints(FLedPointsxy);
RotatePolyPoints(FGapPointsxy);
RotatePolyPoints(FInnerPointsxy);
RotatePolyPoints(FOuterPointsxy);
end;
ialcHalfCircle :
begin
N:=max(FLedWidth,FLedHeight); if N<1 then N:=1;
setlength(FLedPointsxy ,2*N+2);
setlength(FGapPointsxy ,2*N+2);
setlength(FInnerPointsxy,2*N+2);
setlength(FOuterPointsxy,2*N+2);
for i:=0 to 2*N-1 do
begin
x:=dx+FledWidth*sin(i*pi/(2*N-1));
y:=FLedHeight/2+dx- FledHeight*cos(i*pi/(2*N-1))/2;
FLedPointsxy[i].x:=x;
FLedpointsxy[i].y:=y;
x:=x+FGap*sin(i*pi/(2*N-1));
y:=y-FGap*cos(i*pi/(2*N-1));
FGapPointsxy[i].x:=x;
FGapPointsxy[i].y:=y;
if FInnerBorderStyle<>iablsNone then
begin
x:=x+FInnerBorderDepth*sin(i*pi/(2*N-1));
y:=y-FInnerBorderDepth*cos(i*pi/(2*N-1));
FInnerPointsxy[i].x:=x;
FInnerPointsxy[i].y:=y;
end else
begin
FInnerPointsxy[i].x:=FGapPointsxy[i].x;FInnerPointsxy[i].y:=FGapPointsxy[i].y;
end;
if FOuterBorderStyle<>iablsNone then
begin
FOuterPointsxy[i].x:=x+FOuterBorderDepth*sin(i*pi/(2*N-1));
FOuterPointsxy[i].y:=y-FOuterBorderDepth*cos(i*pi/(2*N-1));
end else
begin
FOuterPointsxy[i].x:=FInnerPointsxy[i].x;FOuterPointsxy[i].y:=FInnerPointsxy[i].y;
end;
end;
FLedPointsxy[2*N].x:=dx;
FLedpointsxy[2*N].y:=dx+FLedHeight;
FLedPointsxy[2*N+1].x:=dx;
FLedpointsxy[2*N+1].y:=dx;
FGapPointsxy[2*N].x:=FLedPointsxy[2*N].x-FGap;
FGapPointsxy[2*N].y:=FLedPointsxy[2*N].y+FGap;
FGapPointsxy[2*N+1].x:=FLedPointsxy[2*N+1].x-FGap;
FGapPointsxy[2*N+1].y:=FLedPointsxy[2*N+1].y-FGap;
if FInnerBorderStyle<>iablsNone then
begin
FInnerPointsxy[2*N].x:=FGapPointsxy[2*N].x-FInnerBorderDepth;
FInnerPointsxy[2*N].y:=FGapPointsxy[2*N].y+FInnerBorderDepth;
FInnerPointsxy[2*N+1].x:=FGapPointsxy[2*N+1].x-FInnerBorderDepth;
FInnerPointsxy[2*N+1].y:=FGapPointsxy[2*N+1].y-FInnerBorderDepth;
end else
begin
FInnerPointsxy[2*N].x:=FGapPointsxy[2*N].x;
FInnerPointsxy[2*N].y:=FGapPointsxy[2*N].y;
FInnerPointsxy[2*N+1].x:=FGapPointsxy[2*N+1].x;
FInnerPointsxy[2*N+1].y:=FGapPointsxy[2*N+1].y;
end;
if FOuterBorderStyle<>iablsNone then
begin
FOuterPointsxy[2*N].x:=FInnerPointsxy[2*N].x-FOuterBorderDepth;
FOuterPointsxy[2*N].y:=FInnerPointsxy[2*N].y+FOuterBorderDepth;
FOuterPointsxy[2*N+1].x:=FInnerPointsxy[2*N+1].x-FOuterBorderDepth;
FOuterPointsxy[2*N+1].y:=FInnerPointsxy[2*N+1].y-FOuterBorderDepth;
end else
begin
FOuterPointsxy[2*N].x:=FInnerPointsxy[2*N].x;
FOuterPointsxy[2*N].y:=FInnerPointsxy[2*N].y;
FOuterPointsxy[2*N+1].x:=FInnerPointsxy[2*N+1].x;
FOuterPointsxy[2*N+1].y:=FInnerPointsxy[2*N+1].y;
end;
RotatePolyPoints(FLedPointsxy);
RotatePolyPoints(FGapPointsxy);
RotatePolyPoints(FInnerPointsxy);
RotatePolyPoints(FOuterPointsxy);
end;
else
begin
setlength(FLedPointsxy ,4);
setlength(FGapPointsxy ,4);
setlength(FInnerPointsxy,4);
setlength(FOuterPointsxy,4);
FLedPointsxy[0].x:=dx;FLedpointsxy[0].y:=dx;
FLedPointsxy[1].x:=dx+FLedWidth;FLedpointsxy[1].y:=dx;
FLedPointsxy[2].x:=dx+FLedWidth;FLedpointsxy[2].y:=dx+FLedHeight;
FLedPointsxy[3].x:=dx;FLedpointsxy[3].y:=dx+FledHeight;
FGapPointsxy[0].x:=dx-FGap; FGapPointsxy[0].y:=dx-FGap;
FGapPointsxy[1].x:=dx+FLedWidth+FGap;FGapPointsxy[1].y:=dx-FGap;
FGapPointsxy[2].x:=dx+FLedWidth+FGap;FGapPointsxy[2].y:=dx+FLedHeight+FGap;
FGapPointsxy[3].x:=dx-FGap; FGapPointsxy[3].y:=dx+FledHeight+FGap;
if FInnerBorderStyle<>iablsNone then
begin
FInnerPointsxy[0].x:=FGapPointsxy[0].x-FInnerBorderDepth;FInnerPointsxy[0].y:=FGapPointsxy[0].y-FInnerBorderDepth;
FInnerPointsxy[1].x:=FGapPointsxy[1].x+FInnerBorderDepth;FInnerPointsxy[1].y:=FGapPointsxy[1].y-FInnerBorderDepth;
FInnerPointsxy[2].x:=FGapPointsxy[2].x+FInnerBorderDepth;FInnerPointsxy[2].y:=FGapPointsxy[2].y+FInnerBorderDepth;
FInnerPointsxy[3].x:=FGapPointsxy[3].x-FInnerBorderDepth;FInnerPointsxy[3].y:=FGapPointsxy[3].y+FInnerBorderDepth;
end else
begin
FInnerPointsxy[0].x:=FGapPointsxy[0].x;FInnerPointsxy[0].y:=FGapPointsxy[0].y;
FInnerPointsxy[1].x:=FGapPointsxy[1].x;FInnerPointsxy[1].y:=FGapPointsxy[1].y;
FInnerPointsxy[2].x:=FGapPointsxy[2].x;FInnerPointsxy[2].y:=FGapPointsxy[2].y;
FInnerPointsxy[3].x:=FGapPointsxy[3].x;FInnerPointsxy[3].y:=FGapPointsxy[3].y;
end;
if FOuterBorderStyle<>iablsNone then
begin
FOuterPointsxy[0].x:=FInnerPointsxy[0].x-FOuterBorderDepth;FOuterPointsxy[0].y:=FInnerPointsxy[0].y-FOuterBorderDepth;
FOuterPointsxy[1].x:=FInnerPointsxy[1].x+FOuterBorderDepth;FOuterPointsxy[1].y:=FInnerPointsxy[1].y-FOuterBorderDepth;
FOuterPointsxy[2].x:=FInnerPointsxy[2].x+FOuterBorderDepth;FOuterPointsxy[2].y:=FInnerPointsxy[2].y+FOuterBorderDepth;
FOuterPointsxy[3].x:=FInnerPointsxy[3].x-FOuterBorderDepth;FOuterPointsxy[3].y:=FInnerPointsxy[3].y+FOuterBorderDepth;
end else
begin
FOuterPointsxy[0].x:=FInnerPointsxy[0].x;FOuterPointsxy[0].y:=FInnerPointsxy[0].y;
FOuterPointsxy[1].x:=FInnerPointsxy[1].x;FOuterPointsxy[1].y:=FInnerPointsxy[1].y;
FOuterPointsxy[2].x:=FInnerPointsxy[2].x;FOuterPointsxy[2].y:=FInnerPointsxy[2].y;
FOuterPointsxy[3].x:=FInnerPointsxy[3].x;FOuterPointsxy[3].y:=FInnerPointsxy[3].y;
end;
RotatePolyPoints(FLedPointsxy);
RotatePolyPoints(FGapPointsxy);
RotatePolyPoints(FInnerPointsxy);
RotatePolyPoints(FOuterPointsxy);
end;
end;
reinsertpoints;
{
FLedPoints : array of TPoint;
FGapPoints : array of TPoint;
FInnerPoints : array of TPoint;
FOuterPoints : array of TPoint;
}
RGN:=CreatePolygonRGN(FOuterPoints[0],length(FOuterPoints),Alternate);
SetWindowRGN(self.handle,RGN,TRUE);
end;
procedure TIAgaloLED.DefineWidthHeight;
var mW,mH,dX : integer;
begin
Dx:=FGap;
if FInnerBorderStyle<>iablsNone then inc(dX,FInnerBorderDepth);
if FOuterBorderStyle<>iablsNone then inc(dX,FOuterBorderDepth);
mW:=FLedWidth+2*Dx;
mH:=FLedHeight+2*Dx;
FLastWidth:= round(abs(mW*cos(pi*FAngle/1800))+abs(mH*sin(pi*FAngle/1800)));
FLastHeight:=round(abs(mW*sin(pi*FAngle/1800))+abs(mH*cos(pi*FAngle/1800)));
MoveWindow(self.handle,left,top,FLastWidth,FLastHeight,TRUE);
DefinePointArrays;
end;
destructor TIAgaloLED.Destroy;
begin
FPaintBitmap.free;
if FBorderL<>nil then FBorderL.free;
if FBorderD<>nil then FBorderD.free;
if FBorderSubstance<>nil then FBorderSubstance.free;
if FLedPlasticSubstance<>nil then FLedPlasticSubstance.free;
inherited destroy;
end;
function TIAgaloLED.GetHeight: integer;
begin
result:=inherited height;
end;
procedure TIAgaloLED.GetPaintBitmap;
var i,j,k,N,dx,TryAngle : integer;
pR,pG,pB : pbyte;
Color1 : TColor;
pByte1 : pByteArray;
x,y,w,h,dd,ddx,ddy : double;
GapRGN,R1,DR,LR : HRGN;
ar1 : array [0..3] of TPoint;
begin
if (FBorderSubstance<>nil) and (FBorderSubstance.height<>0) and
((FBorderL.height=0) or (FBorderD.height=0))then
begin
FBorderL.Width:=FBorderSubstance.Width;
FBorderL.Height:=FBorderSubstance.Height;
FBorderL.PixelFormat:=pf24bit;
FBorderL.Canvas.Draw(0,0,FBorderSubstance);
FBorderD.Width:=FBorderSubstance.Width;
FBorderD.Height:=FBorderSubstance.Height;
FBorderD.PixelFormat:=pf24bit;
FBorderD.Canvas.Draw(0,0,FBorderSubstance);
Light24Bitmap(FBorderL,64);
Dark24Bitmap(FBorderD,64);
end;
Dx:=FGap;
if FInnerBorderStyle<>iablsNone then inc(dX,FInnerBorderDepth);
if FOuterBorderStyle<>iablsNone then inc(dX,FOuterBorderDepth);
FPaintBitmap.Width:=self.width;
FPaintBitmap.height:=self.height;
if FLedOn then k:=2 else k:=1;
if (FLedPlasticSubstance=nil) or (FLedPlasticSubstance.Height=0) then
begin
Color1:=ColortoRGB(FledPlasticColor);
pR:=@Color1;
pG:=pbyte(integer(pr)+1);
pB:=pbyte(integer(pG)+1);
for i:=0 to FPaintBitmap.height-1 do
begin
pByte1:=FPaintBitmap.ScanLine[i];
for j:=0 to FPaintBitmap.Width-1 do
begin
try
dd:=(FLedPlasticDepth/20)*min(FPaintBitmap.width/2-dx,FPaintBitmap.height/2-dx);
x:=j-dx-dd;y:=i-dx-dd;
w:=FPaintBitmap.width/2-dx-dd;
h:=FPaintBitmap.height/2-dx-dd;
N:=round(255-127*(abs(y-h)+abs(x-w))/(w+h));
except
N:=0;
end;
N:=N+(15-random(3*FLedPlasticDepth));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -