I wish to get the function EncodeSprite(), which converts a sprite into an image. For now, when taking a screenshot from a screen (opened with OpenScreen()) I have to grab the sprite and save it on disk, then reload it. This is suboptimal:
Code: Select all
Procedure ScreenToClipBoard()
Protected Sprite,TempImage
Sprite=GrabSprite(#PB_Any,0,0,ScreenWidth(),ScreenHeight())
If Sprite
If SaveSprite(Sprite,GetTemporaryDirectory()+"MyTempImage.bmp",#PB_ImagePlugin_BMP)
TempImage=LoadImage(#PB_Any,GetTemporaryDirectory()+"MyTempImage.bmp",0)
If TempImage
SetClipboardImage(TempImage)
FreeImage(TempImage)
EndIf
DeleteFile(GetTemporaryDirectory()+"MyTempImage.bmp",#PB_FileSystem_Force)
EndIf
FreeSprite(Sprite)
EndIf
EndProcedure