@@ -69,10 +69,12 @@ public static void main(String[] args) throws Exception {
6969
7070 Options options = new Options ();
7171
72- Option li = Option .builder ().longOpt ("lines" ).hasArg ().desc ("Changes the number of lines (defaults to 10)" ).build ();
72+ Option li = Option .builder ().longOpt ("lines" ).hasArg ().desc ("Changes the number of lines (defaults to 10)" )
73+ .build ();
7374 Option fl = Option .builder ().longOpt ("file" ).hasArg ().desc ("Path to file, hides file picker" ).build ();
7475 Option bk = Option .builder ().longOpt ("background" ).hasArg ().desc ("Path to custom background" ).build ();
75- Option md = Option .builder ().longOpt ("mode" ).hasArg ().desc ("Crewmade mode, currently supports default and furry" ).build ();
76+ Option md = Option .builder ().longOpt ("mode" ).hasArg ()
77+ .desc ("Crewmade mode, currently supports default and furry" ).build ();
7678 Option eo = Option .builder ().longOpt ("extraoutput" ).hasArg ().desc ("Appends text to output files" ).build ();
7779 Option hp = Option .builder ().longOpt ("help" ).desc ("Shows this message" ).build ();
7880 options .addOption (li );
@@ -166,21 +168,31 @@ public static void main(String[] args) throws Exception {
166168 CountDownLatch l = new CountDownLatch (frames .length );
167169 for (int index = 0 ; index < frames .length ; index ++) {
168170 final int indexx = index ;
171+ // "Finalized series" of variables. To fix "final or effectively final" errors.
172+ final BufferedImage F_bg = bg ;
173+ final int F_ty = ty ;
174+ final int F_tx = tx ;
175+ final String F_modestring = modestring ;
176+ final int F_count1Check = count1Check ;
177+ final int F_count2Reset = count2Reset ;
178+ final String F_dotSlash = dotSlash ;
179+ final String F_extraoutput = extraoutput ;
180+ // Start of new thread
169181 new Thread (() -> {
170182 try {
171183 // bg
172- frames [indexx ] = toBufferedImage (bg .getScaledInstance (ix , iy , Image .SCALE_SMOOTH ));
184+ frames [indexx ] = toBufferedImage (F_bg .getScaledInstance (ix , iy , Image .SCALE_SMOOTH ));
173185
174186 // counts. One for iterating across frames and the other for the line reset
175187 int count = indexx ;
176188 int count2 = indexx ;
177189
178190 // iterates through pixels
179- for (int y = 0 ; y < ty ; y ++) {
180- for (int x = 0 ; x < tx ; x ++) {
191+ for (int y = 0 ; y < F_ty ; y ++) {
192+ for (int x = 0 ; x < F_tx ; x ++) {
181193
182194 // Grabs appropriate pixel frame
183- var pixelI = main .getResource ("dumpy/" + count + modestring + ".png" );
195+ var pixelI = main .getResource ("dumpy/" + count + F_modestring + ".png" );
184196 BufferedImage pixel = ImageIO .read (pixelI );
185197 pixel = shader (pixel , image .getRGB (x , y ));
186198 // overlays it (if not null)
@@ -190,56 +202,19 @@ public static void main(String[] args) throws Exception {
190202
191203 // Handles animating
192204 count ++;
193- if (count == count1Check ) {
205+ if (count == F_count1Check ) {
194206 count = 0 ;
195207 }
196208 }
197209 // Handles line resets
198210 count2 --;
199211 if (count2 == -1 ) {
200- count2 = count2Reset ;
212+ count2 = F_count2Reset ;
201213 }
202214 count = count2 ;
203- final int indexx = index ;
204- // "Finalized series" of variables. To fix "final or effectively final" errors.
205- final BufferedImage F_bg = bg ;
206- final int F_ty = ty ;
207- final int F_tx = tx ;
208- final String F_modestring = modestring ;
209- final int F_count1Check = count1Check ;
210- final int F_count2Reset = count2Reset ;
211- final String F_dotSlash = dotSlash ;
212- final String F_extraoutput = extraoutput ;
213- // Start of new thread
214- new Thread (()->{
215- try {
216- // bg
217- frames [indexx ] = toBufferedImage (F_bg .getScaledInstance (ix , iy , Image .SCALE_SMOOTH ));
218-
219- // counts. One for iterating across frames and the other for the line reset
220- int count = indexx ;
221- int count2 = indexx ;
222-
223- // iterates through pixels
224- for (int y = 0 ; y < F_ty ; y ++) {
225- for (int x = 0 ; x < F_tx ; x ++) {
226-
227- // Grabs appropriate pixel frame
228- var pixelI = main .getResource ("dumpy/" + count + F_modestring + ".png" );
229- BufferedImage pixel = ImageIO .read (pixelI );
230- pixel = shader (pixel , image .getRGB (x , y ));
231- // overlays it (if not null)
232- if (pixel != null ) {
233- frames [indexx ] = overlayImages (frames [indexx ], pixel , (x * 74 ) + pad , (y * 63 ) + pad );
234- }
235-
236- // Handles animating
237- count ++;
238- if (count == F_count1Check ) {
239- count = 0 ;
240215 }
241216 // Writes finished frames
242- ImageIO .write (frames [indexx ], "PNG" , new File (dotSlash + "F_" + indexx + extraoutput + ".png" ));
217+ ImageIO .write (frames [indexx ], "PNG" , new File (F_dotSlash + "F_" + indexx + F_extraoutput + ".png" ));
243218
244219 // Gives an idea of progress
245220 System .out .println (indexx );
@@ -248,23 +223,6 @@ public static void main(String[] args) throws Exception {
248223 e .printStackTrace ();
249224 }
250225 }).start ();
251- // Handles line resets
252- count2 --;
253- if (count2 == -1 ) {
254- count2 = F_count2Reset ;
255- }
256- count = count2 ;
257- }
258- // Writes finished frames
259- ImageIO .write (frames [indexx ], "PNG" , new File (F_dotSlash + "F_" + indexx + F_extraoutput + ".png" ));
260-
261- // Gives an idea of progress
262- System .out .println (indexx );
263- l .countDown ();
264- } catch (Exception e ) {
265- e .printStackTrace ();
266- }
267- }).start ();
268226 }
269227 l .await ();
270228 // Sets output file name
0 commit comments