|
Post by held12345 on Mar 25, 2023 3:07:43 GMT -5
I can't get rid of pglblt > rotate. how can i turn the car in my program please?
Thanks greeting
nomainwin WindowWidth = 800 WindowHeight = 550 Open "msimg32.dll" for DLL as #m graphicbox #1.g, 50,50,500,300 open "Blitter" for graphics_nf_nsb as #1 #1 "trapclose [quit]"
loadbmp "largebmp","sprites\large.bmp" loadbmp "sprite","sprites\auto1.bmp" #1.g "down ; drawbmp largebmp 0 0" hDC=GetDC(hwnd(#1.g)) mDC=CreateCompatibleDC(gDC) hBitmap=hbmp("largebmp") oldBmp=SelectObject(mDC,hBitmap) mDCs=CreateCompatibleDC(gDCs) hBitmaps=hbmp("sprite") oldBmps=SelectObject(mDCs,hBitmaps) a=0 x=0 y=100 result=blit(hDC,0,0,500,300,mDC,0,0) result=TransparentBlt(hDC, x, y, 128,128, mDCs, 0, 0,128, 128, 0) STRUCT lpPoint,_ x1 as long,_ y1 as long,_ x2 as long,_ y2 as long,_ x3 as long,_ y3 as long bmpWidth=128 bmpHeight=128 timer 10, [keyCheck] wait [quit] close#1 end [keyCheck] if keyState(81) then x=x-2 gosub [vordergrundsprite] end if if keyState(69) then x=x+2 gosub [vordergrundsprite] end if if keyState(83) then y=y+2 gosub [vordergrundsprite] end if if keyState(87) then y=y-2 gosub [vordergrundsprite] end if if keyState(65) then x1=-1*bmpWidth/2:y1=-1*bmpHeight/2 x2=1*bmpWidth/2:y2=-1*bmpHeight/2 x3=-1*bmpWidth/2:y3=1*bmpHeight/2 pi=acs(-1) cx=bmpWidth/2:cy=bmpHeight/2 a=a+5 aa=a*pi/180 c=cos(aa):s=sin(aa) lpPoint.x1.struct = int(cx+r*(c*x1-s*y1)) lpPoint.y1.struct = int(cy+r*(s*x1+c*y1)) lpPoint.x2.struct = int(cx+r*(c*x2-s*y2)) lpPoint.y2.struct = int(cy+r*(s*x2+c*y2)) lpPoint.x3.struct = int(cx+r*(c*x3-s*y3)) lpPoint.y3.struct = int(cy+r*(s*x3+c*y3)) gosub [drehen] end if if keyState(68) then x1=-1*bmpWidth/2:y1=-1*bmpHeight/2 x2=1*bmpWidth/2:y2=-1*bmpHeight/2 x3=-1*bmpWidth/2:y3=1*bmpHeight/2 pi=acs(-1) cx=bmpWidth/2:cy=bmpHeight/2 a=a-5 aa=a*pi/180 c=cos(aa):s=sin(aa) lpPoint.x1.struct = int(cx+r*(c*x1-s*y1)) lpPoint.y1.struct = int(cy+r*(s*x1+c*y1)) lpPoint.x2.struct = int(cx+r*(c*x2-s*y2)) lpPoint.y2.struct = int(cy+r*(s*x2+c*y2)) lpPoint.x3.struct = int(cx+r*(c*x3-s*y3)) lpPoint.y3.struct = int(cy+r*(s*x3+c*y3)) gosub [drehen] end if wait [vordergrundsprite] result=blit(hDC,0,0,500,300,mDC,0,0) result=TransparentBlt(hDC, x, y, 128,128, mDCs, 0, 0,128, 128, 0) return [drehen] results=rotate(hDC,lpPoint,mDCs,0,0,128,128,0,0,0) return function keyState(keycode) calldll #user32, "GetAsyncKeyState", _ keycode AS long, _ keyState AS long end function
Function GetDC(hWnd) CallDLL #user32, "GetDC",_ hWnd As ulong,_ 'window or control handle GetDC As ulong 'returns device context End Function
Function CreateCompatibleDC(hDC) CallDLL #gdi32,"CreateCompatibleDC",_ hDC As ulong,_ 'window DC CreateCompatibleDC As ulong 'memory DC End Function
Function SelectObject(hDC,hObject) CallDLL #gdi32,"SelectObject",_ hDC As ulong,_ 'memory device context hObject As long,_ 'handle of object SelectObject As long 'returns previously selected object End Function
function blit(dDC,x,y,w,h,sDC,sx,sy) CallDll #gdi32, "BitBlt", _ dDC as ulong,_ 'The destination DC x as long,_ 'x location on destination y as long,_ 'y location on destination w as long,_ 'width to transfer h as long,_ 'height to transfer sDC as ulong,_ 'The source DC sx as long,_ 'x location in source sy as long,_ 'y location in source _SRCCOPY as ulong,_ 'The operation to be performed blit as long 'nonzero if successful end function Function rotate(hdcDest,lpPoint,hdcSrc,nXSrc,nYSrc,nWidth,nHeigt,hbmMask,xMask,yMsk) CallDll #gdi32, "PlgBlt", _ hdcDest As Long, _ lpPoint As POINTAPI, _ hdcSrc As Long, _ nXSrc As Long, _ nYSrc As Long, _ nWidth As Long, _ nHeight As Long, _ hbmMask As Long, _ xMask As Long, _ yMask As Long end function function TransparentBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSource, xSource, ySource, wSource, hSource, clrTransp) calldll #m, "TransparentBlt", _ hdcDest as ulong, _ 'handle to destination DC xDest as long, _ 'x-coord of destination upper-left corner yDest as long, _ 'y-coord of destination upper-left corner wDest as long, _ 'width of destination rectangle hDest as long, _ 'height of destination rectangle hdcSource as ulong, _ 'handle to source DC xSource as long, _ 'x-coord of source upper-left corner ySource as long, _ 'y-coord of source upper-left corner wSource as long, _ 'width of source rectangle hSource as long, _ 'height of source rectangle clrTransp as ulong, _ 'color to make transparent TransparentBlt as long end function
Attachments:
|
|
|
Post by Rod on Mar 25, 2023 6:45:11 GMT -5
This is nearly right. You had a lot wrong! I created two graphic resources, one for the background, one for the sprite. I also created a buffer. We draw to the buffer then blit the completed buffer to the screen. That gives much smoother graphics without flashing. So we draw the background to the buffer, you will be able to change what part of the background is shown, for the moment it does not move. Once the background is in the buffer we draw the rotated car to the buffer then blit the buffer to the screen. All of that works I just have not got the coordinate and xy positions correct.
We need the sprite resource to be separate because if we keep rotating it it gets fuzzy and messed up with moire patterns. So it stays static and we rotate it fresh each time to draw. We are also going to have to implement a mask since plgblt needs a mask to draw transparently. But lets get the rotation corrected first.
'nomainwin
WindowWidth = 800 WindowHeight = 550
Open "msimg32.dll" for DLL as #m
graphicbox #1.g, 50,50,500,300
open "Blitter" for graphics_nf_nsb as #1 #1 "trapclose [quit]"
loadbmp "largebmp","large.bmp" loadbmp "sprite","auto1.bmp" 'loadbmp "mask","mask.bmp" 'hm=hbmp("mask")
#1.g "down ; fill red" #1.g "getbmp bmp 0 0 500 300"
scrDC=GetDC(hwnd(#1.g)) bufDC=CreateCompatibleDC(scrDC) hBitmap=hbmp("bmp") oldBmp=SelectObject(bufDC,hBitmap) bakDC=CreateCompatibleDC(scrDC) hBitmap=hbmp("largebmp") oldBmp=SelectObject(bakDC,hBitmap) carDC=CreateCompatibleDC(scrDC) hBitmap=hbmp("sprite") oldBmp=SelectObject(carDC,hBitmap)
a=0
x=0 y=100 result=blit(bufDC,0,0,500,300,bakDC,0,0) result=TransparentBlt(bufDC, x, y, 128,128, carDC, 0, 0,128, 128, 0) result=blit(scrDC,0,0,500,300,bufDC,0,0) STRUCT lpPoint,_ x1 as long,_ y1 as long,_ x2 as long,_ y2 as long,_ x3 as long,_ y3 as long
bmpWidth=128 bmpHeight=128
timer 10, [keyCheck] wait
[quit] close#1 end
[keyCheck] if keyState(81) then x=x-2 end if
if keyState(69) then x=x+2 end if
if keyState(83) then y=y+2 end if
if keyState(87) then y=y-2 end if
if keyState(65) then x1=-1*bmpWidth/2:y1=-1*bmpHeight/2 x2=1*bmpWidth/2:y2=-1*bmpHeight/2 x3=-1*bmpWidth/2:y3=1*bmpHeight/2 pi=acs(-1) cx=bmpWidth/2:cy=bmpHeight/2 r=1 a=a+5 aa=a*pi/180 c=cos(aa):s=sin(aa) lpPoint.x1.struct = int(cx+r*(c*x1-s*y1)) lpPoint.y1.struct = int(cy+r*(s*x1+c*y1)) lpPoint.x2.struct = int(cx+r*(c*x2-s*y2)) lpPoint.y2.struct = int(cy+r*(s*x2+c*y2)) lpPoint.x3.struct = int(cx+r*(c*x3-s*y3)) lpPoint.y3.struct = int(cy+r*(s*x3+c*y3)) end if
if keyState(68) then x1=-1*bmpWidth/2:y1=-1*bmpHeight/2 x2=1*bmpWidth/2:y2=-1*bmpHeight/2 x3=-1*bmpWidth/2:y3=1*bmpHeight/2 pi=acs(-1) cx=bmpWidth/2:cy=bmpHeight/2 r=1 a=a-5 aa=a*pi/180 c=cos(aa):s=sin(aa) lpPoint.x1.struct = int(cx+r*(c*x1-s*y1)) lpPoint.y1.struct = int(cy+r*(s*x1+c*y1)) lpPoint.x2.struct = int(cx+r*(c*x2-s*y2)) lpPoint.y2.struct = int(cy+r*(s*x2+c*y2)) lpPoint.x3.struct = int(cx+r*(c*x3-s*y3)) lpPoint.y3.struct = int(cy+r*(s*x3+c*y3)) end if
[vordergrundsprite] result=blit(bufDC,0,0,500,300,bakDC,0,0) calldll #gdi32, "PlgBlt",_ bufDC as ulong,_ 'device context of graphicbox lpPoint as struct,_ 'array of points carDC as ulong,_ 'memory DC x as long,_ 'ulx source y as long,_ 'uly source 128 as long,_ 'width source 128 as long,_ 'height source 0 as ulong,_ 'mask bmp handle, null = not used hm is mask handle 0 as long,_ 'ulx mask 0 as long,_ 'uly mask re as long 'nonzero=success result=blit(scrDC,0,0,500,300,bufDC,0,0) wait
function keyState(keycode) calldll #user32, "GetAsyncKeyState", _ keycode AS long, _ keyState AS long end function
Function GetDC(hWnd) CallDLL #user32, "GetDC",_ hWnd As ulong,_ 'window or control handle GetDC As ulong 'returns device context End Function
Function CreateCompatibleDC(hDC) CallDLL #gdi32,"CreateCompatibleDC",_ hDC As ulong,_ 'window DC CreateCompatibleDC As ulong 'memory DC End Function
Function SelectObject(hDC,hObject) CallDLL #gdi32,"SelectObject",_ hDC As ulong,_ 'memory device context hObject As long,_ 'handle of object SelectObject As long 'returns previously selected object End Function
function blit(dDC,x,y,w,h,sDC,sx,sy) CallDll #gdi32, "BitBlt", _ dDC as ulong,_ 'The destination DC x as long,_ 'x location on destination y as long,_ 'y location on destination w as long,_ 'width to transfer h as long,_ 'height to transfer sDC as ulong,_ 'The source DC sx as long,_ 'x location in source sy as long,_ 'y location in source _SRCCOPY as ulong,_ 'The operation to be performed blit as long 'nonzero if successful end function
function TransparentBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSource, xSource, ySource, wSource, hSource, clrTransp) calldll #m, "TransparentBlt", _ hdcDest as ulong, _ 'handle to destination DC xDest as long, _ 'x-coord of destination upper-left corner yDest as long, _ 'y-coord of destination upper-left corner wDest as long, _ 'width of destination rectangle hDest as long, _ 'height of destination rectangle hdcSource as ulong, _ 'handle to source DC xSource as long, _ 'x-coord of source upper-left corner ySource as long, _ 'y-coord of source upper-left corner wSource as long, _ 'width of source rectangle hSource as long, _ 'height of source rectangle clrTransp as ulong, _ 'color to make transparent TransparentBlt as long end function
|
|
|
Post by held12345 on Mar 25, 2023 8:06:02 GMT -5
oh..., thanks for your quick help. I'm surprised how quickly you can do it. I will now first make a movement of it without it being transparent. I will then continue to let you know how the mask works and which liberty basic program you use to create an external mask from the auto1.bmp.
ps. I find this topic very interesting.
Thanks very much. greeting
|
|
|
Post by Rod on Mar 25, 2023 10:00:14 GMT -5
Another thing we need to fix is the sprite image. It must be able to rotate within the square without losing edges. by this I mean that the image must be contained within a circle that touches the four sides of the square. If you draw outside that circle you will lose the edges at the 45o points. The mask needs to be a black and white two color image. I use paint shop pro but most paint packages will let you make a two color image.
I hope tsh73 can see what I am doing wrong with the sprite rotation. It is rotating I just don't have the centre position right
|
|
|
Post by held12345 on Mar 25, 2023 10:26:19 GMT -5
now movement and turning is done.
keyboard : W =forward , S=backward , A =left , D=right greeting
nomainwin
WindowWidth = 800 WindowHeight = 550
Open "msimg32.dll" for DLL as #m
graphicbox #1.g, 50,50,500,300
open "Blitter" for graphics_nf_nsb as #1 #1 "trapclose [quit]"
loadbmp "largebmp","sprites\large.bmp" loadbmp "sprite","sprites\auto1.bmp" 'loadbmp "mask","mask.bmp" 'hm=hbmp("mask")
#1.g "down"; #1.g "getbmp bmp 0 0 500 300"
scrDC=GetDC(hwnd(#1.g)) bufDC=CreateCompatibleDC(scrDC) hBitmap=hbmp("bmp") oldBmp=SelectObject(bufDC,hBitmap) bakDC=CreateCompatibleDC(scrDC) hBitmap=hbmp("largebmp") oldBmp=SelectObject(bakDC,hBitmap) carDC=CreateCompatibleDC(scrDC) hBitmap=hbmp("sprite") oldBmp=SelectObject(carDC,hBitmap) STRUCT lpPoint,_ x1 as long,_ y1 as long,_ x2 as long,_ y2 as long,_ x3 as long,_ y3 as long
bmpWidth=128 bmpHeight=128 a=0 gosub [drehen]
timer 10, [keyCheck] wait
[quit] close#1 end
[keyCheck] if keyState(87) then dx=cos(aa) dy=sin(aa) x=x+dx*2 y=y+dy*2 gosub [drehen] end if
if keyState(83) then dx=cos(aa) dy=sin(aa) x=x-dx*2 y=y-dy*2 gosub [drehen] end if
if keyState(65) then a=a-5 gosub [drehen] end if
if keyState(68) then a=a+5 gosub [drehen] end if result=blit(bufDC,0,0,500,300,bakDC,0,0) calldll #gdi32, "PlgBlt",_ bufDC as ulong,_ 'device context of graphicbox lpPoint as struct,_ 'array of points carDC as ulong,_ 'memory DC 0 as long,_ 'ulx source 0 as long,_ 'uly source 128 as long,_ 'width source 128 as long,_ 'height source 0 as ulong,_ 'mask bmp handle, null = not used hm is mask handle 0 as long,_ 'ulx mask 0 as long,_ 'uly mask re as long 'nonzero=success result=blit(scrDC,0,0,500,300,bufDC,0,0) wait [drehen] x1=-1*bmpWidth/2:y1=-1*bmpHeight/2 x2=1*bmpWidth/2:y2=-1*bmpHeight/2 x3=-1*bmpWidth/2:y3=1*bmpHeight/2 pi=acs(-1) cx=bmpWidth/2:cy=bmpHeight/2 r=1 aa=a*pi/180 c=cos(aa):s=sin(aa) lpPoint.x1.struct = int(cx+r*(c*x1-s*y1)+x) lpPoint.y1.struct = int(cy+r*(s*x1+c*y1)+y) lpPoint.x2.struct = int(cx+r*(c*x2-s*y2)+x) lpPoint.y2.struct = int(cy+r*(s*x2+c*y2)+y) lpPoint.x3.struct = int(cx+r*(c*x3-s*y3)+x) lpPoint.y3.struct = int(cy+r*(s*x3+c*y3)+y) return
function keyState(keycode) calldll #user32, "GetAsyncKeyState", _ keycode AS long, _ keyState AS long end function
Function GetDC(hWnd) CallDLL #user32, "GetDC",_ hWnd As ulong,_ 'window or control handle GetDC As ulong 'returns device context End Function
Function CreateCompatibleDC(hDC) CallDLL #gdi32,"CreateCompatibleDC",_ hDC As ulong,_ 'window DC CreateCompatibleDC As ulong 'memory DC End Function
Function SelectObject(hDC,hObject) CallDLL #gdi32,"SelectObject",_ hDC As ulong,_ 'memory device context hObject As long,_ 'handle of object SelectObject As long 'returns previously selected object End Function
function blit(dDC,x,y,w,h,sDC,sx,sy) CallDll #gdi32, "BitBlt", _ dDC as ulong,_ 'The destination DC x as long,_ 'x location on destination y as long,_ 'y location on destination w as long,_ 'width to transfer h as long,_ 'height to transfer sDC as ulong,_ 'The source DC sx as long,_ 'x location in source sy as long,_ 'y location in source _SRCCOPY as ulong,_ 'The operation to be performed blit as long 'nonzero if successful end function
function TransparentBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSource, xSource, ySource, wSource, hSource, clrTransp) calldll #m, "TransparentBlt", _ hdcDest as ulong, _ 'handle to destination DC xDest as long, _ 'x-coord of destination upper-left corner yDest as long, _ 'y-coord of destination upper-left corner wDest as long, _ 'width of destination rectangle hDest as long, _ 'height of destination rectangle hdcSource as ulong, _ 'handle to source DC xSource as long, _ 'x-coord of source upper-left corner ySource as long, _ 'y-coord of source upper-left corner wSource as long, _ 'width of source rectangle hSource as long, _ 'height of source rectangle clrTransp as ulong, _ 'color to make transparent TransparentBlt as long end function
Attachments:
|
|
|
Post by held12345 on Mar 25, 2023 10:40:09 GMT -5
hello, can you also change the spritecreator.bas so that 2 bmp are saved? 1 mask sprite from above and the normal sprite from below?
Thanks. greeting
[ Attachments:
|
|
|
Post by held12345 on Mar 25, 2023 10:58:48 GMT -5
I have now created a mask for auto1.bmp with the name mask.bmp how is now installed in the program please? Thanks. greeting
nomainwin
WindowWidth = 800 WindowHeight = 550
Open "msimg32.dll" for DLL as #m
graphicbox #1.g, 50,50,500,300
open "Blitter" for graphics_nf_nsb as #1 #1 "trapclose [quit]"
loadbmp "largebmp","sprites\large.bmp" loadbmp "sprite","sprites\auto1.bmp" 'loadbmp "mask","mask.bmp" 'hm=hbmp("mask")
#1.g "down"; #1.g "getbmp bmp 0 0 500 300"
scrDC=GetDC(hwnd(#1.g)) bufDC=CreateCompatibleDC(scrDC) hBitmap=hbmp("bmp") oldBmp=SelectObject(bufDC,hBitmap) bakDC=CreateCompatibleDC(scrDC) hBitmap=hbmp("largebmp") oldBmp=SelectObject(bakDC,hBitmap) carDC=CreateCompatibleDC(scrDC) hBitmap=hbmp("sprite") oldBmp=SelectObject(carDC,hBitmap) STRUCT lpPoint,_ x1 as long,_ y1 as long,_ x2 as long,_ y2 as long,_ x3 as long,_ y3 as long
bmpWidth=128 bmpHeight=128 a=0 gosub [drehen]
timer 10, [keyCheck] wait
[quit] close#1 end
[keyCheck] if keyState(87) then dx=cos(aa) dy=sin(aa) x=x+dx*2 y=y+dy*2 gosub [drehen] end if
if keyState(83) then dx=cos(aa) dy=sin(aa) x=x-dx*2 y=y-dy*2 gosub [drehen] end if
if keyState(65) then a=a-5 gosub [drehen] end if
if keyState(68) then a=a+5 gosub [drehen] end if result=blit(bufDC,0,0,500,300,bakDC,0,0) calldll #gdi32, "PlgBlt",_ bufDC as ulong,_ 'device context of graphicbox lpPoint as struct,_ 'array of points carDC as ulong,_ 'memory DC 0 as long,_ 'ulx source 0 as long,_ 'uly source 128 as long,_ 'width source 128 as long,_ 'height source 0 as ulong,_ 'mask bmp handle, null = not used hm is mask handle 0 as long,_ 'ulx mask 0 as long,_ 'uly mask re as long 'nonzero=success result=blit(scrDC,0,0,500,300,bufDC,0,0) wait [drehen] x1=-1*bmpWidth/2:y1=-1*bmpHeight/2 x2=1*bmpWidth/2:y2=-1*bmpHeight/2 x3=-1*bmpWidth/2:y3=1*bmpHeight/2 pi=acs(-1) cx=bmpWidth/2:cy=bmpHeight/2 r=1 aa=a*pi/180 c=cos(aa):s=sin(aa) lpPoint.x1.struct = int(cx+r*(c*x1-s*y1)+x) lpPoint.y1.struct = int(cy+r*(s*x1+c*y1)+y) lpPoint.x2.struct = int(cx+r*(c*x2-s*y2)+x) lpPoint.y2.struct = int(cy+r*(s*x2+c*y2)+y) lpPoint.x3.struct = int(cx+r*(c*x3-s*y3)+x) lpPoint.y3.struct = int(cy+r*(s*x3+c*y3)+y) return
function keyState(keycode) calldll #user32, "GetAsyncKeyState", _ keycode AS long, _ keyState AS long end function
Function GetDC(hWnd) CallDLL #user32, "GetDC",_ hWnd As ulong,_ 'window or control handle GetDC As ulong 'returns device context End Function
Function CreateCompatibleDC(hDC) CallDLL #gdi32,"CreateCompatibleDC",_ hDC As ulong,_ 'window DC CreateCompatibleDC As ulong 'memory DC End Function
Function SelectObject(hDC,hObject) CallDLL #gdi32,"SelectObject",_ hDC As ulong,_ 'memory device context hObject As long,_ 'handle of object SelectObject As long 'returns previously selected object End Function
function blit(dDC,x,y,w,h,sDC,sx,sy) CallDll #gdi32, "BitBlt", _ dDC as ulong,_ 'The destination DC x as long,_ 'x location on destination y as long,_ 'y location on destination w as long,_ 'width to transfer h as long,_ 'height to transfer sDC as ulong,_ 'The source DC sx as long,_ 'x location in source sy as long,_ 'y location in source _SRCCOPY as ulong,_ 'The operation to be performed blit as long 'nonzero if successful end function
function TransparentBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSource, xSource, ySource, wSource, hSource, clrTransp) calldll #m, "TransparentBlt", _ hdcDest as ulong, _ 'handle to destination DC xDest as long, _ 'x-coord of destination upper-left corner yDest as long, _ 'y-coord of destination upper-left corner wDest as long, _ 'width of destination rectangle hDest as long, _ 'height of destination rectangle hdcSource as ulong, _ 'handle to source DC xSource as long, _ 'x-coord of source upper-left corner ySource as long, _ 'y-coord of source upper-left corner wSource as long, _ 'width of source rectangle hSource as long, _ 'height of source rectangle clrTransp as ulong, _ 'color to make transparent TransparentBlt as long end function
Attachments:
|
|
|
Post by Rod on Mar 25, 2023 13:37:49 GMT -5
1) how to include the mask is already on the code. 2) sprite creator is for a different purpose. 3) you have not understood my square and circle point. 4) the drivers head cannot be the background color.
Tell me why the driver cannot be the background color.
|
|
|
Post by held12345 on Mar 25, 2023 13:59:48 GMT -5
1) how to include the mask is already on the code. I used the mask after 1) but it is not transparent.
2) Sprite Creator serves a different purpose. you could expand the program to create a mask to save?
-------------------------------- loadbmp "largebmp","sprites\large.bmp" loadbmp "sprite","sprites\auto1.bmp" loadbmp "mask","mask.bmp" hm=hbmp("mask") ....... ....... ....... result=blit(bufDC,0,0,500,300,bakDC,0,0) calldll #gdi32, "PlgBlt",_ bufDC as ulong,_ 'device context of graphicbox lpPoint as struct,_ 'array of points carDC as ulong,_ 'memory DC 0 as long,_ 'ulx source 0 as long,_ 'uly source 128 as long,_ 'width source 128 as long,_ 'height source hm as ulong,_ 'mask bmp handle, null = not used hm is mask handle 0 as long,_ 'ulx mask 0 as long,_ 'uly mask re as long 'nonzero=success result=blit(scrDC,0,0,500,300,bufDC,0,0) ---------------------------------------------
thanks
greeting
|
|
|
Post by Rod on Mar 25, 2023 14:48:22 GMT -5
Please don’t choke the forum by reposting long and inappropriate code. You have still to answer points three and four.
|
|
|
Post by held12345 on Mar 25, 2023 16:39:09 GMT -5
this is not a head. It is an example of a transparency rope inside the car as a demo.
I want everything white in the mask to appear transparent.
I overlook the edges for now. the image (auto.bmp) should not appear that precise.
I want it to work first with the transparent. the fine work of the graphics comes later.
so the auto.bmp is better for a demo. I know that the corners are more than 128 pixels when turning.
1,414 x 128 ca 181 pixel
greeting
Attachments:
|
|
|
Post by held12345 on Mar 25, 2023 16:57:39 GMT -5
here the mask.bmp.
greeting
Attachments:
|
|
|
Post by Rod on Mar 26, 2023 1:50:47 GMT -5
Good, that’s much more understandable.
|
|
|
Post by held12345 on Mar 26, 2023 2:11:26 GMT -5
Hi good afternoon. How can you now please make the auto.bmp transparent with the mask.bmp using the program below.
it doesn't work Thanks. greeting
-------------------------------- loadbmp "largebmp","sprites\large.bmp" loadbmp "sprite","sprites\auto1.bmp" loadbmp "mask","mask.bmp" hm=hbmp("mask") ....... ....... ....... result=blit(bufDC,0,0,500,300,bakDC,0,0) calldll #gdi32, "PlgBlt",_ bufDC as ulong,_ 'device context of graphicbox lpPoint as struct,_ 'array of points carDC as ulong,_ 'memory DC 0 as long,_ 'ulx source 0 as long,_ 'uly source 128 as long,_ 'width source 128 as long,_ 'height source hm as ulong,_ 'mask bmp handle, null = not used hm is mask handle 0 as long,_ 'ulx mask 0 as long,_ 'uly mask re as long 'nonzero=success result=blit(scrDC,0,0,500,300,bufDC,0,0) ---------------------------------------------
|
|
|
Post by held12345 on Mar 26, 2023 3:00:05 GMT -5
hello
by a small modification of SpriteCreator v2 I now also have the used mask extra in the bmp collection. greeting Attachments:
|
|