max2d.UnlockImage is .. blank?

BlitzMax Forums/BlitzMax Programming/max2d.UnlockImage is .. blank?

plash(Posted 2009) [#1]
Function LockImage:TPixmap( image:TImage,frame=0,read_lock=True,write_lock=True )
	Return image.Lock( frame,read_lock,write_lock )
End Function

Function UnlockImage( image:TImage,frame=0 )
End Function


TImage.Lock doesn't make much sense either..
	Method Lock:TPixmap( index,read,write )
		If write
			seqs[index]=0
			frames[index]=Null
		EndIf
		If Not pixmaps[index]
			pixmaps[index]=CreatePixmap( width,height,PF_RGBA8888 )
		EndIf
		Return pixmaps[index]
	End Method


So, do we lock to get the pixmap and then setpixmap on the image..?


plash(Posted 2009) [#2]
Apparently you don't need to do anything after getting (*locking*) the pixmap for an image.


Brucey(Posted 2009) [#3]
That's correct.


plash(Posted 2009) [#4]
Silly practice.. Hopefully it can be sorted in the next release.


Tommo(Posted 2009) [#5]
When you use lock to get a writable pixmap, the image.seq field will be cleared, then the image must reupload its pixmap as texture when it get drawed next time. So the unlocking is actually automated.
It might be sometimes confusing that calling unlock() is said to be a must while it's not.