Images and Banks

BlitzPlus Forums/BlitzPlus Programming/Images and Banks

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

yeh seen the info there Zawran, its a little lacking in detail for the likes of me.

ok been trying this, it reeds the colours of my image, almost correctly, but there is extra info every so many.


Been wondering if there is alpha detail or something else, and if so how i get round it.

I've tried int as well as byte, but byte is nearer to being correct

 window = CreateWindow("Test", 100, 200, 640, 480, 0, 11)

temp = LoadImage("tinytest.bmp")
SetBuffer ImageBuffer( temp )
LockBuffer ImageBuffer( temp )
imagebank = LockedPixels()
imagepitch = LockedPitch()
UnlockBuffer ImageBuffer( temp )



savingdata = WriteFile("C:\Documents and Settings\Administrator\My Documents\Blitz Progs\newest.txt")
WriteLine savingdata, ImageWidth(temp) : WriteLine savingdata, ImageHeight(temp) ;+ " image height" + " image width"

size = ImageWidth(temp) * ImageWidth(temp)
For count = 0 To size - 1
		peekdata = PeekByte (imagebank, count)

		WriteLine savingdata, peekdata
Next		
CloseFile(savingdata)

Notify "done"


loadingdata = ReadFile("C:\Documents and Settings\Administrator\My Documents\Blitz Progs\newest.txt")
width1 = ReadLine (loadingdata) : height1  = ReadLine (loadingdata) ;+ " image height" + " image width"
canvasPic 	= CreateCanvas (0, 0, width1, height1 , window)

SetBuffer CanvasBuffer (canvasPic)

LockBuffer CanvasBuffer(canvasPic)
backbank = LockedPixels()
backpitch = LockedPitch()
format = LockedFormat(CanvasBuffer(canvasPic))
UnlockBuffer CanvasBuffer(canvasPic)
Notify format
size = width1 * height1
For count = 0 To size - 1
	pokedata = ReadLine (loadingdata)
	PokeByte (backbank, count, pokedata)
	FlipCanvas canvasPic
Next

CloseFile(loadingdata)

gfxBank3 = CreateImage ( width1, height1 )
CopyRect 0, 0, width1, height1, 0, 0, CanvasBuffer(canvasPic), ImageBuffer(gfxBank3)
SaveImage(gfxBank3, "C:\Documents and Settings\Administrator\My Documents\Blitz Progs\newest.bmp")

WaitKey()

End