Thanks Abraxas for the new module, but I am getting this error, forgive me if I am doing something stupid in getting this error.
It might be that the dll is not named thinBasic_name of dll, but not sure.
Here is a module for converting 256 colour bitmaps to 24 bit bitmaps, its still very primitive at the moment so be gentle with it.
[code=thinbasic]
'----------------------------------------------------------------------------------------------------
' Usage: ReturnString = TBGF_String2Bitmap (stringbuffer, RGBformat)
' Stringbuffer is a string - which contains a valid bitmap file loaded into memory.
' RGBformat is
' %TBGF_BGRformat = &H00000001 which returns image data as B G R (valid bitmap file)
' %TBGF_RGBformat = &H00000002 which returns image data as R G B
' %TBGF_RGBAformat = &H00000004 which returns image data as R G B A
' %TBGF_File = &H00000008 Filebuffer is a filename to load.
' %TBGF_Buffer = &H00000010 FileBuffer is a bitmap file in a STRING
'
' ReturnString is a string - which contains a valid 24 bit bitmap file
' this is only for development when TBGL string is supported only the bitmap data will be returned.
'
' if stringbuffer does not contain a valid bitmap structure ReturnString = ""
'---------------------------------------------------------------------------------------------------
[/code]
if you load a 24 bit bitmap it only returns the bitmap data (ie. not a valid file, headers stripped)
have fun.
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
Thanks Abraxas for the new module, but I am getting this error, forgive me if I am doing something stupid in getting this error.
It might be that the dll is not named thinBasic_name of dll, but not sure.
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Ok, it was the naming... I changed the name of the dll to: thinBasic_TBGF.dll
in the script I changed the line: MODULE "TBGF_MODULEV0.1.0"
to: USES "TBGF"
It then works fine.
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Thanks for the module!
Kent, the error has to do with a bug that Eros just recently fixed and released a new Core.
also didnt help I changed the module version numbering at the last minute and didnt post that version.
fixed now renamed module to thinBasic_TBGF.dll, you now need to copy to the mod directory inside thinbasic directory.
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
Hi Abraxas,
thanks a lot. On my PC it works ok, I just added to script "USES "TBGF"" as I am more used to it.
Petr
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
Thanks a lot Abraxas.
Nice and useful module. If you want, I can create a dedicated forum for this module. I have the impression some other functionalities can be added to it
Also, when you think will be the right time, I can include in standard thinBasic release adding help info too.
Just let me know.
Possible implementations:
- load and save of the BMP files can be native TBGF module functions.
This will avoid the necessity to have FILE module loaded (I can show you FILE_LOAD/FILE_SAVE source code)- Change RGBFormat into more general options paremeter using HEX values. In this case more options acan be passed. Example:
TBGF_BGRformat = &H00000001
%TBGF_RGBformat = &H00000002
%TBGF_RGBAformat = &H00000004
%TBGF_File = &H00000008
%TBGF_Buffer = &H00000010
In this way, testing it, buffer can be either the name of a bitmap file or a real memory buffer and it can be used like:
TBGF_String2Bitmap (stringbuffer, %TBGF_File OR %TBGF_RGBformat)
or
TBGF_String2Bitmap (stringbuffer, %TBGF_Buffer OR %TBGF_RGBformat)
Just mad ideas, you know how we are ;D
In any case, thanks a lot for this idea.
Eros
@Ken,
here the bug Abraxas reported: http://community.thinbasic.com/index...sg8502#msg8502
It will be fixed in next release.
In any case just use USES "TBGF" and all should be ok.
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
ok. look up ;D
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
Eros i would be interested in seeing the File_load and save routines,as I know this will improve my simple routines that are in place now.
if you dont mind please email to my account address.
is my current version working OK.
thanks your help is as always much appreciated
Mike
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
Here they are PB source.
They can be improved maybe wrapping arounf TRY/CATCH/END TRY
[code=vb]
FUNCTION File_Exists(BYVAL FullFileName AS STRING) AS LONG
FUNCTION = %FALSE
IF DIR$(FullFileName, %NORMAL OR %READONLY OR %HIDDEN OR %SYSTEM) = "" THEN EXIT FUNCTION
FUNCTION = %TRUE
END FUNCTION
FUNCTION FILE_Load(BYVAL lFileName AS STRING) AS STRING
LOCAL hFile AS LONG
LOCAL lBuffer AS STRING
ON ERROR RESUME NEXT
IF FILE_EXISTS(lFileName) THEN
hFile = FREEFILE
OPEN lFileName FOR BINARY ACCESS READ AS hFile
GET$ hFile, LOF(hFile), lBuffer
CLOSE hFile
FUNCTION = lBuffer
END IF
END FUNCTION
FUNCTION FILE_Save(BYVAL lFileName AS STRING, BYVAL sBuffer AS STRING) AS LONG
LOCAL hFile AS LONG
ON ERROR RESUME NEXT
IF FILE_EXISTS(lFileName) THEN
KILL lFileName
END IF
hFile = FREEFILE
OPEN lFileName FOR BINARY ACCESS READ WRITE AS hFile
PUT$ hFile, sBuffer
CLOSE hFile
FUNCTION = ERRCLEAR
END FUNCTION
[/code]
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