Add(MainForm,4385834,189,252) { Width=509 Height=561 link(onCreate,6853777:doPosition,[(243,272)(243,265)]) } Add(Image,6630188,371,203) { Width=500 Height=500 Point(doRefresh) } Add(InlineCode,9782682,371,252) { WorkPoints=#6:doDraw|10:doGenerate| DataPoints=#6:Bitmap|5:Count| Code=#15:unit HiAsmUnit;|0:|9:interface|0:|21:uses kol,Share,Debug;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|0:|9: public|28: Bitmap,Count:THI_Event;|5: |24: constructor Create;|5: |51: procedure doDraw(var _Data:TData; Index:word);|55: procedure doGenerate(var _Data:TData; Index:word);|5: end;|0:|14:implementation|0:|40:var pts:array of array[0..1] of integer;|19:const CENTER = 250;|0:|31:constructor THiAsmClass.Create;|14:const cn = 12;|14:var i:integer;|11: a:real;|5:begin|20: SetLength(pts,cn);|17: a := 6.28 / cn;|31: for i := 0 to cn - 1 do begin|56: pts[i,1] := round(sin(a + i * a) * CENTER + CENTER);|56: pts[i,0] := round(cos(a + i * a) * CENTER + CENTER);|6: end;|4:end;|0:|29:procedure THiAsmClass.doDraw;|15:var bt:PBitmap;|16: i,j:integer;|6:{const|48: pts:array[0..11] of array[0..1] of integer = (|9: (75,0),|10: (125,0),|11: (175,25),|11: (200,75),|12: (200,125),|12: (175,175),|12: (125,200),|11: (75,200),|11: (25,175),|10: (0,125),|9: (0,75),|9: (25,25)|5: );}|5:begin|33: bt := ReadBitmap(_Data,Bitmap);|18: bt.width := 500;|19: bt.height := 500;|47: with bt.Canvas{$ifndef F_P}^{$endif} do begin|25: Pen.Color := clWhite;|22: Pen.PenWidth := 1;|27: Brush.Color := clWhite;|27: Rectangle(0,0,500,500);|25: Pen.Color := clBlack;|27: Brush.Color := clBlack;|4: |36: for i := 0 to high(pts) do begin|56: for j := i+1 to high(pts) do {if i > j then} begin|34: MoveTo(pts[i,0],pts[i,1]);|34: LineTo(pts[j,0],pts[j,1]);|10: end;|8: end;|6: end;|4:end;|0:|33:procedure THiAsmClass.doGenerate;|15:var cn:integer;|14: i:integer;|11: a:real;|5:begin|35: cn := ReadInteger(_Data,Count,3);|22: if cn < 1 then Exit;|20: SetLength(pts,cn);|17: a := 6.28 / cn;|31: for i := 0 to cn - 1 do begin|56: pts[i,1] := round(sin(a + i * a) * CENTER + CENTER);|56: pts[i,0] := round(cos(a + i * a) * CENTER + CENTER);|6: end;|21:// doDraw(_Data,0); |4:end;|0:|4:end.| link(Bitmap,6630188:ImageBitmap,[]) link(Count,6853777:Position,[(384,240)(412,240)(412,306)(272,306)]) } Add(Hub,8423733,336,210) { link(onEvent1,9782682:doDraw,[(360,216)(360,258)]) link(onEvent2,6630188:doRefresh,[]) } Add(Hub,6063414,315,259) { link(onEvent1,9782682:doGenerate,[]) link(onEvent2,8423733:doEvent1,[(355,272)(355,246)(319,246)(319,216)]) } Add(TrackBar,6853777,266,259) { Left=75 Top=500 Max=100 Min=1 Position=1 link(onPosition,6063414:doEvent1,[]) }