Hallo, guten Tag.
Jetzt habe ich es geschafft, die PlgBlt in XPIA-ASM umzusetzen.
Es funktioniert. Hab jetzt einiges mit den Fließcommazahlen gelernt.
BMP-Bild hat 64x64 Pixel.
Gruss
Code
' Quellpunkte: AP(0) x--------x AP(1)
' | |
' | |
' ---------
' AP(2) x x [AP(3)] wird automatisch berechent
$MAKE CLE
$H Windows.ph
declare bpic&, bpic1&,bpicbmp&,ende&,hintergrpic&,vordergrpic&,hDCBits&
declare x1!,y1!,dx!,dy!,pts&
Declare xc!,yc!,wh!,winkel!,pi180!,dws!
dim pts&,24
Pi180!=0.0174532925199433
dws!=1.0
wh!=100/dws!
xc!=50/dws!
yc!=50/dws!
ende&=1
bpic& = create("hPic",-1,"d:/freeprofan/test-xpia/data/auto.bmp")
if 0
AsmStart rotateplg(xc&,yc&,wh&,winkel&,pts&)
.data
pi180 dq 0.0174532925199433
xc dq 0.0
yc dq 0,0
wh dq 0.0
winkel dq 0.0
z1 dq 0.0
z2 dq 0.0
pts0 dd 0
pts4 dd 0
pts8 dd 0
pts12 dd 0
pts16 dd 0
pts20 dd 0
.code
finit
mov edx, para1
fld qword ptr [edx]
fst xc
mov edx, para2
fld qword ptr [edx]
fst yc
mov edx, para3
fld qword ptr [edx]
fst wh
mov edx, para4
fld qword ptr [edx]
fst winkel
'pts&,0=xc!+(0-xc!)*Cos(Pi180!*winkel!) -(0-yc!)*Sin(Pi180!*winkel!)
finit
fldz
fsub xc
fst z1
fld pi180
fmul winkel
fcos
fmul z1
fst z1
fldz
fsub yc
fst z2
fld pi180
fmul winkel
fsin
fmul z2
fst z2
fld xc
fadd z1
fsub z2
fist pts0
'pts&,4=yc!+(0-xc!)*Sin(Pi180!*winkel!)+(0-yc!)*Cos(Pi180!*winkel!)
finit
fldz
fsub xc
fst z1
fld pi180
fmul winkel
fsin
fmul z1
fst z1
fldz
fsub yc
fst z2
fld pi180
fmul winkel
fcos
fmul z2
fst z2
fld yc
fadd z1
fadd z2
fist pts4
'pts&,8=xc!+(wh!-xc!)*Cos(Pi180!*winkel!)-(0-yc!)*Sin(Pi180!*winkel!)
finit
fld wh
fsub xc
fst z1
fld pi180
fmul winkel
fcos
fmul z1
fst z1
fldz
fsub yc
fst z2
fld pi180
fmul winkel
fsin
fmul z2
fst z2
fld xc
fadd z1
fsub z2
fist pts8
'pts&,12=yc!+(wh!-xc!)*Sin(Pi180!*winkel!)+(0-yc!)*Cos(Pi180!*winkel!)
finit
fld wh
fsub xc
fst z1
fld pi180
fmul winkel
fsin
fmul z1
fst z1
fldz
fsub yc
fst z2
fld pi180
fmul winkel
fcos
fmul z2
fst z2
fld yc
fadd z1
fadd z2
fist pts12
'pts&,16=xc!+(0-xc!)*Cos(Pi180!*winkel!)-(wh!-yc!)*Sin(Pi180!*winkel!)
finit
fldz
fsub xc
fst z1
fld pi180
fmul winkel
fcos
fmul z1
fst z1
fld wh
fsub yc
fst z2
fld pi180
fmul winkel
fsin
fmul z2
fst z2
fld xc
fadd z1
fsub z2
fist pts16
'pts&,20=yc!+(0-xc!)*Sin(Pi180!*winkel!)+(wh!-yc!)*Cos(Pi180!*winkel!)
finit
fldz
fsub xc
fst z1
fld pi180
fmul winkel
fsin
fmul z1
fst z1
fld wh
fsub yc
fst z2
fld pi180
fmul winkel
fcos
fmul z2
fst z2
fld yc
fadd z1
fadd z2
fist pts20
'--------------------------------
mov ebx,para5
Mov eax,pts0
Mov [ebx+0],eax
Mov eax,pts4
Mov [ebx+4],eax
Mov eax,pts8
Mov [ebx+8],eax
Mov eax,pts12
Mov [ebx+12],eax
Mov eax,pts16
Mov [ebx+16],eax
Mov eax,pts20
Mov [ebx+20],eax
AsmEnd
endif
Window 20,20-800,600
Cls RGB(220,220,220)
bpicbmp& = create("hNewPic", 100,100,rgb(255,0,255))
bpic1& = create("hNewPic", 100,100,rgb(255,0,255))
hintergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
vordergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
startpaint bpicbmp&
drawpic bpic&,18,18;-1,$ff00ff
EndPaint
startpaint hintergrpic&
UsePen 0,1,Rgb(0,128,255)
usebrush 1,rgb(0,128,255)
ellipse 200,200-250,250
endpaint
dx!=60
dy!=60
startpaint bpic1&
drawhPicRotated
endpaint
zeichne
WHILE ende&
if isKey(83)
y1!=Sin(winkel!*Pi180!)*0.2
x1!=Cos(winkel!*Pi180!)*0.2
dx!=dx!-x1!
dy!=dy!-y1!
zeichne
endif
if isKey(87)
y1!=Sin(winkel!*Pi180!)*0.2
x1!=Cos(winkel!*Pi180!)*0.2
dx!=dx!+x1!
dy!=dy!+y1!
zeichne
endif
if isKey(81)
winkel!=winkel!-0.5
startpaint bpic1&
drawhPicRotated
EndPaint
zeichne
endif
if isKey(69)
winkel!=winkel!+0.5
startpaint bpic1&
drawhPicRotated
EndPaint
zeichne
EndIf
EndWhile
end
Proc zeichne
startpaint vordergrpic&
drawpic hintergrpic&,0,0;0
drawpic bpic1&,dx!,dy!;-1,$ff00ff
EndPaint
drawpic vordergrpic&,10,10;0
EndProc
Proc drawhPicRotated
hDCBits&=~createCompatibleDC(%hDC)
~selectObject(hDCBits&, bpicbmp&)
Call(GetXpiaProcAddress(XpiaModule&,"rotateplg"),Addr(xc!),Addr(yc!),Addr(wh!),Addr(winkel!),pts&)
~plgBlt(%hdc,pts&,hDCBits&,0,0,100,100,0,0,0)
~deleteDC(hDCBits&)
endproc
Alles anzeigen