Verify_Consistency Function Verify_Consistency () Graphics 1,1,32,2 GetColor 0,0 Red = ColorRed () Green = ColorGreen () Blue = ColorBlue () Color 255,255,255 Plot 0,0 GetColor 0,0 ;DebugLog "R( " + ColorRed () + " ) G( " + ColorGreen () + " ) B( " + ColorBlue () + " )" If ColorRed () <> 255 Or ColorGreen () <> 255 Or ColorBlue () <> 255 RuntimeError "32-bit (or higher) color depth required!" End If Color Red,Green,Blue Plot 0,0 EndGraphics End Function Dim Zone ( 0 , 0 ) Function ConvertText_ToBitmap ( SourceFile$ , TargetFile$ ) ;Source=TXT,Target=BMP Print "Reading data from text" Source = OpenFile ( SourceFile ) Width = ReadLine ( Source ) Height = ReadLine ( Source ) Dim Zone ( Width , Height ) For Y = 1 To Height Line$ = ReadLine ( Source ) For X = 1 To Width Zone ( X , Y ) = Asc ( Mid ( Line , X , 1 ) ) Next Next CloseFile Source Print "Creating bitmap" Image = CreateImage ( Width , Height ) Print "Writing data to bitmap" Width0 = Width - 1 Height0 = Height - 1 LockBuffer ImageBuffer ( Image ) For Y = 0 To Height0 For X = 0 To Width0 WritePixelFast X , Y , Zone ( X+1 , Y+1 ) Or $FF000000 , ImageBuffer ( Image ) ; argb = ReadPixelFast ( X , Y , ImageBuffer ( Image ) ) And $FF ;DebugLog "X: " + X + " Y: " + Y + " o: " + Zone ( X+1 , Y+1 ) + " c: " + argb Next Next UnlockBuffer ImageBuffer ( Image ) Print "Saving bitmap" SaveImage Image , TargetFile Dim Zone ( 0 , 0 ) FreeImage Image Print "Done" End Function Function ConvertBitmap_ToText ( SourceFile$ , TargetFile$ ) ;Source=BMP,Target=TXT Print "Loading bitmap" Image = LoadImage ( SourceFile ) Print "Reading data from bitmap" Width = ImageWidth ( Image ) Height = ImageHeight ( Image ) Dim Zone ( Width , Height ) Width0 = Width - 1 Height0 = Height - 1 LockBuffer ImageBuffer ( Image ) For Y = 0 To Height0 For X = 0 To Width0 Zone ( X+1 , Y+1 ) = ReadPixelFast ( X , Y , ImageBuffer ( Image ) ) And $FF Next Next UnlockBuffer ImageBuffer ( Image ) FreeImage Image Print "Writing data to text" Target = WriteFile ( TargetFile ) WriteLine Target , Width WriteLine Target , Height For Y = 1 To Height For X = 1 To Width Line$ = Line + Chr ( Zone ( X , Y ) ) Next WriteLine Target , Line Line = "" Next CloseFile Target Dim Zone ( 0 , 0 ) Print "Done" End Function Graphics 640 , 480 , 32 ; unremark which conversion you'd like to do ;ConvertText_ToBitmap "Tilemap.TXT" , "Tilemap.BMP" ;ConvertBitmap_ToText "Tilemap.BMP" , "Tilemap.TXT" WaitKey End ;~IDEal Editor Parameters: ;~C#Blitz3D198