fb:porticula NoPaste
GetJPEG
Uploader: | csde_rats |
Datum/Zeit: | 06.07.2007 00:04:08 |
Function RawJpeg(Byval File As String) As Any Ptr ' Lädt ein JPEG-Bild in einen
Dim Dib As FIBITMAP Ptr ' FreeBasic-kompatiblen Puffer
Dim SprWidth As Integer
Dim SprHeight As Integer
Dim Sprite As Any Ptr
Dim Bits As Any Ptr
dim xcounter as integer
dim ycounter as integer
dim xscale as integer
dim yscale as integer
' Ab in den RAM, mit dem JPEG!!!!
Dib = FreeImage_Load(FIF_JPEG, File, JPEG_DEFAULT)
If Dib = 0 Then Return 0
FreeImage_FlipVertical Dib
Dib = FreeImage_ConvertTo32Bits(Dib)
SprWidth = FreeImage_GetWidth(Dib)
SprHeight = FreeImage_GetHeight(Dib)
Sprite = ImageCreate(SprWidth, SprHeight)
Bits = FreeImage_GetBits(Dib)
MemCpy CPtr(Zstring Ptr, Sprite) + 4, Bits, SprWidth * SprHeight * 4
' Speicher wieder freigeben
FreeImage_Unload(Dib)
return Sprite
end function