;------------------------------------------------------------------------------- ; ; Image Rotator V2 ; ;,,,, ; Definition ;---- Const SourceImageFile$ = "Ship Pre Final.PNG" Const SourceImageWidth = 64 Const SourceImageHeight = 64 Const SourceFrames = 1 Const SourceFrameOffset = 0 Const SourceFrameToUse = 0 ; First frame Const SourceMask = False Const SourceMaskRed = 255 Const SourceMaskGreen = 0 Const SourceMaskBlue = 255 Const RemoveMaskColor = True Const DestinationFile$ = "Ship Images\Ship " Const RotationInterval = 5 Const AntiAliasing = True Const Scaling = True Const ScalingTo# = 1.1 Const ScalingFrom# = 1 / ScalingTo ;,,,, ; Processing ;---- Graphics 640 , 480 , 0 , 2 TFormFilter AntiAliasing Local SourceImage Local SourceAnimStrip ; Single or multi image SourceAnimStrip = LoadAnimImage ( SourceImageFile , SourceImageWidth , SourceImageHeight , SourceFrameOffset , SourceFrames ) ; Grab image to use from strip SourceImage = CreateImage ( SourceImageWidth , SourceImageHeight ) SetBuffer ImageBuffer ( SourceImage ) DrawBlock SourceAnimStrip , 0 , 0 , SourceFrameToUse FreeImage SourceAnimStrip Local NoMaskImage ; Apply virtual masking If SourceMask MaskImage SourceImage , SourceMaskRed , SourceMaskGreen , SourceMaskBlue ; Remove masking color (replace with black) If RemoveMaskColor NoMaskImage = CreateImage ( ImageWidth ( SourceImage ) , ImageHeight ( SourceImage ) ) SetBuffer ImageBuffer ( NoMaskImage ) DrawImage SourceImage , 0 , 0 FreeImage SourceImage SourceImage = NoMaskImage End If End If ; Centered hotspot MidHandle SourceImage ; Upsampling (filter dependent) If Scaling Then ScaleImage SourceImage , ScalingTo , ScalingTo Local ScreenMidX Local ScreenMidY SetBuffer BackBuffer () ScreenMidX = GraphicsWidth () / 2 ScreenMidY = GraphicsHeight () / 2 Local RotatedImage Local Angle ; Rendering For Angle = 0 To 360 Step RotationInterval ; Make fresh copy of original to be rotated RotatedImage = CopyImage ( SourceImage ) MidHandle RotatedImage ; Rotate with or without filtering RotateImage RotatedImage , Angle ; Scale if requested If Scaling Then ScaleImage RotatedImage , ScalingFrom , ScalingFrom ; Render to screen for user to see progress DrawImage RotatedImage , ScreenMidX , ScreenMidY Flip False ; Save image to disk SaveImage RotatedImage , DestinationFile + Angle + ".BMP" ; Image saved, done FreeImage RotatedImage Next End ;,,,, ; ;---- ;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ;~IDEal Editor Parameters: ;~C#Blitz3D198