Hi Eros,
that looks very interesting. Does the library allow to get RGB(A) or BGR(A) raw data as well?
I'm testing a very simple module able to load BMP, ICO, JPG, TGA, PNG and TIFF images.
Target of the module is very precise and limited: the ability to load different images format other than just BMP and return a handle to windows bitmap of the image so functionalities are very few but I think enough to be very very useful for many activities.
Syntax of the new keywords inside the module are the following:
[code=thinbasic]hBmp = TImage_Load(nIdx, ImageFileName)
lResult = TImage_Save(nIdx, ImageFileName, nType)
lResult = TImage_Unload(nIdx)
Width = TImage_Width(nIdx)
Height = TImage_Height(nIdx)
hBmp = TImage_Handle(nIdx)[/code]
Where:
- nIdx is a user unique number used to identify the image and is assigned during TImage_Load. Just use a number like 1 or 2 or 3 or whatever number you like. nIdx is than used in all other functions to identify the image.
- nType is one of the following equates: %TImage_BMP, %TImage_JPG, %TImage_PNG
I would like to have some feedback and tests. It should work on Win9x systems withoutthe need of GDI+ library but it needs Microsoft Visual C runtime (that should be present mainly on all Win9x systems)
If there will be no big problems I will deliver with official release.
Attached: module dll, module sources, example.
Thanks a lot
Eros
ps: TImage module takes advantages of PBIMAGE.DLL By Dean Hodgson I've found on another forum. PBIMAGE.DLL is loaded at module runtime from module resource directly into process memory.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Hi Eros,
that looks very interesting. Does the library allow to get RGB(A) or BGR(A) raw data as well?
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
No. It allows just to resize the image and nothing more.
But ...
(I'm not an expert on the field)
it returns a handle to bmp. So maybe you can do something with that.
I will attach here TImage source code (late afternoon) so you can check.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
hi eros, I would like to test this module too. Looks interesting this thin image loader. perhaps it's also possible to set the images with x,y,width,height,style position or making some added controls, we will see. thanks for the nice little thing.
I am curious, frankI will attach here TImage source code (late afternoon) so you can check.
you can't always get what you want, but if you try sometimes you might find, you get what you need
Attached to first post of this message full TImage source code.
Consider you may have to change a bit include files in order to be able to compile it with Power Basic.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Thanks Eros,
I will check it!
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
The code is in LibertyBASIC, it confused me as I could not recognize the syntax for a while
The core of the functionality seems to be in image323.dll, which allows retrieving pixel colors by giving handle, x and y, but no pointer to data.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
I had a quick look around for more liberty stuff and found this jpeg.dll (24Kb ).
'This DLL loads an image and returns a handle
'to a 24-bit memory bitmap of the image.
'Supported types: .jpg, .bmp, .ico, .emf, .wmf, .gif
'= jpeg, bitmap, icon, enhanced metafile,
'windows metafile, and GIF
http://alycesrestaurant.com/dll.htm
Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370
TImage module takes advantages of PBIMAGE.DLL By Dean Hodgson and not the other dlls.
PBIMAGE.DLL has more image formats.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
To get the BITMAP info from bitmap handle you can use the following code:
[code=thinbasic]
Declare Function GetObject Lib "GDI32.DLL" Alias "GetObjectA" (ByVal hObject As DWord, ByVal nCount As Long, ByVal lpObject As DWord) As Long
.
.
.
hImg = TImage_Load (%MyImage, sBITMAP)
Dim BI As tBITMAP
GetObject(hImg, SIZEOF(bi), VARPTR(bi))
MsgBox 0, "Bitmap Info: " & $CRLF & _
"bmType: " & $TAB & BI.bmType & $CRLF & _
"bmWidth: " & $TAB & BI.bmWidth & $CRLF & _
"bmHeight: " & $TAB & BI.bmHeight & $CRLF & _
"bmWidthBytes: " & $TAB & BI.bmWidthBytes & $CRLF & _
"bmPlanes: " & $TAB & BI.bmPlanes & $CRLF & _
"bmBitsPixel: " & $TAB & BI.bmBitsPixel & $CRLF & _
"bmBits: " & $TAB & BI.bmBits & $CRLF & _
""
[/code]
BI.bmBits element is the BYTE PTR to location of the bit values for the bitmap
http://msdn.microsoft.com/en-us/library/dd183371(VS.85).aspx
Can this be of any help?
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Bookmarks