I feel like a spy visiting that site. Stuff over my head now, but at least I know where to go when and if the time arises. Thanks.
http://www.pbcrypto.com/
PowerBASIC encryption and compression algorithms
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
I feel like a spy visiting that site. Stuff over my head now, but at least I know where to go when and if the time arises. Thanks.
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
In this site you will find also an algo from ... imagine ...
Petr Schreiber
But which one? Father of Petr Schreiber Junior, our beloved Psch!
http://www.pbcrypto.com/view.php?algorithm=rle
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, so that explains it. Petr is so smart and talented as he gets a lot from his father. Petr you are in trouble now.
You and your Dad should have had complete image format support for us already Just kidding of course.
On Jose Roca's site. He has freeimage converted over to powerBASIC Petr. Sure seems like the way to go to bring all formats
to tbgl. Take a look when you have some time.
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
Ha!,
gang was unmasked ;D
Too bad dad has little time for coding now
Freeimage looks good, but if I remember correctly DLL was about 1 MB ... which is a lot
Bye,
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
There is also code that uses the GDI+ to load png and jpg as textures. You might want to take a look. I couldn't find it but I know it is there somewhere.
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
I have a function that I'm using in the PowerBASIC OPENGL examples:There is also code that uses the GDI+ to load png and jpg as textures. You might want to take a look. I couldn't find it but I know it is there somewhere.
[code=freebasic]
' =======================================================================================
' GL_BGRA structure
' =======================================================================================
TYPE GL_BGRA
blue AS BYTE
green AS BYTE
red AS BYTE
alpha AS BYTE
END TYPE
' =======================================================================================
' =======================================================================================
' GL_BGRA_UNION union
' =======================================================================================
UNION GL_BGRA_UNION
dwColor AS DWORD
GL_BGRA
END UNION
' =======================================================================================
' =======================================================================================
' GdiplusStartupInput structure
' =======================================================================================
TYPE GdiplusStartupInput
GdiplusVersion AS DWORD
DebugEventCallback AS DWORD
SuppressBackgroundThread AS LONG
SuppressExternalCodecs AS LONG
END TYPE
' =======================================================================================
' =======================================================================================
' GdiplusStartupOutput structure
' =======================================================================================
TYPE GdiplusStartupOutput
NotificationHook AS DWORD
NotificationUnhook AS DWORD
END TYPE
' =======================================================================================
' =======================================================================================
' GdiPlus functions used by GDIP_LoadTexture
' =======================================================================================
' =======================================================================================
DECLARE FUNCTION GdiplusStartup LIB "GDIPLUS.DLL" ALIAS "GdiplusStartup" ( _
BYREF token AS DWORD, _ ' *ULONG_PTR
BYREF pinput AS GdiplusStartupInput, _ ' *GdiplusStartupInput <record>
BYREF poutput AS GdiplusStartupOutput _ ' *GdiplusStartupOutput <record>
) AS LONG ' GpStatus <enum>
' =======================================================================================
DECLARE SUB GdiplusShutdown LIB "GDIPLUS.DLL" ALIAS "GdiplusShutdown" ( _
BYVAL token AS DWORD _ ' ULONG_PTR
) ' void
' =======================================================================================
DECLARE FUNCTION GdipLoadImageFromFile LIB "GDIPLUS.DLL" ALIAS "GdipLoadImageFromFile" ( _
BYVAL pFilename AS STRING, _ ' *GDIPCONST WCHAR
BYREF pImage AS DWORD _ ' *GpImage
) AS LONG ' GpStatus <enum>
' =======================================================================================
DECLARE FUNCTION GdipGetImageWidth LIB "GDIPLUS.DLL" ALIAS "GdipGetImageWidth" ( _
BYVAL pImage AS DWORD, _ ' *GpImage
BYREF nWidth AS DWORD _ ' *UINT
) AS LONG ' GpStatus <enum>
' =======================================================================================
DECLARE FUNCTION GdipGetImageHeight LIB "GDIPLUS.DLL" ALIAS "GdipGetImageHeight" ( _
BYVAL pImage AS DWORD, _ ' *GpImage
BYREF nHeight AS DWORD _ ' *UINT
) AS LONG ' GpStatus <enum>
' =======================================================================================
DECLARE FUNCTION GdipGetImageThumbnail LIB "GDIPLUS.DLL" ALIAS "GdipGetImageThumbnail" ( _
BYVAL pImage AS DWORD, _ ' *GpImage
BYVAL thumbWidth AS DWORD, _ ' UINT
BYVAL thumbHeight AS DWORD, _ ' UINT
BYREF thumbImage AS DWORD, _ ' **GpImage
BYVAL pcallback AS DWORD, _ ' GetThumbnailImageAbort
BYVAL callbackData AS DWORD _ ' *void
) AS LONG ' GpStatus <enum>
' =======================================================================================
DECLARE FUNCTION GdipImageRotateFlip LIB "GDIPLUS.DLL" ALIAS "GdipImageRotateFlip" ( _
BYVAL pImage AS DWORD, _ ' *GpImage
BYVAL rfType AS LONG _ ' RotateFlipType <enum>
) AS LONG ' GpStatus <enum>
' =======================================================================================
DECLARE FUNCTION GdipBitmapGetPixel LIB "GDIPLUS.DLL" ALIAS "GdipBitmapGetPixel" ( _
BYVAL pBitmap AS DWORD, _ ' *GpBitmap
BYVAL x AS LONG, _ ' INT
BYVAL y AS LONG, _ ' INT
BYREF pcolor AS DWORD _ ' ARGB
) AS LONG ' GpStatus <enum>
' =======================================================================================
DECLARE FUNCTION GdipDisposeImage LIB "GDIPLUS.DLL" ALIAS "GdipDisposeImage" ( _
BYVAL pImage AS DWORD _ ' *GpImage
) AS LONG ' GpStatus <enum>
' =======================================================================================
' =======================================================================================
' Loads textures from disk using GdiPlus.
' Based on code by Charles Pegge.
' Parameters:
' * strFileName = [in] The file name.
' * TextureWidth = [out] Width of the texture.
' * TextureHeight = [out] Height of the texture.
' * strTextureData = [out] The texture data.
' Return Value:
' * %E_POINTER = One of the parameters is null.
' * ERROR_FILE_NOT_FOUND = File not found.
' * ERROR_INVALID_DATA = Bad image size.
' * A GdiPlus status value.
' =======================================================================================
FUNCTION GL_LoadTexture (BYVAL strFileName AS STRING, BYREF TextureWidth AS LONG, BYREF TextureHeight AS LONG, BYREF strTextureData AS STRING) AS LONG
#REGISTER NONE
REGISTER x AS LONG
REGISTER y AS LONG
LOCAL hStatus AS LONG
LOCAL token AS DWORD
LOCAL StartupInput AS GdiplusStartupInput
LOCAL pImage AS DWORD
LOCAL pThumb AS DWORD
LOCAL pixColor AS GL_BGRA_UNION
LOCAL pTextureData AS DWORD PTR
IF VARPTR(TextureWidth) = %NULL OR VARPTR(TextureHeight) = %NULL OR VARPTR(strTextureData) = %NULL THEN
FUNCTION = %E_POINTER
EXIT FUNCTION
END IF
' Find the texture on disk
IF ISFALSE GL_FileExist(strFileName) THEN
FUNCTION = %ERROR_FILE_NOT_FOUND
EXIT FUNCTION
END IF
' Initialize GDI+
StartupInput.GdiplusVersion = 1
hStatus = GdiplusStartup(token, StartupInput, BYVAL %NULL)
IF hStatus THEN
FUNCTION = hStatus
EXIT FUNCTION
END IF
strFileName = UCODE$(strFileName)
hStatus = GdipLoadImageFromFile(strFileName, pImage)
IF hStatus = %S_OK THEN
hStatus = GdipGetImageWidth(pImage, TextureWidth)
hStatus = GdipGetImageHeight(pImage, TextureHeight)
IF TextureWidth <> TextureHeight THEN
hStatus = %ERROR_INVALID_DATA
ELSE
IF IIF&(TALLY(BIN$(TextureWidth), "1") = 1, 1, 0) = %FALSE THEN hStatus = %ERROR_INVALID_DATA
END IF
IF hStatus = %S_OK THEN
hStatus = GdipGetImageThumbnail(pImage, TextureWidth, TextureHeight, pThumb, %NULL, %NULL)
IF hStatus = %S_OK THEN
hStatus = GdipImageRotateFlip(pThumb, 6) ' 6 = %RotateNoneFlipY
IF hStatus = %S_OK THEN
strTextureData = NUL$(TextureWidth * TextureHeight * 4)
pTextureData = STRPTR(strTextureData)
FOR y = 0 TO TextureWidth - 1
FOR x = 0 TO TextureHeight - 1
GdipBitmapGetPixel(pThumb, x, y, pixColor.dwcolor)
SWAP pixColor.red, pixColor.blue
@pTextureData = pixColor.dwcolor
INCR pTextureData
NEXT
NEXT
END IF
END IF
END IF
END IF
IF pImage THEN GdipDisposeImage(pImage)
IF pThumb THEN GdipDisposeImage(pThumb)
' Shutdown GDI+
GdiplusShutdown token
FUNCTION = hStatus
END FUNCTION
' =======================================================================================
[/code]
how about an open source solution http://freeimage.sourceforge.net/index.html
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 Jose, hopefully Petr can use it to make commands for tbgl to support those formats. Thanks again.
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
Hi,
José function is perfect, only trouble I have with GDI+ solution is that it is not present on earlier versions of Windows.
It would be the best solution, thats sure.
I don't know how much rude it would be to make users of Win98 "BMP & TGA only".
Eros sent me some interesting materials regarding JPG, which I must check out too.
Bye,
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
Bookmarks