I am loading a sequence of images and copying them into a Image that had the correct number of frames (created with CreateImage w,h,numFrames). In order to get the individual frames to carry over the transparency from the original image I first clear the frame to magenta before copying the new frame data over. Then I need to mask that frame. I cannot figure out anyway to do this with BlitzPlus. Any ideas would be appreciated.
Code snippet
Global gImages = 0
Const kNumInSeq = 52
Function LoadImages()
Local i
gImages = CreateImage 100,150,kNumInSeq
For i = 0 to kNumInSeq-1
LoadOneInSeq( i )
Next
; I am in graphics mode so reset the back buffer
SetBuffer BackBuffer()
End Function
Function LoadOneInSeq( index )
Local tempImage, hBuffer
; I am looping through the number of images
; here which is what index represents. Assume
; index is between 0 and 51
; Load in a graphic
tempImage = LoadImage Str(index)+".png"
; Set our buffer to the correct image frame
SetBuffer ImageBuffer( gImages,index )
; Set the clear color to magenta
ClsColor 255,0,255
; Clear my image buffer to magenta
Cls
; now draw the card image that I loaded into
; the current frame buffer
DrawImage tempImage, 0, 0
hBuffer = GraphicsBuffer()
; This does NOT work. Apparently hBuffer is
; Not a valid pointer to the image frame I want.
MaskImage hBuffer,255,0,255
FreeImage tempImage
End Function
Code snippet
Global gImages = 0
Const kNumInSeq = 52
Function LoadImages()
Local i
gImages = CreateImage 100,150,kNumInSeq
For i = 0 to kNumInSeq-1
LoadOneInSeq( i )
Next
; I am in graphics mode so reset the back buffer
SetBuffer BackBuffer()
End Function
Function LoadOneInSeq( index )
Local tempImage, hBuffer
; I am looping through the number of images
; here which is what index represents. Assume
; index is between 0 and 51
; Load in a graphic
tempImage = LoadImage Str(index)+".png"
; Set our buffer to the correct image frame
SetBuffer ImageBuffer( gImages,index )
; Set the clear color to magenta
ClsColor 255,0,255
; Clear my image buffer to magenta
Cls
; now draw the card image that I loaded into
; the current frame buffer
DrawImage tempImage, 0, 0
hBuffer = GraphicsBuffer()
; This does NOT work. Apparently hBuffer is
; Not a valid pointer to the image frame I want.
MaskImage hBuffer,255,0,255
FreeImage tempImage
End Function