I was just digging around for the code to DrawPixmap hoping there was a method for drawing pixmaps just cause I wanted to be all OOP and I found this:
Rem
bbdoc: Lock an image for direct access
returns: A pixmap representing the image contents
about:
Locking an image allows you to directly access an image's pixels.<br>
<br>
Only images created with the DYNAMICIMAGE flag can be locked.<br>
<br>
Locked images must eventually be unlocked with #UnlockImage before they can be drawn.
end rem
Function LockImage:TPixmap( image:TImage,frame=0,read_lock=True,write_lock=True )
Return image.Lock( frame,read_lock,write_lock )
End Function
Rem
bbdoc: Unlock an image
about:
Unlocks an image previously locked with #LockImage.
end rem
Function UnlockImage( image:TImage,frame=0 )
End Function
It seemed odd to me that there should be no code at all in the UnlockImage function.
Here's the image.lock() method:
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
I guess it doesn't seem to do anything special besides create a pixmap that it saves a pointer to in the image, but it seems odd that the docs would tell you to call a command that does nothing at all, and call the command to create a pixmap "lockimage".
I suppose there was some future expansion stuff in mind. Or maybe something gets overridden for DirectX?
|