Custom image plugin
Posted: Fri Aug 26, 2016 2:14 pm
See this thread for the most recent cross platform version
http://www.purebasic.fr/english/viewtop ... 12&t=66497
Cross platform ImagePlugin.pbi file
Plugins to be used with this include file :
OSX
GIF Decode / Encode
Decode all Mac supported types
http://www.purebasic.fr/english/viewtop ... 12&t=66497
Cross platform ImagePlugin.pbi file
Code: Select all
; *** ImagePlugin.pbi ***
; MacOS, Linux : Use ProcedureC for Check, Decode, Cleanup, Encode24 and Encode32
; Use PeekS with UTF8 encoding to get a string from *Filename
; Windows : Use Procedure for Check, Decode, Cleanup, Encode24 and Encode32
; Use PeekS with current encoding to get a string from *Filename
; ReverseY can be checked with Flags argument of Decode, Encode24 and Encode32
#PB_ImageDecoder_File = 0
#PB_ImageDecoder_Memory = 1
#PB_ImageDecoder_ReverseY = 2
Structure PB_ImageDecoder Align #PB_Structure_AlignC
*Check
*Decode
*Cleanup
ID.l
EndStructure
Structure PB_ImageDecoderGlobals Align #PB_Structure_AlignC
*Decoder.PB_ImageDecoder
*Filename
*File
*Buffer
Length.l
Mode.l
Width.l
Height.l
Depth.l
Flags.l
Data.i[8]
OriginalDepth.l
EndStructure
Structure PB_ImageEncoder Align #PB_Structure_AlignC
ID.l
*Encode24
*Encode32
EndStructure
IsImage(0); Make sure PB Image functionality is included
CompilerIf #PB_Compiler_OS = #PB_OS_Windows And #PB_Compiler_Processor = #PB_Processor_x86
Import ""
PB_ImageDecoder_Register(*ImageDecoder.PB_ImageDecoder) As "_PB_ImageDecoder_Register@4"
PB_ImageEncoder_Register(*ImageEncoder.PB_ImageEncoder) As "_PB_ImageEncoder_Register@4"
EndImport
CompilerElse
ImportC ""
PB_ImageDecoder_Register(*ImageDecoder.PB_ImageDecoder)
PB_ImageEncoder_Register(*ImageEncoder.PB_ImageEncoder)
EndImport
CompilerEndIf
OSX
GIF Decode / Encode
Decode all Mac supported types