Картинка в четырёхугольнике
Add(Label,5079206,567,98)
{
Left=55
Top=5
Width=55
Height=17
Caption="Исходный"
}
Add(MainForm,9551264,602,56)
{
Width=798
Height=551
Caption="Деформация"
BorderStyle=1
Position=1
link(onCreate,13822067:doEvent1,[])
}
Add(ChildPanel,5175251,686,112)
{
link(onEvent1,2572868:doLoad,[])
link(onEvent2,22670:doLoad,[(725,125)(725,167)])
}
BEGIN_SDK
Add(EditMulti,12533179,14,7)
{
EventCount=2
WorkCount=2
VarCount=1
Width=797
Height=263
link(doWork1,70937:doEvent1,[])
link(doWork2,8907202:doEvent1,[(46,20)(46,41)])
link(Var1,600467:Var1,[(20,165)])
}
Add(Panel,5118939,231,35)
{
Left=170
Width=620
Height=515
WinStyle=1
BorderStyle=1
}
Add(PaintBox,12791373,91,77)
{
Left=2
Top=2
Width=620
Height=515
Color=16777215
WinStyle=1
Point(Width)
Point(Height)
link(onBeforeDraw,7015858:doDraw,[(130,83)(130,118)(116,118)(116,181)])
}
Add(ChildPanelEx,3277863,371,98)
{
Mode=1
link(onTop,14372150:doEvent1,[])
link(onMouseUp,5824829:doEvent1,[(411,111)(411,146)])
link(wb,5034828:Var2,[])
}
BEGIN_SDK
Add(EditMultiEx,12902457,203,133)
{
WorkCount=#5:##add|0:|
EventCount=#5:onTop|9:onMouseUp|
VarCount=#12:##eventIndex|
DataCount=#2:wb|
Width=335
Height=165
Point(##add)
Point(##eventIndex)
link(##add,5772976:doRead,[(217,139)(217,209)])
}
Add(Panel,9084549,364,196)
{
Left=15
Top=10
Width=7
Height=7
Color=255
TabOrder=-1
Ctl3D=0
BevelOuter=2
Point(Handle)
Point(doLeft)
Point(doTop)
Point(Left)
Point(Top)
Point(onMouseDown)
Point(onMove)
Point(doSetFocus)
Point(onMouseMove)
link(onMouseDown,5699333:doMove,[(408,209)(408,185)(352,185)(352,153)])
link(onMove,11836548:doData,[])
link(onMouseMove,12785750:doEvent,[])
}
Add(MoveWindow,5699333,364,147)
{
link(Handle,9084549:Handle,[(370,138)(349,138)(349,236)(370,236)])
}
Add(PointXY,1383579,371,238)
{
link(X,9084549:Left,[])
link(Y,9084549:Top,[])
}
Add(ArrayRW,5772976,231,203)
{
link(onRead,11487859:doEvent1,[])
link(Array,12902457:wb,[(237,186)(209,186)])
}
Add(Math,12692509,301,203)
{
OpType=4
Op2=65535
ResultType=0
link(onResult,9084549:doLeft,[])
}
Add(Hub,11487859,273,203)
{
link(onEvent1,12692509:doOperation,[])
link(onEvent2,6195675:doOperation,[])
}
Add(Math,6195675,301,210)
{
OpType=7
Op2=65536
ResultType=0
link(onResult,9084549:doTop,[])
}
Add(IndexToChanel,12785750,469,217)
{
Count=1
link(onEvent1,12902457:onMouseUp,[(519,223)(519,146)])
}
Add(DoData,11836548,427,210)
{
link(onEventData,12902457:onTop,[(508,216)(508,139)])
link(Data,1383579:Point,[(433,201)(419,201)(419,278)(377,278)])
}
END_SDK
Add(For,9732909,308,98)
{
End=3
link(onEvent,3277863:##add,[])
link(onStop,10257296:doWork1,[(361,111)])
}
Add(InlineCode,7993286,238,217)
{
WorkPoints=#7:doDefor|
EventPoints=#10:onEventBmp|
DataPoints=#6:BmpSrc|6:BmpDst|6:dArray|
Code=#0:|15:unit HiAsmUnit;|0:|9:interface|0:|31:uses kol,Share,Debug{,Windows};|0:|4:type|28: THiAsmClass = class(TDebug)|11: private |22: FItem,eIndex:TData;|20: src,dst :PBitmap;|33: u, v: array [0..3] of integer;|9: public|15:{ Data Points }|47:BmpSrc, BmpDst, dArray, onEventBmp : THI_Event;|0:|15:{ Work Points }|48:Procedure doDefor (var _Data:TData; Index:word);|0:|5: end;|0:|14:implementation|15:{ Work Points }|31:Procedure THiAsmClass.doDefor;|4:type|29: PMultArray = ^TMultArray;|40: TMultArray = array[0..0] of integer;|4:var |34: a1,a2,b1,b2,c1,c2,d1,d2,z:real;|29: i,j,x,y,i2,j2,h,w:integer;|20: p1,p2:PMultArray;|14: Arr:PArray;|5:begin|27: Arr := ReadArray(dArray);|23: if Arr=nil then exit;|18: for i:=0 to 3 do|11: begin|32: dtInteger(eIndex, i);|35: Arr._Get(eIndex, FItem);|47: u[i] := ToInteger(FItem) and $FFFF; |43: v[i] := ToInteger(FItem) shr 16;|15: end; |2: |38: src := ReadBitmap(_Data,BmpSrc,nil);|38: dst := ReadBitmap(_Data,BmpDst,nil);|30: //dst := NewBitmap(620,512);|42: if (src = nil) or (src.Empty) then exit;|27: dst.PixelFormat:=pf32bit;|27: src.PixelFormat:=pf32bit;|2: |32: i2:=src.Width; j2:=src.Height;|30: h:=dst.Height; w:=dst.Width;|2: |11: z:=i2*j2;|39: d1:=u[0]; d2:=v[0];|47: a1:=(u[1]-d1)/i2; a2:=(v[1]-d2)/i2;|47: c1:=(u[3]-d1)/j2; c2:=(v[3]-d2)/j2;|56: b1:=(u[2]-u[3]-u[1]+d1)/z; b2:=(v[2]-v[3]-v[1]+d2)/z;|2: |73: p2:=dst.ScanLine[h]; //Через указатели|21: for y:=0 to j2-1 do|9: begin|75: p1:=src.ScanLine[y]; //Через указатели|23: for x:=0 to i2-1 do|11: begin|39: i:=trunc(a1*x+b1*x*y+c1*y+d1); |38: j:=trunc(a2*x+b2*x*y+c2*y+d2);|75: p2[(h-j)*w+i]:=p1[x]; //Через указатели|73: //dst.canvas.pixels[i,j]:=src.canvas.pixels[x,y]; //Через Pixels|10: end;|8: end;|32: _hi_OnEvent(onEventBmp,dst);|4:end;|0:|4:end.|
link(onEventBmp,12087286:doEvent1,[(557,223)(557,104)])
link(BmpSrc,600467:Var3,[(244,165)])
link(BmpDst,6258751:Var2,[])
link(dArray,5573916:getVar,[])
}
Add(For,15097577,371,175)
{
End=3
link(onEvent,279093:doWork1,[])
}
Add(Bitmap,1893649,245,98)
{
@Hint=#5:Буфер|
HWidth=620
HHeight=515
FillColor=-16777201
Point(doCreate)
Point(HWidth)
Point(HHeight)
}
Add(Img_Bmp,7015858,126,175)
{
link(onDraw,10257296:doWork2,[])
link(Bitmap,15365913:Var3,[(132,124)])
link(SourceBitmap,6258751:Var1,[(139,152)])
}
Add(LineBreakEx,15115925,56,140)
{
Caption="bmp"
Type=3
link(_Data,15365913:Var1,[(62,124)])
}
Add(GetDataEx,15365913,91,119)
{
link(Data,12791373:Bitmap,[])
}
Add(LineBreakEx,2833138,511,147)
{
Caption="bmp"
Type=2
}
Add(LineBreakEx,14324866,28,77)
{
Caption="refr"
Type=1
link(OnEvent,15077390:doWork2,[])
}
Add(LineBreakEx,4473850,455,126)
{
Caption="refr"
}
Add(ArrayRW,9578601,455,91)
{
Index=Integer(0)
link(Array,8844056:Var2,[])
link(Index,3277863:##eventIndex,[(468,80)(500,80)(500,162)(377,162)])
}
Add(MultiElement,279093,511,175)
{
link(Data1,2833138:getVar,[])
link(Data2,8844056:Var3,[(524,68)])
}
BEGIN_SDK
Add(EditMulti,2885264,259,84)
{
WorkCount=1
DataCount=2
Width=181
Height=172
link(doWork1,6508886:doEvent1,[(244,90)(244,146)])
}
Add(Img_Line,5085825,322,203)
{
Color=255
Point(Point1)
Point(Point2)
link(Bitmap,2885264:Data1,[(328,187)(265,187)])
link(Point1,14654656:Result,[])
link(Point2,1616886:Result,[(342,187)(384,187)])
}
Add(MathParse,14654656,329,140)
{
MathStr="%2[%1]"
ResultType=0
link(X2,1434546:Var2,[])
}
Add(MathParse,1616886,378,140)
{
MathStr="%2[(%1+1) mod 4]"
ResultType=0
link(X2,1434546:Var3,[(391,112)])
}
Add(Hub,6508886,287,140)
{
OutCount=3
link(onEvent1,14654656:doCalc,[])
link(onEvent2,1616886:doCalc,[(369,153)(369,146)])
link(onEvent3,5085825:doDraw,[(311,160)(311,209)])
}
Add(GetDataEx,1434546,336,107)
{
Angle=3
link(Data,2885264:Data2,[(272,112)])
}
END_SDK
Add(Hub,14372150,420,98)
{
link(onEvent1,9578601:doWrite,[])
link(onEvent2,11042403:doWork1,[(444,111)])
}
Add(Hub,70937,56,7)
{
link(onEvent1,9732909:doFor,[(70,13)(286,13)(286,104)])
link(onEvent2,14913336:doWork1,[(165,20)])
}
Add(IntegerArray,15066555,371,21)
{
@Hint=#1:u|
IntArray=['0'=327990,'0'=17695330,'0'=32768310,'0'=16384155]
}
Add(GetDataEx,5034828,371,63)
{
link(Data,15066555:Array,[])
}
Add(GetDataEx,8844056,455,63)
{
Angle=3
link(Data,5034828:Var3,[])
}
Add(Bitmap,4806727,189,35)
{
@Hint=#5:Буфер|
FillColor=-16777201
Point(Width)
Point(Height)
}
Add(GetDataEx,6258751,245,147)
{
link(Data,1893649:Bitmap,[])
}
Add(Hub,15784955,189,210)
{
InCount=2
link(onEvent1,1893649:doCreate,[(214,216)(214,118)])
link(onEvent2,7993286:doDefor,[])
}
Add(LineBreak,13405621,112,217)
{
Caption="up"
link(Out,15784955:doEvent2,[])
Primary=[14031383,343,-77]
}
Add(Hub,5824829,420,140)
{
link(onEvent1,14031383:In,[])
link(onEvent2,11042403:doWork3,[(444,153)])
}
Add(HubEx,11042403,440,126)
{
link(onEvent,4473850:doWork,[])
}
Add(GetDataEx,600467,189,160)
{
link(Data,4806727:Bitmap,[])
}
Add(InfoTip,7747766,588,280)
{
Info=#15:Взято из книги:|0:|8:Delphi 5|34:Создание мультимедийных приложений|0:|9:Н.Тюкачев|10:Ю.Свиридов|0:|21:Издательство "Нолидж"|6:Москва|5:2000 |
Font=[MS Sans Serif,8,0,16711680,1]
Transparent=1
Width=225
Height=165
Margin=10
}
Add(Hub,8907202,56,35)
{
OutCount=4
link(onEvent1,4806727:doLoad,[])
link(onEvent2,12533179:onEvent1,[(95,48)(95,27)(291,27)(291,13)])
link(onEvent3,15077390:doWork1,[(81,55)])
link(onEvent4,14913336:doWork2,[])
}
Add(HubEx,15077390,77,77)
{
link(onEvent,12791373:doRefresh,[])
}
Add(HubEx,10257296,357,175)
{
link(onEvent,15097577:doFor,[])
}
Add(LineBreakEx,969702,308,77)
{
Caption="arr"
Type=3
link(_Data,5034828:Var1,[(314,68)])
}
Add(LineBreakEx,5573916,252,189)
{
Caption="arr"
Type=2
}
Add(HubEx,14913336,161,56)
{
Angle=1
link(onEvent,15784955:doEvent1,[(165,216)])
}
Add(Hub,12087286,567,98)
{
link(onEvent1,10700511:doCalc,[])
link(onEvent2,13840374:doCopy,[(592,111)(592,174)])
}
Add(MathParse,10700511,609,98)
{
@Hint=#5:min x|
DataCount=1
MathStr="min(\r\n(%1[0] mod 65536),\r\n(%1[1] mod 65536),\r\n(%1[2] mod 65536),\r\n(%1[3] mod 65536)\r\n)"
link(onResult,8573504:doCalc,[])
link(X1,6216964:Var2,[])
}
Add(MathParse,13536548,707,98)
{
@Hint=#5:max x|
MathStr="max((%1[0] mod 65536),(%1[1] mod 65536),(%1[2] mod 65536),(%1[3] mod 65536))-%2"
link(onResult,13543022:doCalc,[])
link(X1,4016801:Var2,[])
link(X2,9499964:Var3,[(720,89)(699,89)(699,138)])
}
Add(MathParse,8573504,658,98)
{
@Hint=#5:min y|
DataCount=1
MathStr="min(\r\n(%1[0] div 65536),\r\n(%1[1] div 65536),\r\n(%1[2] div 65536),\r\n(%1[3] div 65536)\r\n)"
link(onResult,13536548:doCalc,[])
link(X1,6258061:Var2,[])
}
Add(MathParse,13543022,756,98)
{
@Hint=#5:max y|
MathStr="max(\r\n(%1[0] div 65536),\r\n(%1[1] div 65536),\r\n(%1[2] div 65536),\r\n(%1[3] div 65536)\r\n)-%2"
link(X1,4016801:Var3,[(762,82)])
link(X2,10938285:Var3,[(769,89)(748,89)(748,145)])
}
Add(LineBreakEx,8831110,609,56)
{
Caption="arr"
Type=2
}
Add(GetDataEx,6216964,609,77)
{
link(Data,8831110:getVar,[])
}
Add(GetDataEx,6258061,658,77)
{
Angle=3
link(Data,6216964:Var3,[])
}
Add(GetDataEx,4016801,707,77)
{
Angle=3
link(Data,6258061:Var3,[])
}
Add(Img_Copy,13840374,602,168)
{
Point(Width)
Point(Height)
link(onCopy,12533179:onEvent2,[(795,174)(795,20)])
link(X,9499964:Var2,[])
link(Y,10938285:Var1,[(622,145)])
link(Width,13536548:Result,[(629,152)(713,152)])
link(Height,13543022:Result,[(636,159)(762,159)])
}
Add(GetDataEx,9499964,609,133)
{
link(Data,10700511:Result,[])
}
Add(GetDataEx,10938285,658,140)
{
link(Data,8573504:Result,[])
}
Add(InfoTip,8161412,560,35)
{
Info=#26:Копирование только нужного|
Width=246
Height=193
}
END_SDK
Add(Image,2572868,749,112)
{
Left=5
Top=30
Width=160
Height=160
Ctl3D=0
link(Bitmap,5175251:Var1,[(755,100)(742,100)(742,156)(692,156)])
}
Add(Image,22670,749,161)
{
Left=5
Top=220
Width=160
Height=160
Ctl3D=0
}
Add(Button,9598790,434,140)
{
Left=20
Top=395
Width=110
Caption="Load picture"
link(onClick,6865173:doEvent1,[])
}
Add(Img_Loader,1673702,567,140)
{
link(onLoad,6029042:doWork2,[])
}
Add(ODialog,10745261,525,140)
{
Filter="Pictures|*.bmp;*.png;*.jpg;*.jpeg;*.gif;*.ico"
FileName=""
link(onExecute,1673702:doLoad,[])
}
Add(Resize,14405595,623,140)
{
Width=620
Height=515
link(onResult,5175251:doWork2,[(672,146)(672,125)])
}
Add(Label,8753854,525,98)
{
Left=55
Top=200
Width=56
Height=17
Caption="Результат"
}
Add(Button,2711093,161,245)
{
Left=20
Top=485
Width=110
Caption="Load source"
link(onClick,6975981:doWork2,[])
}
Add(StrList,5246062,427,217)
{
}
Add(Application,14021022,224,203)
{
}
Add(MultiStrPart,2286488,224,245)
{
Char="."
Count=1
Direct=1
link(onSplit,7560079:doStrCat,[])
link(Str,14021022:AppFileName,[])
}
Add(StrCat,7560079,273,245)
{
Str2=".sha"
link(onStrCat,16045027:doEvent1,[])
}
Add(Img_MultiText,7062782,483,329)
{
X=3
Font=[MS Sans Serif,10,1,8388608,1]
Orientation=[MS Sans Serif,10,1,8388608,1]
link(onDraw,15241736:doData,[])
link(Bitmap,9770793:Var2,[])
link(Text,5246062:Text,[(496,306)(433,306)])
}
Add(Hub,16045027,343,245)
{
link(onEvent1,5246062:doLoad,[])
link(onEvent2,10304141:doOperation,[(382,258)(382,300)(235,300)(235,328)])
}
Add(Bitmap,14930578,483,245)
{
HWidth=300
HHeight=200
FillColor=-16777201
Point(doCreate)
Point(onCreate)
}
Add(Math,10304141,245,322)
{
OpType=1
link(onResult,12887285:doEvent1,[])
link(Op2,7062782:TextHeight,[(258,306)(230,306)(230,369)(496,369)])
}
Add(CounterEx,11545751,427,329)
{
Max=115
Direct=1
Default=115
Point(doMin)
link(onNext,7062782:doDraw,[])
}
Add(Timer,8509903,329,322)
{
Interval=100
Enable=1
link(onTimer,10668883:doEvent1,[])
}
Add(Hub,10668883,371,322)
{
link(onEvent1,14930578:doCreate,[(396,328)(396,314)(466,314)(466,265)])
link(onEvent2,11545751:doNext,[])
}
Add(Hub,12887285,287,322)
{
link(onEvent1,8509903:doTimer,[])
link(onEvent2,11545751:doMin,[(312,335)(312,363)(389,363)(389,342)])
}
Add(HubEx,6029042,609,140)
{
link(onEvent,14405595:doResize,[])
}
Add(DoData,15241736,532,329)
{
link(onEventData,6029042:doWork3,[(613,335)])
link(Data,9770793:Var3,[(538,292)])
}
Add(GetDataEx,9770793,483,287)
{
link(Data,14930578:Bitmap,[])
}
Add(Hub,6865173,490,140)
{
link(onEvent1,10745261:doExecute,[])
link(onEvent2,8509903:doStop,[(515,153)(515,209)(319,209)(319,335)])
}
Add(Hub,13822067,644,70)
{
link(onEvent1,6975981:doWork1,[(669,76)(669,48)(207,48)])
link(onEvent2,5175251:doWork1,[(676,83)(676,118)])
}
Add(HubEx,6975981,203,245)
{
link(onEvent,2286488:doSplit,[])
}