Date: 02-16-2022
Return to Index
created by gbSnippets
'PowerBASIC supports loading of BMP images from files, using Graphic Render
'and Graphic Bitmap Load commands. Both require knowledge of the image size
'to be loaded.
'Primary Code:
'Note: This works for a BMP image file only
Dim w as Long, h as Long
Open "myimage.bmp" For BINARY AS #1
Get #1, 19, w
Get #1, 23, h
Close #1
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Include "Win32API.inc"
Global hDlg as DWord
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Push", 50,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If CB.Msg = %WM_Command AND CB.Ctl = 100 AND CB.Ctlmsg = %BN_Clicked Then
Local w as long, h as long
Open "cowgirl.bmp" For BINARY AS #1
Get #1, 19, w
Get #1, 23, h
Close #1
MsgBox "Image Size (wxh): " + Str$(w) + ":" + Str$(h)
End If
End Function
'gbs_00167
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm