Forum | | | | funkheld | Hello, glad Easter. I need Please once Help for turn Comparison txt.
i want The turned graphic here mere bring: bpic1& = create("hNewPic", 128,128,rgb(0,0,0)) and not whom screen .
How are the ?
Thank you.
greeting
declare bpic&,ende&,hWin&,winkel&,hDCWin&
ende&=1
bpic& = create("HPIC",-1,"auto.bmp")
Window 20,20-400,400
Cls RGB(220,220,220)
hWin& = @Create("text", %hWnd, "", 10,10, 300,300)
hDCWin& = ~GetDC(hWin&)
WHILE ende&
if isKey(81)
winkel&=winkel&-100
cls
drawhPicRotated(bpic&,hDCWin&,100,100,128,128,winkel&,50)
endif
if isKey(69)
winkel&=winkel&+100
cls
drawhPicRotated(bpic&,hDCWin&,100,100,128,128,winkel&,50)
endif
ENDWHILE
end
nProc getCircP(long r,w)
return long(sin(0.0174532925199433*float(w)/1000.0)*float(r))
endproc
nProc angleByLine(long x,y,xx,yy)
sub y,yy
sub x,xx
if x
xx=int(57295.77951 * arctan(float(y)/float(x)))
case x>0 : return 270000 + xx
return 90000 + xx
endif
case y<0 : return 180000
return 0
endproc
nProc drawhPicRotated(long hPic,dc,x,y,xx,yy,w,r)
long hDCBits=createCompatibleDC(hDC)
selectObject(hDCBits, hPic)
long pts=dim(24)
long w1=angleByLine(xx,yy,0,0),w2=abs(w1-360000),w3=abs(w1-540000)
casenot r : r=long(sqrt(float(xx*xx+yy*yy)))\2
long pts&,0=x+getcircp(r,w1+w),y+getcircp(r,w1-90000+w),x+getcircp(r,w2+w),y+getcircp(r,w2-90000+w),x+getcircp(r,w3+w),y+getcircp(r,w3-90000+w)
plgBlt(dc,pts,hDCBits,0,0,xx,yy,0,0,0)
deleteDC(hDCBits)
dispose(pts)
endproc
|
| | | | |
| | | If one a ploy uses the %hDC to StartPaint on one hPic whom DC the "hPics" zurückgibt then so:
{$cleq}
{$compiler c:\XProfan11\}
{$runtime c:\XProfan11\}
declare bpic&,ende&,winkel&
ende&=1
bpic& = create("HPIC",-1,"c:\\car.bmp")
Window 20,20-400,400
Cls RGB(220,220,220)
var bpic1& = create("hNewPic", 128,128,rgb(0,0,0))
WHILE ende&
waitinput 10
startpaint bpic1&
drawhPicRotated(bpic&,hDC,64,64,128,128,winkel&,50)
endpaint
drawpic bpic1&,0,0;0
winkel&=rnd(360000)
ENDWHILE
end
nProc getCircP(long r,w)
return long(sin(0.0174532925199433*float(w)/1000.0)*float(r))
endproc
nProc angleByLine(long x,y,xx,yy)
sub y,yy
sub x,xx
if x
xx=int(57295.77951 * arctan(float(y)/float(x)))
case x>0 : return 270000 + xx
return 90000 + xx
endif
case y<0 : return 180000
return 0
endproc
nProc drawhPicRotated(long hPic,dc,x,y,xx,yy,w,r)
long hDCBits=createCompatibleDC(hDC)
selectObject(hDCBits, hPic)
long pts=dim(24)
long w1=angleByLine(xx,yy,0,0),w2=abs(w1-360000),w3=abs(w1-540000)
casenot r : r=long(sqrt(float(xx*xx+yy*yy)))\2
long pts&,0=x+getcircp(r,w1+w),y+getcircp(r,w1-90000+w),x+getcircp(r,w2+w),y+getcircp(r,w2-90000+w),x+getcircp(r,w3+w),y+getcircp(r,w3-90000+w)
plgBlt(dc,pts,hDCBits,0,0,xx,yy,0,0,0)
deleteDC(hDCBits)
dispose(pts)
endproc
|
| | | | |
| | funkheld | Jup, thanks. this is class.
greeting |
| | | | |
| | funkheld | Jup, it works wonderful these Native nProc drawhPicRotated(long hPic,dc,x,y,xx,yy,w,r) with XPSE The You erstellst have.
with the Keys Q/E can one Sprite rotate and whom Keys W/s can it moving.
In wieweit go under The routines of XPSE speed?
How can with the routine nProc drawhPicRotated a turn make circa a verlegten Rotate-XY-point? now turn it itself Yes always around the Mittelpunkt.
with the variables "r" in the nProc have I now The size tuned of Sprite. but i'm not yet clear, whether it something with the Grössenveränderung To do has? so integrally have whom Context moreover not understood.
Thank you.
greeting
{$cleq}
{$compiler d:\XProfan11\}
{$runtime d:\XProfan11\}
declare bpic&, bpic1&,ende&,winkel!,hintergrpic&,vordergrpic&
declare x1!,y1!,dx!,dy!
ende&=1
bpic& = create("HPIC",-1,"data\\car.bmp")
Window 20,20-800,600
Cls RGB(220,220,220)
bpic1& = create("hNewPic", 64,64,rgb(0,0,0))
hintergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
vordergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
startpaint hintergrpic&
usebrush 1,rgb(0,128,255)
ellipsis 200,200-250,250
endpaint
WHILE ende&
if isKey(87)
y1!=Sin((winkel!/1000)/180.0*pi())*0.2
x1!=Cos((winkel!/1000)/180.0*pi())*0.2
dx!=dx!-x1!
dy!=dy!-y1!
endif
if isKey(83)
y1!=Sin((winkel!/1000)/180.0*pi())*0.2
x1!=Cos((winkel!/1000)/180.0*pi())*0.2
dx!=dx!+x1!
dy!=dy!+y1!
endif
if isKey(81)
winkel!=winkel!-500
startpaint bpic1&
drawhPicRotated(bpic&,hDC,32,32,128,128,winkel!,30)
endpaint
endif
if isKey(69)
winkel!=winkel!+500
startpaint bpic1&
drawhPicRotated(bpic&,hDC,32,32,128,128,winkel!,30)
endpaint
endif
startpaint vordergrpic&
drawpic hintergrpic&,0,0;0
drawpic bpic1&,100+dx!,100+dy!;-1
endpaint
drawpic vordergrpic&,10,10;0
ENDWHILE
end
nProc getCircP(long r,w)
return long(sin(0.0174532925199433*float(w)/1000.0)*float(r))
endproc
nProc angleByLine(long x,y,xx,yy)
sub y,yy
sub x,xx
if x
xx=int(57295.77951 * arctan(float(y)/float(x)))
case x>0 : return 270000 + xx
return 90000 + xx
endif
case y<0 : return 180000
return 0
endproc
nProc drawhPicRotated(long hPic,dc,x,y,xx,yy,w,r)
long hDCBits=createCompatibleDC(hDC)
selectObject(hDCBits, hPic)
long pts=dim(24)
long w1=angleByLine(xx,yy,0,0),w2=abs(w1-360000),w3=abs(w1-540000)
casenot r : r=long(sqrt(float(xx*xx+yy*yy)))\2
long pts&,0=x+getcircp(r,w1+w),y+getcircp(r,w1-90000+w),x+getcircp(r,w2+w),y+getcircp(r,w2-90000+w),x+getcircp(r,w3+w),y+getcircp(r,w3-90000+w)
plgBlt(dc,pts,hDCBits,0,0,xx,yy,0,0,0)
deleteDC(hDCBits)
dispose(pts)
endproc
|
| | | | |
| | | Hi!
funkheld (10.04.12)
Jup, it works wonderful these Native nProc drawhPicRotated(long hPic,dc,x,y,xx,yy,w,r) with XPSE The You erstellst have.
Yes, thanks!
funkheld (10.04.12)
In wieweit go under The routines of XPSE speed?
Dou you mean this here ( [...] ) ?
"NProc-functions go in Assembler transformed, circa Hooks, Subclassing,
Threads, Callbacks and all The items to program, with them it on
Threadsicherheit and high speed ankommt."
additionally go The Funktionsaufrufe of XPSE in direct Calls konvertiert -
these Funktionsaufrufe are imho The fastest at all.
funkheld (10.04.12)
How can with the routine nProc drawhPicRotated a turn make circa a verlegten Rotate-XY-point? now turn it itself Yes always around the Mittelpunkt.
these deliberate not The task this function there tappt im dunkeln otherwise circa some
Operationen larger (and so too less quick) would, The against
not always uses would. therefore turn these function always very circa
whom Mittelpunkt. therefore against but first can whom point around the
turned go should self to determine z.B. over 2 ways:
a) the image same so lay out the the Drehpunkt the right is z.B. through
Platzlassen or. Randhinzufügen
b) The Ausgabeposition (3. and 4. Parameter (x,y)) self to determine and displace
z.B. with the function getCircP.
funkheld (10.04.12)
with the variables "r" in the nProc have I now The size tuned of Sprite. but i'm not yet clear, whether it something with the Grössenveränderung To do has? so integrally have whom Context moreover not understood.
You can so whom radius or. The Ausgabegröße the turned Bildes
to determine and so is the function quasi too same drawhPicRotatedAndSized.
If you the value 0 commit then determined The function The Ausgabegröße
The for this Image normal would or. The "Originalgröße". |
| | | | |
| | | Mach still sooner so:
'URL: https://XProfan.com/intl/de/forum/Hello-if-turn-of/ one-graphic-with-xpse-not-on-whom-screen-native-nproc/#n
{$cleq}
{$compiler c:\XProfan11\}
{$runtime c:\XProfan11\}
declare bpic&, ende&,winkel!,hintergrpic&,vordergrpic&
declare x1!,y1!,dx!,dy!,spd!
ende&=1
bpic& = create("HPIC",-1,"data\\car.bmp")
Window 20,20-800,600
Cls RGB(220,220,220)
hintergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
vordergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
startpaint hintergrpic&
usebrush 1,rgb(0,128,255)
ellipsis 200,200-250,250
endpaint
dx!=100
dy!=100
spd!=1
WHILE ende&
sleep 16
if isKey(38)
spd!=spd!+0.1
endif
if isKey(40)
spd!=spd!-0.1
endif
if isKey(37)
winkel!=winkel!-5000
endif
if isKey(39)
winkel!=winkel!+5000
endif
y1!=Sin((winkel!/1000)/180.0*pi())*spd!
x1!=Cos((winkel!/1000)/180.0*pi())*spd!
dx!=dx!-x1!
dy!=dy!-y1!
startpaint vordergrpic&
drawpic hintergrpic&,0,0;0
drawhPicRotatedTransparent(bpic&,hDC,int(dx!)-getCircP(15,int(winkel!)+90000),int(dy!)+getCircP(15,int(-winkel!)),128,128,winkel!,30,0)
endpaint
drawpic vordergrpic&,10,10;0
ENDWHILE
end
nProc getCircP(long r,w)
return long(sin(0.0174532925199433*float(w)/1000.0)*float(r))
endproc
nProc angleByLine(long x,y,xx,yy)
sub y,yy
sub x,xx
if x
xx=int(57295.77951 * arctan(float(y)/float(x)))
case x>0 : return 270000 + xx
return 90000 + xx
endif
case y<0 : return 180000
return 0
endproc
nProc drawhPicRotated(long hPic,dc,x,y,xx,yy,w,r)
long hDCBits=createCompatibleDC(hDC)
selectObject(hDCBits, hPic)
long pts=dim(24)
long w1=angleByLine(xx,yy,0,0),w2=abs(w1-360000),w3=abs(w1-540000)
casenot r : r=long(sqrt(float(xx*xx+yy*yy)))\2
long pts&,0=x+getcircp(r,w1+w),y+getcircp(r,w1-90000+w),x+getcircp(r,w2+w),y+getcircp(r,w2-90000+w),x+getcircp(r,w3+w),y+getcircp(r,w3-90000+w)
plgBlt(dc,pts,hDCBits,0,0,xx,yy,0,0,0)
deleteDC(hDCBits)
dispose(pts)
endproc
nProc drawhPicRotatedTransparent(long hPic,dc,x,y,xx,yy,w,r,col){
long hDCBits=createCompatibleDC(hDC)
selectObject(hDCBits, hPic)
long pts=dim(24)
long w1=angleByLine(xx,yy,0,0),\
w2=abs(w1-360000),\
w3=abs(w1-540000)
casenot r : r=long(sqrt(float(xx*xx+yy*yy)))\2
long r2=r*2
long pts&,0= r+getcircp(r,w1+w),r+getcircp(r,w1-90000+w),\
r+getcircp(r,w2+w),r+getcircp(r,w2-90000+w),\
r+getcircp(r,w3+w),r+getcircp(r,w3-90000+w)
long mDC=CreateCompatibleDC(hDC)
long memBM=CreateCompatibleBitmap(hDC,r2,r2)
long oldSel=SelectObject(mDC,memBM)
plgBlt(mDC,pts,hDCBits,0,0,xx,yy,0,0,0)
selectobject(dc,memBM)
transparentBlt(dc,x-r,y-r,r2,r2,mDC,0,0,r2,r2,col)
selectObject(mDC,oldSel)
deleteObject(memBM)
deleteDC(mDC)
deleteDC(hDCBits)
dispose(pts)
}
|
| | | | |
| | funkheld | Jup, thanks for your suggestion. Klappt vorzüglich.
greeting |
| | | | |
| | | The Lenkung Perhaps ansatzweise so:
'URL: https://XProfan.com/intl/de/forum/Hello-if-turn-of/ one-graphic-with-xpse-not-on-whom-screen-native-nproc/#n
{$cleq}
{$compiler c:\XProfan11\}
{$runtime c:\XProfan11\}
declare bpic&, ende&,winkel!,hintergrpic&,vordergrpic&
declare x1!,y1!,dx!,dy!,spd!,steerspd!
ende&=1
bpic& = create("HPIC",-1,"data\\car.bmp")
Window 20,20-800,600
Cls RGB(220,220,220)
hintergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
vordergrpic& = create("hNewPic", 500,500,rgb(255,255,0))
startpaint hintergrpic&
usebrush 1,rgb(0,128,255)
ellipsis 200,200-250,250
endpaint
dx!=100
dy!=100
spd!=1
steerspd!=0
winkel!=180000
WHILE ende&
sleep 16
if isKey(38)
spd!=spd!+0.1
endif
if isKey(40)
spd!=spd!-0.1
endif
if isKey(37)
steerspd!=steerspd!-0.1
case steerspd!<-2 : steerspd!=-2
endif
if isKey(39)
steerspd!=steerspd!+0.1
case steerspd!>2 : steerspd!=2
endif
winkel!=winkel!+steerspd!*spd!*450
steerspd!=steerspd!*0.95
y1!=Sin((winkel!/1000)/180.0*pi())*spd!
x1!=Cos((winkel!/1000)/180.0*pi())*spd!
dx!=dx!-x1!
dy!=dy!-y1!
startpaint vordergrpic&
drawpic hintergrpic&,0,0;0
drawhPicRotatedTransparent(bpic&,hDC,int(dx!)-getCircP(15,int(winkel!)+90000),int(dy!)+getCircP(15,int(-winkel!)),128,128,winkel!,30,0)
endpaint
drawpic vordergrpic&,10,10;0
ENDWHILE
end
nProc getCircP(long r,w)
return long(sin(0.0174532925199433*float(w)/1000.0)*float(r))
endproc
nProc angleByLine(long x,y,xx,yy)
sub y,yy
sub x,xx
if x
xx=int(57295.77951 * arctan(float(y)/float(x)))
case x>0 : return 270000 + xx
return 90000 + xx
endif
case y<0 : return 180000
return 0
endproc
nProc drawhPicRotated(long hPic,dc,x,y,xx,yy,w,r)
long hDCBits=createCompatibleDC(hDC)
selectObject(hDCBits, hPic)
long pts=dim(24)
long w1=angleByLine(xx,yy,0,0),w2=abs(w1-360000),w3=abs(w1-540000)
casenot r : r=long(sqrt(float(xx*xx+yy*yy)))\2
long pts&,0=x+getcircp(r,w1+w),y+getcircp(r,w1-90000+w),x+getcircp(r,w2+w),y+getcircp(r,w2-90000+w),x+getcircp(r,w3+w),y+getcircp(r,w3-90000+w)
plgBlt(dc,pts,hDCBits,0,0,xx,yy,0,0,0)
deleteDC(hDCBits)
dispose(pts)
endproc
nProc drawhPicRotatedTransparent(long hPic,dc,x,y,xx,yy,w,r,col){
long hDCBits=createCompatibleDC(hDC)
selectObject(hDCBits, hPic)
long pts=dim(24)
long w1=angleByLine(xx,yy,0,0),\
w2=abs(w1-360000),\
w3=abs(w1-540000)
casenot r : r=long(sqrt(float(xx*xx+yy*yy)))\2
long r2=r*2
long pts&,0= r+getcircp(r,w1+w),r+getcircp(r,w1-90000+w),\
r+getcircp(r,w2+w),r+getcircp(r,w2-90000+w),\
r+getcircp(r,w3+w),r+getcircp(r,w3-90000+w)
long mDC=CreateCompatibleDC(hDC)
long memBM=CreateCompatibleBitmap(hDC,r2,r2)
long oldSel=SelectObject(mDC,memBM)
plgBlt(mDC,pts,hDCBits,0,0,xx,yy,0,0,0)
selectobject(dc,memBM)
transparentBlt(dc,x-r,y-r,r2,r2,mDC,0,0,r2,r2,col)
selectObject(mDC,oldSel)
deleteObject(memBM)
deleteDC(mDC)
deleteDC(hDCBits)
dispose(pts)
}
Fliehkraft missing there but too yet. |
| | | | |
| | funkheld | Jup, the schaut well from and without plenty hoisted, only with your nativen Proceduren. in the movement sees one The Mächtigkeit the Proceduren...
Thank you.
greeting |
| | | | |
|
AnswerTopic-Options | 10.479 Views |
Themeninformationenthis Topic has 2 subscriber: |