@@ -156,20 +156,23 @@ EndRem
156
156
Global importedFile:String = Null
157
157
Global exportedFile:String = Null
158
158
159
+ 'File Filters
160
+ Global fileFilters:String
161
+
159
162
Type TAppFileIO
160
163
'Save Bools
164
+ Global saveAsIndexed:Int = False
161
165
Global prepForSave:Int = False
162
166
Global rdyForSave:Int = False
163
167
Global runOnce:Int = False
164
- 'File Filters
165
- Global fileFilers:String = " Image Files:png,bmp,jpg"
168
+
166
169
'Output copy for saving
167
170
Global tempOutputImage:TPixmap
168
171
169
172
'Load Source Image
170
173
Function FLoadFile ()
171
174
Local oldImportedFile:String = importedFile
172
- importedFile = RequestFile(" Select graphic file to open" ,fileFilers )
175
+ importedFile = RequestFile(" Select graphic file to open" ," Image Files:png,bmp,jpg " )
173
176
'Foolproofing
174
177
If importedFile = Null Then
175
178
importedFile = oldImportedFile
@@ -201,14 +204,17 @@ Type TAppFileIO
201
204
202
205
'Save Output Content To File
203
206
Function FSaveFile ()
204
- exportedFile = RequestFile(" Save graphic output" ,fileFilers ,True )
207
+ exportedFile = RequestFile(" Save graphic output" ,fileFilters ,True )
205
208
'Foolproofing
206
209
If exportedFile = importedFile Then
207
210
Notify(" Cannot overwrite source image!" ,True )
208
211
ElseIf exportedFile <> importedFile Then
209
212
'Writing new file
210
- 'SavePixmapPNG(tempOutputImage,exportedFile)
211
- TBitmapIndex.FPixmapToIndexedBitmap(tempOutputImage,exportedFile)
213
+ If saveAsIndexed = True
214
+ TBitmapIndex.FPixmapToIndexedBitmap(tempOutputImage,exportedFile)
215
+ Else
216
+ SavePixmapPNG(tempOutputImage,exportedFile)
217
+ EndIf
212
218
FRevertPrep()
213
219
Else
214
220
'On Cancel
221
227
------- OUTPUT ELEMENTS -----------------------------------------------------------------------------------------------
222
228
EndRem
223
229
224
- 'Output Window Title
225
- AppTitle = " CCCP Bender v" + appVersion+ " - Output"
226
-
227
230
Type TAppOutput
228
231
'Output Window
229
232
Global outputWindow:TGraphics
@@ -387,7 +390,12 @@ Type TAppOutput
387
390
Next
388
391
SetRotation(0 )
389
392
'Output copy for saving
390
- TAppFileIO.tempOutputImage = GrabPixmap(0 ,96 ,768 ,384 )
393
+ If TAppFileIO.saveAsIndexed = True Then
394
+ 'If saving indexed grab a smaller pixmap to speed up indexing
395
+ TAppFileIO.tempOutputImage = GrabPixmap(55 ,120 ,34 *FRAMES,210 )
396
+ Else
397
+ TAppFileIO.tempOutputImage = GrabPixmap(0 ,96 ,768 ,384 )
398
+ EndIf
391
399
Flip(1 )
392
400
If TAppFileIO.prepForSave
393
401
TAppFileIO.FPrepForSave()
@@ -562,12 +570,19 @@ While True
562
570
TAppGUI.FAppUpdate()
563
571
Else
564
572
TAppOutput.FOutputUpdate()
573
+ If ButtonState(TAppGUI.editSettingsIndexedCheckbox) = True Then
574
+ fileFilters = " Image Files:bmp"
575
+ TAppFileIO.saveAsIndexed = True
576
+ Else
577
+ fileFilters = " Image Files:png"
578
+ TAppFileIO.saveAsIndexed = False
579
+ EndIf
565
580
EndIf
566
581
567
582
WaitEvent
568
583
'Print CurrentEvent.ToString()
569
584
570
- 'Event Responses
585
+ 'Event Responses
571
586
'In Main Window
572
587
If Not TAppGUI.mainToEdit Then
573
588
Select EventID()
@@ -584,7 +599,7 @@ While True
584
599
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
585
600
Exit
586
601
EndSelect
587
- 'In Editor Window
602
+ 'In Editor Window
588
603
ElseIf TAppGUI.mainToEdit Then
589
604
Select EventID()
590
605
Case EVENT_APPRESUME
0 commit comments