Post by emy on Oct 9, 2023 9:40:41 GMT -5
Hi Rod,
Following code with StretchBlt hDCdest,x,y,w,h,hDCsrc,x2,y2,w2,h2
It's working nice.
About to turn pattern into instructions for a knitting machine, no one Industrial knitting machine manufacturer will communicate their own Data Format machine.
Following code with StretchBlt hDCdest,x,y,w,h,hDCsrc,x2,y2,w2,h2
It's working nice.
About to turn pattern into instructions for a knitting machine, no one Industrial knitting machine manufacturer will communicate their own Data Format machine.
'================================================
' Stretch2.bas
' Rod advise
'================================================
nomainwin
WindowWidth = 900
WindowHeight = 885
UpperLeftX = 50
UpperLeftY = 50
'...............................
button #main.bt1, "Save Snap", [SaveSnap], UL, 100, 600, 80, 40
statictext #main.st1, " ", 60, 660, 220, 25
graphicbox #main.gb1, 0, 0, 900, 900
'...............................
open "Zoom-Out" for window_nf as #main
#main, "trapclose [quit]"
'...............................
fileName$ = "Str76.bmp" '<--- Any bmp w=620 - h=840
loadbmp "src", fileName$
#main.gb1 "cls"
#main.gb1 "down"
#main.gb1,"down; fill buttonface; flush"
#main.gb1 "drawbmp src 280 10"
#main.gb1 "flush"
unloadbmp "src"
h = hwnd(#main.gb1)
calldll #user32, "GetDC",_
h as ulong,_
hdc as ulong
CallDll #gdi32, "StretchBlt",_
hdc as ulong,_ 'Destination DC (can be other)
10 as long,_ 'x location on destination
10 as long,_ 'y location on destination
118 as long,_ 'width to transfer
163 as long,_ 'height to transfer
hdc as ulong,_ 'Source DC
280 as long,_ 'x location in source
10 as long,_ 'y location in source
595 as long,_ 'width of source
831 as long,_ 'height of source
_SRCCOPY as ulong,_ 'Source copy
result as boolean 'non zero if successfull
#main.gb1 "flush" 'No effect !
wait
'-------------------------------------
[quit]
calldll #user32, "ReleaseDC",_
h as ulong,_
hdc as ulong,_
r as long
close #main
End
'-------------------------------------
'If necessary, Save the reduced graphic before moving another window over it !
'Despite of function flush it will be cancelled. I don't see why
[SaveSnap]
#main.gb1 "getbmp img 10 10 ";140;" ";180
bmpsave "img", "tempo1.bmp" 'Name of the saved snap
call waitMilliseconds 500
#main.st1, " Done ! bmp saved...Wait 2 seconds."
call waitMilliseconds 2000
#main.st1, " "
unloadbmp "img"
wait
'-------------------------------------
Sub ReleaseDC hWnd, nDC
calldll #user32, "ReleaseDC",_
h as uLong,_
hdc as uLong,_
result As Long
End Sub
'-------------------------------------
sub waitMilliseconds ms
timer ms, [stopWaiting]
wait
[stopWaiting]
timer 0
end sub
'-------------------------------------------------