Registriert seit: 3. Jan 2007
Ort: Dresden
1 Beiträge
|
Polygone auf Graphics32 Layer
18. Feb 2011, 03:17
Hi. Könnt Ihr mal draufschaun, warum hier das kreissegment nicht sichtbar wird?
danke, lenny
Delphi-Quellcode:
var
x, y, i, r, a, aStrt, aEnd, xm, ym: integer;
f,ff:extended; // f kann in create-routine der form ausgelagert
werden
Points: array of TPoint;
ImgX,ImgY:integer;
btmpLayer:TBitmapLayer;
Lctn: TFloatRect;
begin
Image32_1.BeginUpdate;
btmpLayer:=TBitmapLayer.Create(Image32_1.Layers);
ImgX:=513;
ImgY:=513;
aStrt:=0;
aEnd:=30;
xm:=256;
ym:=256;
r:=256;
r:=230;
a := (aEnd - aStrt);
with Image32_1 do
begin
Width := ImgX; //0-255 | 257-512// 0-254 y,x -->
Height := ImgY; //---------------// | |
// //0-255 | 257-512//256-511 \/
Bitmap.Width:=Image32_1.Width;
Bitmap.Height:=Image32_1.Height;
Lctn.Left:=0;
Lctn.Right:=(Image32_1.Width);
Lctn.Bottom:=(Image32_1.Height);
Lctn.Top:=0;
btmpLayer.Location:=Lctn;
end;
with TPolygon32.create do
begin
Add(fixedpoint(xm,ym));
f:=(2 * pi / 360);
for i := 1 to a do
begin
ff:=((aStrt + (i - 1)) * f);
x:=(xm + round(r * cos(ff)));
y:=(ym - round(r * sin(ff)));
Add(fixedpoint(x,y));
end;
DrawFill(btmpLayer.Bitmap,clred32);
free;
end;
Image32_1.EndUpdate;
Image32_1.Changed;
Image32_1.Layers[0].BringToFront;
Image32_1.Refresh;
end;
|
|
Zitat
|