No-BS FI
BlitzPlus Forums/BlitzPlus Beginners Area/No-BS FI
| ||
This works on all the images I have tested. It can be easily modified to return a bank with an alpha channel:a=filoadimage("rockbase.dds") SaveImage a,"test.bmp" ExecFile "test.bmp" Function FILoadImage(file$) ftype=FIGetType(file,0) If ftype=-1 ftype=FIGuessType(file) If ftype=-1 Return EndIf fibitmap%=FILoad(ftype,file,0) If Not fibitmap Return pixels=figetbits(fibitmap) i=CreateImage(FIGetWidth(fibitmap),FIGetHeight(fibitmap)) SetBuffer ImageBuffer(i) LockBuffer ImageBuffer(i) width=FIGetWidth(fibitmap) height=FIGetHeight(fibitmap) depth=FIGetDepth(fibitmap) For y=0 To height-1 For x=0 To width-1 b=PeekB(pixels+(y*width+x)*(depth/8)+0) g=PeekB(pixels+(y*width+x)*(depth/8)+1) r=PeekB(pixels+(y*width+x)*(depth/8)+2) If depth=32 a=PeekB(pixels+(y*width+x)*(depth/8)+3) WritePixelFast x,height-1-y,RGB(r,g,b) Next Next UnlockBuffer ImageBuffer(i) FIUnload fibitmap Return i End Function You need FreeImage.dll: |
| ||
From your message subject I infer that you think the freeimage lib someone made for Blitz contains BS. To what BS do you refer? Was there some license I didn't see? Or did you just not like how many functions the lib had? It seemed pretty straightforward to me the way it was, and I didn't see any restrictions on use. The lib to which I refer is here: http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=snarty09252003024804&comments=no I guess you decided to use freeimage to load those DDS files then? |
| ||
No I mean his source is freakin' huge and bloated...and this can use the latest FreeImage DLL, without a special wrapper. |