Code : Tout sélectionner
Procedure CreateImageFromSprite(Image.l,Sprite.l)
Protected hDC.l,Bmp.BITMAP,hBmp.l
If IsSprite(Sprite)
hDC=StartDrawing(SpriteOutput(Sprite))
Bmp\bmWidth=SpriteWidth(Sprite)
Bmp\bmHeight=SpriteHeight(Sprite)
Bmp\bmPlanes=1
Bmp\bmBitsPixel=GetDeviceCaps_(hDC,#BITSPIXEL)
Bmp\bmBits=DrawingBuffer()
Bmp\bmWidthBytes=DrawingBufferPitch()
hBmp=CreateBitmapIndirect_(Bmp)
StopDrawing()
CreateImage(Image,SpriteWidth(Sprite),SpriteHeight(Sprite))
StartDrawing(ImageOutput(Image))
DrawImage(hBmp,0,0)
StopDrawing()
DeleteObject_(hBmp)
EndIf
EndProcedure