template support, add Chaosknoten
Stefan Schuermans

Stefan Schuermans commited on 2019-06-21 16:14:59
Showing 9 changed files, with 704 additions and 64 deletions.

... ...
@@ -1,3 +1,4 @@
1
-Blimp.jar
2
-Blimp.keystore
3
-BlinkenLib.jar
1
+/Blimp.jar
2
+/Blimp.keystore
3
+/BlinkenLib.jar
4
+/*~
... ...
@@ -7,8 +7,8 @@ BLINKENLIB:=../BlinkenLibJava/BlinkenLib.jar
7 7
 JETHERPIX:=../JEtherPix/JEtherPix.jar
8 8
 
9 9
 VERSION_MAJOR:=1
10
-VERSION_MINOR:=4
11
-VERSION_REVISION:=6
10
+VERSION_MINOR:=5
11
+VERSION_REVISION:=0
12 12
 
13 13
 JAVAC:=javac
14 14
 JAR:=jar
... ...
@@ -23,10 +23,21 @@ GENJAVA:=$(P)/Version.java
23 23
 
24 24
 CLASSPATH:=.:$(BLINKENLIB):$(JETHERPIX)
25 25
 
26
-CLASS_FILES:=$(P)/BlinkenFileFilter.class $(P)/BlinkenFrameDisplay.class \
27
-             $(P)/BlinkenFrameDisplayListener.class $(P)/BlinkenFrameDisplayInterceptor.class \
28
-             $(P)/BlinkenFrameEditor.class $(P)/BlinkenFrameEditorListener.class \
29
-             $(P)/Blimp.class $(P)/Version.class
26
+CLASS_FILES:=$(P)/BlinkenFileFilter.class \
27
+             $(P)/BlinkenFrameDisplay.class \
28
+             $(P)/BlinkenFrameDisplayListener.class \
29
+             $(P)/BlinkenFrameDisplayInterceptor.class \
30
+             $(P)/BlinkenFrameEditor.class \
31
+             $(P)/BlinkenFrameEditorListener.class \
32
+             $(P)/Blimp.class \
33
+             $(P)/FrameTemplateChaosknoten.class \
34
+             $(P)/FrameTemplateIf.class \
35
+             $(P)/FrameTemplatePixelLists.class \
36
+             $(P)/Version.class
37
+
38
+NESTED_CLASS_FILES:=$(P)/FrameTemplatePixelLists$$ContentPixel.class \
39
+                    $(P)/FrameTemplatePixelLists$$CopyPixel.class \
40
+                    $(P)/FrameTemplatePixelLists$$FixedPixel.class
30 41
 
31 42
 IMAGE_FILES:=$(IMG)/ColorPicker.png $(IMG)/Dot.png $(IMG)/Line.png \
32 43
              $(IMG)/Rectangle.png $(IMG)/FilledRectangle.png \
... ...
@@ -44,7 +55,9 @@ IMAGE_FILES:=$(IMG)/ColorPicker.png $(IMG)/Dot.png $(IMG)/Line.png \
44 55
 all: jar
45 56
 
46 57
 clean:
47
-	rm -f $(P)/Version.java $(CLASS_FILES) BlinkenLib.jar Blimp.jar
58
+	rm -f $(P)/Version.java $(CLASS_FILES) \
59
+              $(subst $$,\$$,$(NESTED_CLASS_FILES)) \
60
+              BlinkenLib.jar Blimp.jar
48 61
 
49 62
 jar: Blimp.jar
50 63
 
... ...
@@ -65,13 +78,15 @@ $(P)/Version.java: Makefile
65 78
 Blimp.keystore:
66 79
 	$(KEYTOOL) -genkey -alias Blimp -dname CN=Blimp,O=blinkenarea,C=org -keypass $(KEYPASS) -keystore Blimp.keystore -storepass $(KEYPASS) -validity 3652
67 80
 
68
-Blimp.jar: Blimp.mf Blimp.keystore $(CLASS_FILES) $(IMAGE_FILES)
81
+Blimp.jar: Blimp.mf Blimp.keystore \
82
+           $(CLASS_FILES) $(NESTED_CLASS_FILES) $(IMAGE_FILES)
69 83
 	rm -rf tmp
70 84
 	mkdir tmp
71
-	for FILE in $(CLASS_FILES) $(IMAGE_FILES); \
85
+	for FILE in $(CLASS_FILES) $(subst $$,\$$,$(NESTED_CLASS_FILES)) \
86
+	            $(IMAGE_FILES); \
72 87
 	  do \
73
-	    mkdir -p tmp/$$(dirname $$FILE) || exit; \
74
-	    cp $$FILE tmp/$$FILE || exit; \
88
+	    mkdir -p "tmp/$$(dirname "$$FILE")" || exit; \
89
+	    cp "$$FILE" "tmp/$$FILE" || exit; \
75 90
 	  done
76 91
 	for JAR in $(filter %.jar,$(subst :, ,$(CLASSPATH))); \
77 92
 	  do ( \
... ...
@@ -1,2 +1,2 @@
1
-*.class
2
-Version.java
1
+/*.class
2
+/Version.java
... ...
@@ -1,5 +1,5 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * Copyright (C) 2004-2018: Stefan Schuermans <stefan@blinkenarea.org>
2
+ * Copyright (C) 2004-2019: Stefan Schuermans <stefan@blinkenarea.org>
3 3
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
4 4
  * a blinkenarea.org project
5 5
  */
... ...
@@ -79,9 +79,10 @@ public class Blimp extends JApplet
79 79
   JMenu menuOutput, menuHelp;
80 80
   JMenuItem menuFileNew, menuFileLoad, menuFileSave, menuFileSaveAs, menuFileQuit;
81 81
   JMenuItem menuInfoShow, menuInfoAdd, menuInfoDelete;
82
-  JMenu menuEditResize, menuEditScale;
82
+  JMenu menuEditResize, menuEditScale, menuEditTemplate;
83 83
   JMenuItem menuEditResizeUser, menuEditScaleUser;
84 84
   JMenuItem menuEditResizeKnown[], menuEditScaleKnown[];
85
+  JMenuItem menuEditTemplateChaosknoten;
85 86
   JMenuItem menuEditInsertFrame, menuEditDuplicateFrame, menuEditDeleteFrame;
86 87
   JMenuItem menuFrameSelNone, menuFrameSelSingle, menuFrameSelStart, menuFrameSelEnd;
87 88
   JMenuItem menuFrameSelCopy, menuFrameSelMove, menuFrameSelReverse, menuFrameSelDelete;
... ...
@@ -132,6 +133,7 @@ public class Blimp extends JApplet
132 133
 
133 134
   //file, movie, frame
134 135
   File curDir = null, curFile = null; //current directory and file
136
+  FrameTemplateIf curTemplate = null; //current frame template
135 137
   BlinkenMovie curMovie = null; //current movie
136 138
   boolean curMovieChanged = false; //if changes have been made to current movie
137 139
   BlinkenFrame curFrame = null; //current frame
... ...
@@ -526,6 +528,10 @@ public class Blimp extends JApplet
526 528
     if( ! (formatMatcher = formatPattern.matcher( format )).find( ) ) //abort and return error if format not valid
527 529
       return false;
528 530
 
531
+    //unset frame template
532
+    curTemplate = null;
533
+    frameEditor.setTemplate( null );
534
+
529 535
     //resize movie
530 536
     curMovie.resize( Integer.parseInt( formatMatcher.group( 2 ) ),
531 537
                      Integer.parseInt( formatMatcher.group( 1 ) ),
... ...
@@ -616,6 +622,10 @@ public class Blimp extends JApplet
616 622
     if( ! (sizeMatcher = sizePattern.matcher( size.toString( ) )).find( ) ) //abort and return error if size not valid
617 623
       return false;
618 624
 
625
+    //unset frame template
626
+    curTemplate = null;
627
+    frameEditor.setTemplate( null );
628
+
619 629
     //scale movie
620 630
     curMovie.scale( Integer.parseInt( sizeMatcher.group( 2 ) ),
621 631
                     Integer.parseInt( sizeMatcher.group( 1 ) ) );
... ...
@@ -659,6 +669,23 @@ public class Blimp extends JApplet
659 669
     while( ! actionEditScaleToSize( size.toString( ) ) ); //repeat question if answer not valid
660 670
   }
661 671
 
672
+  // a template has been selected from edit menu
673
+  private void actionEditTemplate( FrameTemplateIf template )
674
+  {
675
+    // set movie size matching template
676
+    actionEditResizeToFormat( template.getFormat() );
677
+
678
+    // set template
679
+    curTemplate = template;
680
+    frameEditor.setTemplate( curTemplate );
681
+  }
682
+
683
+  // Chaosknoten template has been selected from edit menu
684
+  private void actionEditTemplateChaosknoten( )
685
+  {
686
+    actionEditTemplate( new FrameTemplateChaosknoten( ) );
687
+  }
688
+
662 689
   //"Edit Insert Frame" was chosen from menu / Insert Frame button was pressed
663 690
   private void actionEditInsertFrame( )
664 691
   {
... ...
@@ -1516,7 +1543,7 @@ public class Blimp extends JApplet
1516 1543
     JOptionPane.showMessageDialog( dialogParent,
1517 1544
                                    "BlinkenLightsInteractiveMovieProgram\n" +
1518 1545
                                    String.format( "version %d.%d.%d\n", Version.Major, Version.Minor, Version.Revision ) +
1519
-                                   "Copyright (C) 2004-2018: Stefan Schuermans <stefan@blinkenarea.org>\n" +
1546
+                                   "Copyright (C) 2004-2019: Stefan Schuermans <stefan@blinkenarea.org>\n" +
1520 1547
                                    "Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" +
1521 1548
                                    "a blinkenarea.org project\n\n" +
1522 1549
                                    String.format( "contains BlinkenLibJava %d.%d.%d\n",
... ...
@@ -2264,6 +2291,8 @@ public class Blimp extends JApplet
2264 2291
       actionEditResizeUser( );
2265 2292
     else if( e.getSource( ) == menuEditScaleUser )
2266 2293
       actionEditScaleUser( );
2294
+    else if( e.getSource( ) == menuEditTemplateChaosknoten )
2295
+      actionEditTemplateChaosknoten( );
2267 2296
     else if( e.getSource( ) == menuEditInsertFrame )
2268 2297
       actionEditInsertFrame( );
2269 2298
     else if( e.getSource( ) == menuEditDuplicateFrame )
... ...
@@ -2763,6 +2792,12 @@ public class Blimp extends JApplet
2763 2792
       menuEditScaleKnown[i].addActionListener( this );
2764 2793
       menuEditScale.add( menuEditScaleKnown[i] );
2765 2794
     }
2795
+    menuEditTemplate = new JMenu ( "Set Template" );
2796
+    menuEdit.add( menuEditTemplate );
2797
+    menuEditTemplate.setMnemonic( KeyEvent.VK_T );
2798
+    menuEditTemplateChaosknoten = new JMenuItem( "Chaosknoten" );
2799
+    menuEditTemplateChaosknoten.addActionListener( this );
2800
+    menuEditTemplate.add( menuEditTemplateChaosknoten );
2766 2801
     menuEdit.addSeparator( );
2767 2802
     menuEditInsertFrame = new JMenuItem( "Insert Frame" );
2768 2803
     menuEditInsertFrame.setMnemonic( KeyEvent.VK_I );
... ...
@@ -3341,7 +3376,7 @@ public class Blimp extends JApplet
3341 3376
     //running as command line tool
3342 3377
     System.out.println( "BlinkenLightsInteractiveMovieProgram\n" +
3343 3378
                         String.format( "Blimp (version %d.%d.%d)", Version.Major, Version.Minor, Version.Revision ) +
3344
-                        "Copyright (C) 2004-2018: Stefan Schuermans <stefan@blinkenarea.org>\n" +
3379
+                        "Copyright (C) 2004-2019: Stefan Schuermans <stefan@blinkenarea.org>\n" +
3345 3380
                         "Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" +
3346 3381
                         "a blinkenarea.org project\n" );
3347 3382
 
... ...
@@ -24,6 +24,7 @@ public class BlinkenFrameDisplay extends JLabel
24 24
   Graphics graphics = null;
25 25
   BlinkenFrameDisplayListener displayListener = null;
26 26
   BlinkenFrameDisplayInterceptor displayInterceptor = null;
27
+  FrameTemplateIf template = null;
27 28
 
28 29
   public BlinkenFrameDisplay( )
29 30
   {
... ...
@@ -121,6 +122,7 @@ public class BlinkenFrameDisplay extends JLabel
121 122
     //frame available
122 123
     else
123 124
     {
125
+      applyTemplate( );
124 126
       //get dimensions of frame
125 127
       height = frame.getHeight( );
126 128
       width = frame.getWidth( );
... ...
@@ -237,4 +239,17 @@ public class BlinkenFrameDisplay extends JLabel
237 239
   {
238 240
     displayInterceptor = newDisplayInterceptor;
239 241
   }
242
+
243
+  public void setTemplate( FrameTemplateIf template_ )
244
+  {
245
+    template = template_;
246
+    applyTemplate();
247
+  }
248
+
249
+  protected void applyTemplate( )
250
+  {
251
+    if( template != null && frame != null ) {
252
+      template.apply( frame );
253
+    }
254
+  }
240 255
 }
... ...
@@ -105,8 +105,7 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
105 105
         {
106 106
           //we do not save undo information here, it was saved in blinkenFrameDisplayPressed
107 107
           frame.setColor( curY, curX, color );
108
-          if( editorListener != null )
109
-            editorListener.blinkenFrameEditorFrameChanged( );
108
+          internalFrameChanged( );
110 109
         }
111 110
         break;
112 111
     }
... ...
@@ -184,8 +183,7 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
184 183
         {
185 184
           undoSave( );
186 185
           frame.setColor( curY, curX, color );
187
-          if( editorListener != null )
188
-            editorListener.blinkenFrameEditorFrameChanged( );
186
+          internalFrameChanged( );
189 187
         }
190 188
         break;
191 189
       case toolPaste:
... ...
@@ -200,8 +198,7 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
200 198
             for( x = 0; x < x2; x++ )
201 199
               for( c = 0; c < channels; c++ )
202 200
                 frame.setPixel( y1 + y, x1 + x, c, clipboard.getPixel( y, x, c ) );
203
-          if( editorListener != null )
204
-            editorListener.blinkenFrameEditorFrameChanged( );
201
+          internalFrameChanged( );
205 202
         }
206 203
         break;
207 204
     }
... ...
@@ -276,8 +273,7 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
276 273
                 frame.setColor( (y1 + y), (x1 + x), color );
277 274
               }
278 275
           }
279
-          if( editorListener != null )
280
-            editorListener.blinkenFrameEditorFrameChanged( );
276
+          internalFrameChanged( );
281 277
         }
282 278
         break;
283 279
       case toolRect:
... ...
@@ -298,8 +294,7 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
298 294
           if( y1 != y2 )
299 295
             for( x = x1 + 1; x < x2; x++ )
300 296
               frame.setColor( y2, x, color );
301
-          if( editorListener != null )
302
-            editorListener.blinkenFrameEditorFrameChanged( );
297
+          internalFrameChanged( );
303 298
         }
304 299
         break;
305 300
       case toolFilledRect:
... ...
@@ -313,8 +308,7 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
313 308
           for( y = y1; y <= y2; y++ )
314 309
             for( x = x1; x <= x2; x++ )
315 310
               frame.setColor( y, x, color );
316
-          if( editorListener != null )
317
-            editorListener.blinkenFrameEditorFrameChanged( );
311
+          internalFrameChanged( );
318 312
         }
319 313
         break;
320 314
       case toolCircle:
... ...
@@ -347,8 +341,7 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
347 341
             else if( z2a < z3a ) { x--; z = z2; }
348 342
             else { x--; y++; z = z3; }
349 343
           }
350
-          if( editorListener != null )
351
-            editorListener.blinkenFrameEditorFrameChanged( );
344
+          internalFrameChanged( );
352 345
         }
353 346
         break;
354 347
       case toolFilledCircle:
... ...
@@ -381,8 +374,7 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
381 374
             else if( z2a < z3a ) { x--; z = z2; }
382 375
             else { x--; y++; z = z3; }
383 376
           }
384
-          if( editorListener != null )
385
-            editorListener.blinkenFrameEditorFrameChanged( );
377
+          internalFrameChanged( );
386 378
         }
387 379
         break;
388 380
       case toolCopy:
... ...
@@ -772,9 +764,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
772 764
           for( x = 0; x < width; x++ )
773 765
             for( c = 0; c < channels; c++ )
774 766
               frame.setPixel( y, x, c, (byte)(maxval - ((int)frame.getPixel( y, x, c ) & 0xFF)) );
767
+        internalFrameChanged( );
775 768
         updateDisplay( );
776
-        if( editorListener != null )
777
-          editorListener.blinkenFrameEditorFrameChanged( );
778 769
       }
779 770
     }
780 771
   }
... ...
@@ -824,9 +815,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
824 815
           for( x = 0; x < wi; x++ )
825 816
             for( c = 0; c < channels; c++ )
826 817
               frame.setPixel( y1 + y, x1 + x, c, buffer.getPixel( y, x, c ) );
818
+        internalFrameChanged( );
827 819
         updateDisplay( );
828
-        if( editorListener != null )
829
-          editorListener.blinkenFrameEditorFrameChanged( );
830 820
       }
831 821
     }
832 822
   }
... ...
@@ -891,9 +881,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
891 881
               frame.setPixel( height / 2, width - 1 - x, c, b1 );
892 882
               frame.setPixel( height / 2, x, c, b2 );
893 883
             }
884
+        internalFrameChanged( );
894 885
         updateDisplay( );
895
-        if( editorListener != null )
896
-          editorListener.blinkenFrameEditorFrameChanged( );
897 886
       }
898 887
     }
899 888
   }
... ...
@@ -943,9 +932,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
943 932
           for( x = 0; x < wi; x++ )
944 933
             for( c = 0; c < channels; c++ )
945 934
               frame.setPixel( y1 + y, x1 + x, c, buffer.getPixel( y, x, c ) );
935
+        internalFrameChanged( );
946 936
         updateDisplay( );
947
-        if( editorListener != null )
948
-          editorListener.blinkenFrameEditorFrameChanged( );
949 937
       }
950 938
     }
951 939
   }
... ...
@@ -991,9 +979,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
991 979
               frame.setPixel( height - 1 - y, x, c, b1 );
992 980
               frame.setPixel( y, x, c, b2 );
993 981
             }
982
+        internalFrameChanged( );
994 983
         updateDisplay( );
995
-        if( editorListener != null )
996
-          editorListener.blinkenFrameEditorFrameChanged( );
997 984
       }
998 985
     }
999 986
   }
... ...
@@ -1039,9 +1026,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1039 1026
               frame.setPixel( y, width - 1 - x, c, b1 );
1040 1027
               frame.setPixel( y, x, c, b2 );
1041 1028
             }
1029
+        internalFrameChanged( );
1042 1030
         updateDisplay( );
1043
-        if( editorListener != null )
1044
-          editorListener.blinkenFrameEditorFrameChanged( );
1045 1031
       }
1046 1032
     }
1047 1033
   }
... ...
@@ -1091,9 +1077,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1091 1077
           for( x = 0; x < wi; x++ )
1092 1078
             for( c = 0; c < channels; c++ )
1093 1079
               frame.setPixel( y1 + y, x1 + x, c, buffer.getPixel( y, x, c ) );
1080
+        internalFrameChanged( );
1094 1081
         updateDisplay( );
1095
-        if( editorListener != null )
1096
-          editorListener.blinkenFrameEditorFrameChanged( );
1097 1082
       }
1098 1083
     }
1099 1084
   }
... ...
@@ -1143,9 +1128,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1143 1128
           for( x = 0; x < wi; x++ )
1144 1129
             for( c = 0; c < channels; c++ )
1145 1130
               frame.setPixel( y1 + y, x1 + x, c, buffer.getPixel( y, x, c ) );
1131
+        internalFrameChanged( );
1146 1132
         updateDisplay( );
1147
-        if( editorListener != null )
1148
-          editorListener.blinkenFrameEditorFrameChanged( );
1149 1133
       }
1150 1134
     }
1151 1135
   }
... ...
@@ -1188,9 +1172,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1188 1172
               frame.setPixel( y, x - 1, c, frame.getPixel( y, x, c ) );
1189 1173
             frame.setPixel( y, width - 1, c, b );
1190 1174
           }
1175
+        internalFrameChanged( );
1191 1176
         updateDisplay( );
1192
-        if( editorListener != null )
1193
-          editorListener.blinkenFrameEditorFrameChanged( );
1194 1177
       }
1195 1178
     }
1196 1179
   }
... ...
@@ -1233,9 +1216,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1233 1216
               frame.setPixel( y, x + 1, c, frame.getPixel( y, x, c ) );
1234 1217
             frame.setPixel( y, 0, c, b );
1235 1218
           }
1219
+        internalFrameChanged( );
1236 1220
         updateDisplay( );
1237
-        if( editorListener != null )
1238
-          editorListener.blinkenFrameEditorFrameChanged( );
1239 1221
       }
1240 1222
     }
1241 1223
   }
... ...
@@ -1278,9 +1260,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1278 1260
               frame.setPixel( y - 1, x, c, frame.getPixel( y, x, c ) );
1279 1261
             frame.setPixel( height - 1, x, c, b );
1280 1262
           }
1263
+        internalFrameChanged( );
1281 1264
         updateDisplay( );
1282
-        if( editorListener != null )
1283
-          editorListener.blinkenFrameEditorFrameChanged( );
1284 1265
       }
1285 1266
     }
1286 1267
   }
... ...
@@ -1323,9 +1304,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1323 1304
               frame.setPixel( y + 1, x, c, frame.getPixel( y, x, c ) );
1324 1305
             frame.setPixel( 0, x, c, b );
1325 1306
           }
1307
+        internalFrameChanged( );
1326 1308
         updateDisplay( );
1327
-        if( editorListener != null )
1328
-          editorListener.blinkenFrameEditorFrameChanged( );
1329 1309
       }
1330 1310
     }
1331 1311
   }
... ...
@@ -1353,9 +1333,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1353 1333
         for( x = 0; x < width; x++ )
1354 1334
           for( c = 0; c < channels; c++ )
1355 1335
             frame.setPixel( y, x, c, info.getPixel( y, x, c ) );
1336
+      internalFrameChanged( );
1356 1337
       updateDisplay( );
1357
-      if( editorListener != null )
1358
-        editorListener.blinkenFrameEditorFrameChanged( );
1359 1338
 
1360 1339
       //tell listener if undo or redo possible at the moment
1361 1340
       if( editorListener != null )
... ...
@@ -1386,9 +1365,8 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1386 1365
         for( x = 0; x < width; x++ )
1387 1366
           for( c = 0; c < channels; c++ )
1388 1367
             frame.setPixel( y, x, c, info.getPixel( y, x, c ) );
1368
+      internalFrameChanged( );
1389 1369
       updateDisplay( );
1390
-      if( editorListener != null )
1391
-        editorListener.blinkenFrameEditorFrameChanged( );
1392 1370
 
1393 1371
       //tell listener if undo or redo possible at the moment
1394 1372
       if( editorListener != null )
... ...
@@ -1458,4 +1436,12 @@ public class BlinkenFrameEditor extends BlinkenFrameDisplay
1458 1436
     if( editorListener != null )
1459 1437
       editorListener.blinkenFrameEditorInfo( "-" );
1460 1438
   }
1439
+
1440
+  // internal callback for actions to be performed after change to frame
1441
+  private void internalFrameChanged( )
1442
+  {
1443
+    applyTemplate( );
1444
+    if( editorListener != null )
1445
+      editorListener.blinkenFrameEditorFrameChanged( );
1446
+  }
1461 1447
 }
... ...
@@ -0,0 +1,415 @@
1
+/* BlinkenLightsInteractiveMovieProgram
2
+ * Copyright (C) 2019: Stefan Schuermans <stefan@blinkenarea.org>
3
+ * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
4
+ * a blinkenarea.org project
5
+ */
6
+
7
+package org.blinkenarea.Blimp;
8
+
9
+import org.blinkenarea.BlinkenLib.*;
10
+
11
+public class FrameTemplateChaosknoten extends FrameTemplatePixelLists
12
+{
13
+  public FrameTemplateChaosknoten( )
14
+  {
15
+    // format: 66x51-3/256
16
+    super( 51, 66, 3, 255 );
17
+
18
+    // dark blue background
19
+    byte def[] = new byte [3];
20
+    def[0] = (byte)0;
21
+    def[1] = (byte)0;
22
+    def[2] = (byte)128;
23
+    setDefColor( def );
24
+
25
+    // fixed pixels
26
+    FixedPixel fixed[] = new FixedPixel [126];
27
+    fixed[0] = new FixedPixel( 6, 12, 2, (byte)0 );
28
+    fixed[1] = new FixedPixel( 6, 11, 2, (byte)0 );
29
+    fixed[2] = new FixedPixel( 6, 13, 2, (byte)0 );
30
+    fixed[3] = new FixedPixel( 6, 18, 2, (byte)0 );
31
+    fixed[4] = new FixedPixel( 6, 17, 2, (byte)0 );
32
+    fixed[5] = new FixedPixel( 6, 19, 2, (byte)0 );
33
+    fixed[6] = new FixedPixel( 6, 24, 2, (byte)0 );
34
+    fixed[7] = new FixedPixel( 6, 23, 2, (byte)0 );
35
+    fixed[8] = new FixedPixel( 6, 25, 2, (byte)0 );
36
+    fixed[9] = new FixedPixel( 7, 6, 2, (byte)0 );
37
+    fixed[10] = new FixedPixel( 8, 5, 2, (byte)0 );
38
+    fixed[11] = new FixedPixel( 6, 7, 2, (byte)0 );
39
+    fixed[12] = new FixedPixel( 7, 30, 2, (byte)0 );
40
+    fixed[13] = new FixedPixel( 6, 29, 2, (byte)0 );
41
+    fixed[14] = new FixedPixel( 8, 31, 2, (byte)0 );
42
+    fixed[15] = new FixedPixel( 10, 17, 2, (byte)0 );
43
+    fixed[16] = new FixedPixel( 9, 16, 2, (byte)0 );
44
+    fixed[17] = new FixedPixel( 11, 18, 2, (byte)0 );
45
+    fixed[18] = new FixedPixel( 10, 24, 2, (byte)0 );
46
+    fixed[19] = new FixedPixel( 9, 23, 2, (byte)0 );
47
+    fixed[20] = new FixedPixel( 11, 25, 2, (byte)0 );
48
+    fixed[21] = new FixedPixel( 13, 5, 2, (byte)0 );
49
+    fixed[22] = new FixedPixel( 12, 5, 2, (byte)0 );
50
+    fixed[23] = new FixedPixel( 14, 5, 2, (byte)0 );
51
+    fixed[24] = new FixedPixel( 14, 21, 2, (byte)0 );
52
+    fixed[25] = new FixedPixel( 14, 20, 2, (byte)0 );
53
+    fixed[26] = new FixedPixel( 14, 22, 2, (byte)0 );
54
+    fixed[27] = new FixedPixel( 14, 27, 2, (byte)0 );
55
+    fixed[28] = new FixedPixel( 14, 26, 2, (byte)0 );
56
+    fixed[29] = new FixedPixel( 14, 28, 2, (byte)0 );
57
+    fixed[30] = new FixedPixel( 14, 33, 2, (byte)0 );
58
+    fixed[31] = new FixedPixel( 14, 32, 2, (byte)0 );
59
+    fixed[32] = new FixedPixel( 14, 34, 2, (byte)0 );
60
+    fixed[33] = new FixedPixel( 14, 39, 2, (byte)0 );
61
+    fixed[34] = new FixedPixel( 14, 38, 2, (byte)0 );
62
+    fixed[35] = new FixedPixel( 14, 40, 2, (byte)0 );
63
+    fixed[36] = new FixedPixel( 14, 47, 2, (byte)0 );
64
+    fixed[37] = new FixedPixel( 13, 46, 2, (byte)0 );
65
+    fixed[38] = new FixedPixel( 15, 48, 2, (byte)0 );
66
+    fixed[39] = new FixedPixel( 14, 51, 2, (byte)0 );
67
+    fixed[40] = new FixedPixel( 13, 50, 2, (byte)0 );
68
+    fixed[41] = new FixedPixel( 15, 52, 2, (byte)0 );
69
+    fixed[42] = new FixedPixel( 15, 44, 2, (byte)0 );
70
+    fixed[43] = new FixedPixel( 14, 43, 2, (byte)0 );
71
+    fixed[44] = new FixedPixel( 16, 45, 2, (byte)0 );
72
+    fixed[45] = new FixedPixel( 18, 21, 2, (byte)0 );
73
+    fixed[46] = new FixedPixel( 18, 20, 2, (byte)0 );
74
+    fixed[47] = new FixedPixel( 18, 22, 2, (byte)0 );
75
+    fixed[48] = new FixedPixel( 18, 27, 2, (byte)0 );
76
+    fixed[49] = new FixedPixel( 18, 26, 2, (byte)0 );
77
+    fixed[50] = new FixedPixel( 18, 28, 2, (byte)0 );
78
+    fixed[51] = new FixedPixel( 18, 33, 2, (byte)0 );
79
+    fixed[52] = new FixedPixel( 18, 32, 2, (byte)0 );
80
+    fixed[53] = new FixedPixel( 18, 34, 2, (byte)0 );
81
+    fixed[54] = new FixedPixel( 18, 39, 2, (byte)0 );
82
+    fixed[55] = new FixedPixel( 18, 38, 2, (byte)0 );
83
+    fixed[56] = new FixedPixel( 18, 40, 2, (byte)0 );
84
+    fixed[57] = new FixedPixel( 19, 5, 2, (byte)0 );
85
+    fixed[58] = new FixedPixel( 18, 5, 2, (byte)0 );
86
+    fixed[59] = new FixedPixel( 20, 5, 2, (byte)0 );
87
+    fixed[60] = new FixedPixel( 19, 45, 2, (byte)0 );
88
+    fixed[61] = new FixedPixel( 19, 44, 2, (byte)0 );
89
+    fixed[62] = new FixedPixel( 19, 46, 2, (byte)0 );
90
+    fixed[63] = new FixedPixel( 19, 50, 2, (byte)0 );
91
+    fixed[64] = new FixedPixel( 20, 49, 2, (byte)0 );
92
+    fixed[65] = new FixedPixel( 18, 51, 2, (byte)0 );
93
+    fixed[66] = new FixedPixel( 20, 53, 2, (byte)0 );
94
+    fixed[67] = new FixedPixel( 21, 52, 2, (byte)0 );
95
+    fixed[68] = new FixedPixel( 19, 54, 2, (byte)0 );
96
+    fixed[69] = new FixedPixel( 22, 17, 2, (byte)0 );
97
+    fixed[70] = new FixedPixel( 23, 16, 2, (byte)0 );
98
+    fixed[71] = new FixedPixel( 21, 18, 2, (byte)0 );
99
+    fixed[72] = new FixedPixel( 22, 24, 2, (byte)0 );
100
+    fixed[73] = new FixedPixel( 23, 23, 2, (byte)0 );
101
+    fixed[74] = new FixedPixel( 21, 25, 2, (byte)0 );
102
+    fixed[75] = new FixedPixel( 22, 45, 2, (byte)0 );
103
+    fixed[76] = new FixedPixel( 22, 44, 2, (byte)0 );
104
+    fixed[77] = new FixedPixel( 22, 46, 2, (byte)0 );
105
+    fixed[78] = new FixedPixel( 23, 54, 2, (byte)0 );
106
+    fixed[79] = new FixedPixel( 24, 53, 2, (byte)0 );
107
+    fixed[80] = new FixedPixel( 22, 55, 2, (byte)0 );
108
+    fixed[81] = new FixedPixel( 24, 49, 2, (byte)0 );
109
+    fixed[82] = new FixedPixel( 25, 48, 2, (byte)0 );
110
+    fixed[83] = new FixedPixel( 23, 50, 2, (byte)0 );
111
+    fixed[84] = new FixedPixel( 25, 6, 2, (byte)0 );
112
+    fixed[85] = new FixedPixel( 24, 5, 2, (byte)0 );
113
+    fixed[86] = new FixedPixel( 26, 7, 2, (byte)0 );
114
+    fixed[87] = new FixedPixel( 25, 30, 2, (byte)0 );
115
+    fixed[88] = new FixedPixel( 26, 29, 2, (byte)0 );
116
+    fixed[89] = new FixedPixel( 24, 31, 2, (byte)0 );
117
+    fixed[90] = new FixedPixel( 26, 12, 2, (byte)0 );
118
+    fixed[91] = new FixedPixel( 26, 11, 2, (byte)0 );
119
+    fixed[92] = new FixedPixel( 26, 13, 2, (byte)0 );
120
+    fixed[93] = new FixedPixel( 26, 18, 2, (byte)0 );
121
+    fixed[94] = new FixedPixel( 26, 17, 2, (byte)0 );
122
+    fixed[95] = new FixedPixel( 26, 19, 2, (byte)0 );
123
+    fixed[96] = new FixedPixel( 26, 24, 2, (byte)0 );
124
+    fixed[97] = new FixedPixel( 26, 23, 2, (byte)0 );
125
+    fixed[98] = new FixedPixel( 26, 25, 2, (byte)0 );
126
+    fixed[99] = new FixedPixel( 27, 50, 2, (byte)0 );
127
+    fixed[100] = new FixedPixel( 28, 49, 2, (byte)0 );
128
+    fixed[101] = new FixedPixel( 26, 51, 2, (byte)0 );
129
+    fixed[102] = new FixedPixel( 29, 54, 2, (byte)0 );
130
+    fixed[103] = new FixedPixel( 28, 53, 2, (byte)0 );
131
+    fixed[104] = new FixedPixel( 30, 55, 2, (byte)0 );
132
+    fixed[105] = new FixedPixel( 31, 60, 2, (byte)0 );
133
+    fixed[106] = new FixedPixel( 31, 59, 2, (byte)0 );
134
+    fixed[107] = new FixedPixel( 31, 61, 2, (byte)0 );
135
+    fixed[108] = new FixedPixel( 32, 51, 2, (byte)0 );
136
+    fixed[109] = new FixedPixel( 31, 51, 2, (byte)0 );
137
+    fixed[110] = new FixedPixel( 33, 51, 2, (byte)0 );
138
+    fixed[111] = new FixedPixel( 33, 47, 2, (byte)0 );
139
+    fixed[112] = new FixedPixel( 34, 46, 2, (byte)0 );
140
+    fixed[113] = new FixedPixel( 32, 48, 2, (byte)0 );
141
+    fixed[114] = new FixedPixel( 35, 55, 2, (byte)0 );
142
+    fixed[115] = new FixedPixel( 34, 55, 2, (byte)0 );
143
+    fixed[116] = new FixedPixel( 36, 55, 2, (byte)0 );
144
+    fixed[117] = new FixedPixel( 38, 51, 2, (byte)0 );
145
+    fixed[118] = new FixedPixel( 37, 51, 2, (byte)0 );
146
+    fixed[119] = new FixedPixel( 39, 51, 2, (byte)0 );
147
+    fixed[120] = new FixedPixel( 39, 46, 2, (byte)0 );
148
+    fixed[121] = new FixedPixel( 39, 45, 2, (byte)0 );
149
+    fixed[122] = new FixedPixel( 39, 47, 2, (byte)0 );
150
+    fixed[123] = new FixedPixel( 44, 52, 2, (byte)0 );
151
+    fixed[124] = new FixedPixel( 43, 51, 2, (byte)0 );
152
+    fixed[125] = new FixedPixel( 45, 53, 2, (byte)0 );
153
+    setFixed( fixed );
154
+
155
+    // content pixels
156
+    ContentPixel content[] = new ContentPixel [42];
157
+    content[0] = new ContentPixel( 6, 12, 1 );
158
+    content[1] = new ContentPixel( 6, 18, 1 );
159
+    content[2] = new ContentPixel( 6, 24, 1 );
160
+    content[3] = new ContentPixel( 7, 6, 1 );
161
+    content[4] = new ContentPixel( 7, 30, 1 );
162
+    content[5] = new ContentPixel( 10, 17, 1 );
163
+    content[6] = new ContentPixel( 10, 24, 1 );
164
+    content[7] = new ContentPixel( 13, 5, 1 );
165
+    content[8] = new ContentPixel( 14, 21, 1 );
166
+    content[9] = new ContentPixel( 14, 27, 1 );
167
+    content[10] = new ContentPixel( 14, 33, 1 );
168
+    content[11] = new ContentPixel( 14, 39, 1 );
169
+    content[12] = new ContentPixel( 14, 47, 1 );
170
+    content[13] = new ContentPixel( 14, 51, 1 );
171
+    content[14] = new ContentPixel( 15, 44, 1 );
172
+    content[15] = new ContentPixel( 18, 21, 1 );
173
+    content[16] = new ContentPixel( 18, 27, 1 );
174
+    content[17] = new ContentPixel( 18, 33, 1 );
175
+    content[18] = new ContentPixel( 18, 39, 1 );
176
+    content[19] = new ContentPixel( 19, 5, 1 );
177
+    content[20] = new ContentPixel( 19, 45, 1 );
178
+    content[21] = new ContentPixel( 19, 50, 1 );
179
+    content[22] = new ContentPixel( 20, 53, 1 );
180
+    content[23] = new ContentPixel( 22, 17, 1 );
181
+    content[24] = new ContentPixel( 22, 24, 1 );
182
+    content[25] = new ContentPixel( 22, 45, 1 );
183
+    content[26] = new ContentPixel( 23, 54, 1 );
184
+    content[27] = new ContentPixel( 24, 49, 1 );
185
+    content[28] = new ContentPixel( 25, 6, 1 );
186
+    content[29] = new ContentPixel( 25, 30, 1 );
187
+    content[30] = new ContentPixel( 26, 12, 1 );
188
+    content[31] = new ContentPixel( 26, 18, 1 );
189
+    content[32] = new ContentPixel( 26, 24, 1 );
190
+    content[33] = new ContentPixel( 27, 50, 1 );
191
+    content[34] = new ContentPixel( 29, 54, 1 );
192
+    content[35] = new ContentPixel( 31, 60, 1 );
193
+    content[36] = new ContentPixel( 32, 51, 1 );
194
+    content[37] = new ContentPixel( 33, 47, 1 );
195
+    content[38] = new ContentPixel( 35, 55, 1 );
196
+    content[39] = new ContentPixel( 38, 51, 1 );
197
+    content[40] = new ContentPixel( 39, 46, 1 );
198
+    content[41] = new ContentPixel( 44, 52, 1 );
199
+    setContent( content );
200
+
201
+    // copy pixels
202
+    CopyPixel copies[] = new CopyPixel [210];
203
+    copies[0] = new CopyPixel( 6, 12, 0, 0 );
204
+    copies[1] = new CopyPixel( 6, 11, 0, 0 );
205
+    copies[2] = new CopyPixel( 6, 11, 1, 0 );
206
+    copies[3] = new CopyPixel( 6, 13, 0, 0 );
207
+    copies[4] = new CopyPixel( 6, 13, 1, 0 );
208
+    copies[5] = new CopyPixel( 6, 18, 0, 1 );
209
+    copies[6] = new CopyPixel( 6, 17, 0, 1 );
210
+    copies[7] = new CopyPixel( 6, 17, 1, 1 );
211
+    copies[8] = new CopyPixel( 6, 19, 0, 1 );
212
+    copies[9] = new CopyPixel( 6, 19, 1, 1 );
213
+    copies[10] = new CopyPixel( 6, 24, 0, 2 );
214
+    copies[11] = new CopyPixel( 6, 23, 0, 2 );
215
+    copies[12] = new CopyPixel( 6, 23, 1, 2 );
216
+    copies[13] = new CopyPixel( 6, 25, 0, 2 );
217
+    copies[14] = new CopyPixel( 6, 25, 1, 2 );
218
+    copies[15] = new CopyPixel( 7, 6, 0, 3 );
219
+    copies[16] = new CopyPixel( 8, 5, 0, 3 );
220
+    copies[17] = new CopyPixel( 8, 5, 1, 3 );
221
+    copies[18] = new CopyPixel( 6, 7, 0, 3 );
222
+    copies[19] = new CopyPixel( 6, 7, 1, 3 );
223
+    copies[20] = new CopyPixel( 7, 30, 0, 4 );
224
+    copies[21] = new CopyPixel( 6, 29, 0, 4 );
225
+    copies[22] = new CopyPixel( 6, 29, 1, 4 );
226
+    copies[23] = new CopyPixel( 8, 31, 0, 4 );
227
+    copies[24] = new CopyPixel( 8, 31, 1, 4 );
228
+    copies[25] = new CopyPixel( 10, 17, 0, 5 );
229
+    copies[26] = new CopyPixel( 9, 16, 0, 5 );
230
+    copies[27] = new CopyPixel( 9, 16, 1, 5 );
231
+    copies[28] = new CopyPixel( 11, 18, 0, 5 );
232
+    copies[29] = new CopyPixel( 11, 18, 1, 5 );
233
+    copies[30] = new CopyPixel( 10, 24, 0, 6 );
234
+    copies[31] = new CopyPixel( 9, 23, 0, 6 );
235
+    copies[32] = new CopyPixel( 9, 23, 1, 6 );
236
+    copies[33] = new CopyPixel( 11, 25, 0, 6 );
237
+    copies[34] = new CopyPixel( 11, 25, 1, 6 );
238
+    copies[35] = new CopyPixel( 13, 5, 0, 7 );
239
+    copies[36] = new CopyPixel( 12, 5, 0, 7 );
240
+    copies[37] = new CopyPixel( 12, 5, 1, 7 );
241
+    copies[38] = new CopyPixel( 14, 5, 0, 7 );
242
+    copies[39] = new CopyPixel( 14, 5, 1, 7 );
243
+    copies[40] = new CopyPixel( 14, 21, 0, 8 );
244
+    copies[41] = new CopyPixel( 14, 20, 0, 8 );
245
+    copies[42] = new CopyPixel( 14, 20, 1, 8 );
246
+    copies[43] = new CopyPixel( 14, 22, 0, 8 );
247
+    copies[44] = new CopyPixel( 14, 22, 1, 8 );
248
+    copies[45] = new CopyPixel( 14, 27, 0, 9 );
249
+    copies[46] = new CopyPixel( 14, 26, 0, 9 );
250
+    copies[47] = new CopyPixel( 14, 26, 1, 9 );
251
+    copies[48] = new CopyPixel( 14, 28, 0, 9 );
252
+    copies[49] = new CopyPixel( 14, 28, 1, 9 );
253
+    copies[50] = new CopyPixel( 14, 33, 0, 10 );
254
+    copies[51] = new CopyPixel( 14, 32, 0, 10 );
255
+    copies[52] = new CopyPixel( 14, 32, 1, 10 );
256
+    copies[53] = new CopyPixel( 14, 34, 0, 10 );
257
+    copies[54] = new CopyPixel( 14, 34, 1, 10 );
258
+    copies[55] = new CopyPixel( 14, 39, 0, 11 );
259
+    copies[56] = new CopyPixel( 14, 38, 0, 11 );
260
+    copies[57] = new CopyPixel( 14, 38, 1, 11 );
261
+    copies[58] = new CopyPixel( 14, 40, 0, 11 );
262
+    copies[59] = new CopyPixel( 14, 40, 1, 11 );
263
+    copies[60] = new CopyPixel( 14, 47, 0, 12 );
264
+    copies[61] = new CopyPixel( 13, 46, 0, 12 );
265
+    copies[62] = new CopyPixel( 13, 46, 1, 12 );
266
+    copies[63] = new CopyPixel( 15, 48, 0, 12 );
267
+    copies[64] = new CopyPixel( 15, 48, 1, 12 );
268
+    copies[65] = new CopyPixel( 14, 51, 0, 13 );
269
+    copies[66] = new CopyPixel( 13, 50, 0, 13 );
270
+    copies[67] = new CopyPixel( 13, 50, 1, 13 );
271
+    copies[68] = new CopyPixel( 15, 52, 0, 13 );
272
+    copies[69] = new CopyPixel( 15, 52, 1, 13 );
273
+    copies[70] = new CopyPixel( 15, 44, 0, 14 );
274
+    copies[71] = new CopyPixel( 14, 43, 0, 14 );
275
+    copies[72] = new CopyPixel( 14, 43, 1, 14 );
276
+    copies[73] = new CopyPixel( 16, 45, 0, 14 );
277
+    copies[74] = new CopyPixel( 16, 45, 1, 14 );
278
+    copies[75] = new CopyPixel( 18, 21, 0, 15 );
279
+    copies[76] = new CopyPixel( 18, 20, 0, 15 );
280
+    copies[77] = new CopyPixel( 18, 20, 1, 15 );
281
+    copies[78] = new CopyPixel( 18, 22, 0, 15 );
282
+    copies[79] = new CopyPixel( 18, 22, 1, 15 );
283
+    copies[80] = new CopyPixel( 18, 27, 0, 16 );
284
+    copies[81] = new CopyPixel( 18, 26, 0, 16 );
285
+    copies[82] = new CopyPixel( 18, 26, 1, 16 );
286
+    copies[83] = new CopyPixel( 18, 28, 0, 16 );
287
+    copies[84] = new CopyPixel( 18, 28, 1, 16 );
288
+    copies[85] = new CopyPixel( 18, 33, 0, 17 );
289
+    copies[86] = new CopyPixel( 18, 32, 0, 17 );
290
+    copies[87] = new CopyPixel( 18, 32, 1, 17 );
291
+    copies[88] = new CopyPixel( 18, 34, 0, 17 );
292
+    copies[89] = new CopyPixel( 18, 34, 1, 17 );
293
+    copies[90] = new CopyPixel( 18, 39, 0, 18 );
294
+    copies[91] = new CopyPixel( 18, 38, 0, 18 );
295
+    copies[92] = new CopyPixel( 18, 38, 1, 18 );
296
+    copies[93] = new CopyPixel( 18, 40, 0, 18 );
297
+    copies[94] = new CopyPixel( 18, 40, 1, 18 );
298
+    copies[95] = new CopyPixel( 19, 5, 0, 19 );
299
+    copies[96] = new CopyPixel( 18, 5, 0, 19 );
300
+    copies[97] = new CopyPixel( 18, 5, 1, 19 );
301
+    copies[98] = new CopyPixel( 20, 5, 0, 19 );
302
+    copies[99] = new CopyPixel( 20, 5, 1, 19 );
303
+    copies[100] = new CopyPixel( 19, 45, 0, 20 );
304
+    copies[101] = new CopyPixel( 19, 44, 0, 20 );
305
+    copies[102] = new CopyPixel( 19, 44, 1, 20 );
306
+    copies[103] = new CopyPixel( 19, 46, 0, 20 );
307
+    copies[104] = new CopyPixel( 19, 46, 1, 20 );
308
+    copies[105] = new CopyPixel( 19, 50, 0, 21 );
309
+    copies[106] = new CopyPixel( 20, 49, 0, 21 );
310
+    copies[107] = new CopyPixel( 20, 49, 1, 21 );
311
+    copies[108] = new CopyPixel( 18, 51, 0, 21 );
312
+    copies[109] = new CopyPixel( 18, 51, 1, 21 );
313
+    copies[110] = new CopyPixel( 20, 53, 0, 22 );
314
+    copies[111] = new CopyPixel( 21, 52, 0, 22 );
315
+    copies[112] = new CopyPixel( 21, 52, 1, 22 );
316
+    copies[113] = new CopyPixel( 19, 54, 0, 22 );
317
+    copies[114] = new CopyPixel( 19, 54, 1, 22 );
318
+    copies[115] = new CopyPixel( 22, 17, 0, 23 );
319
+    copies[116] = new CopyPixel( 23, 16, 0, 23 );
320
+    copies[117] = new CopyPixel( 23, 16, 1, 23 );
321
+    copies[118] = new CopyPixel( 21, 18, 0, 23 );
322
+    copies[119] = new CopyPixel( 21, 18, 1, 23 );
323
+    copies[120] = new CopyPixel( 22, 24, 0, 24 );
324
+    copies[121] = new CopyPixel( 23, 23, 0, 24 );
325
+    copies[122] = new CopyPixel( 23, 23, 1, 24 );
326
+    copies[123] = new CopyPixel( 21, 25, 0, 24 );
327
+    copies[124] = new CopyPixel( 21, 25, 1, 24 );
328
+    copies[125] = new CopyPixel( 22, 45, 0, 25 );
329
+    copies[126] = new CopyPixel( 22, 44, 0, 25 );
330
+    copies[127] = new CopyPixel( 22, 44, 1, 25 );
331
+    copies[128] = new CopyPixel( 22, 46, 0, 25 );
332
+    copies[129] = new CopyPixel( 22, 46, 1, 25 );
333
+    copies[130] = new CopyPixel( 23, 54, 0, 26 );
334
+    copies[131] = new CopyPixel( 24, 53, 0, 26 );
335
+    copies[132] = new CopyPixel( 24, 53, 1, 26 );
336
+    copies[133] = new CopyPixel( 22, 55, 0, 26 );
337
+    copies[134] = new CopyPixel( 22, 55, 1, 26 );
338
+    copies[135] = new CopyPixel( 24, 49, 0, 27 );
339
+    copies[136] = new CopyPixel( 25, 48, 0, 27 );
340
+    copies[137] = new CopyPixel( 25, 48, 1, 27 );
341
+    copies[138] = new CopyPixel( 23, 50, 0, 27 );
342
+    copies[139] = new CopyPixel( 23, 50, 1, 27 );
343
+    copies[140] = new CopyPixel( 25, 6, 0, 28 );
344
+    copies[141] = new CopyPixel( 24, 5, 0, 28 );
345
+    copies[142] = new CopyPixel( 24, 5, 1, 28 );
346
+    copies[143] = new CopyPixel( 26, 7, 0, 28 );
347
+    copies[144] = new CopyPixel( 26, 7, 1, 28 );
348
+    copies[145] = new CopyPixel( 25, 30, 0, 29 );
349
+    copies[146] = new CopyPixel( 26, 29, 0, 29 );
350
+    copies[147] = new CopyPixel( 26, 29, 1, 29 );
351
+    copies[148] = new CopyPixel( 24, 31, 0, 29 );
352
+    copies[149] = new CopyPixel( 24, 31, 1, 29 );
353
+    copies[150] = new CopyPixel( 26, 12, 0, 30 );
354
+    copies[151] = new CopyPixel( 26, 11, 0, 30 );
355
+    copies[152] = new CopyPixel( 26, 11, 1, 30 );
356
+    copies[153] = new CopyPixel( 26, 13, 0, 30 );
357
+    copies[154] = new CopyPixel( 26, 13, 1, 30 );
358
+    copies[155] = new CopyPixel( 26, 18, 0, 31 );
359
+    copies[156] = new CopyPixel( 26, 17, 0, 31 );
360
+    copies[157] = new CopyPixel( 26, 17, 1, 31 );
361
+    copies[158] = new CopyPixel( 26, 19, 0, 31 );
362
+    copies[159] = new CopyPixel( 26, 19, 1, 31 );
363
+    copies[160] = new CopyPixel( 26, 24, 0, 32 );
364
+    copies[161] = new CopyPixel( 26, 23, 0, 32 );
365
+    copies[162] = new CopyPixel( 26, 23, 1, 32 );
366
+    copies[163] = new CopyPixel( 26, 25, 0, 32 );
367
+    copies[164] = new CopyPixel( 26, 25, 1, 32 );
368
+    copies[165] = new CopyPixel( 27, 50, 0, 33 );
369
+    copies[166] = new CopyPixel( 28, 49, 0, 33 );
370
+    copies[167] = new CopyPixel( 28, 49, 1, 33 );
371
+    copies[168] = new CopyPixel( 26, 51, 0, 33 );
372
+    copies[169] = new CopyPixel( 26, 51, 1, 33 );
373
+    copies[170] = new CopyPixel( 29, 54, 0, 34 );
374
+    copies[171] = new CopyPixel( 28, 53, 0, 34 );
375
+    copies[172] = new CopyPixel( 28, 53, 1, 34 );
376
+    copies[173] = new CopyPixel( 30, 55, 0, 34 );
377
+    copies[174] = new CopyPixel( 30, 55, 1, 34 );
378
+    copies[175] = new CopyPixel( 31, 60, 0, 35 );
379
+    copies[176] = new CopyPixel( 31, 59, 0, 35 );
380
+    copies[177] = new CopyPixel( 31, 59, 1, 35 );
381
+    copies[178] = new CopyPixel( 31, 61, 0, 35 );
382
+    copies[179] = new CopyPixel( 31, 61, 1, 35 );
383
+    copies[180] = new CopyPixel( 32, 51, 0, 36 );
384
+    copies[181] = new CopyPixel( 31, 51, 0, 36 );
385
+    copies[182] = new CopyPixel( 31, 51, 1, 36 );
386
+    copies[183] = new CopyPixel( 33, 51, 0, 36 );
387
+    copies[184] = new CopyPixel( 33, 51, 1, 36 );
388
+    copies[185] = new CopyPixel( 33, 47, 0, 37 );
389
+    copies[186] = new CopyPixel( 34, 46, 0, 37 );
390
+    copies[187] = new CopyPixel( 34, 46, 1, 37 );
391
+    copies[188] = new CopyPixel( 32, 48, 0, 37 );
392
+    copies[189] = new CopyPixel( 32, 48, 1, 37 );
393
+    copies[190] = new CopyPixel( 35, 55, 0, 38 );
394
+    copies[191] = new CopyPixel( 34, 55, 0, 38 );
395
+    copies[192] = new CopyPixel( 34, 55, 1, 38 );
396
+    copies[193] = new CopyPixel( 36, 55, 0, 38 );
397
+    copies[194] = new CopyPixel( 36, 55, 1, 38 );
398
+    copies[195] = new CopyPixel( 38, 51, 0, 39 );
399
+    copies[196] = new CopyPixel( 37, 51, 0, 39 );
400
+    copies[197] = new CopyPixel( 37, 51, 1, 39 );
401
+    copies[198] = new CopyPixel( 39, 51, 0, 39 );
402
+    copies[199] = new CopyPixel( 39, 51, 1, 39 );
403
+    copies[200] = new CopyPixel( 39, 46, 0, 40 );
404
+    copies[201] = new CopyPixel( 39, 45, 0, 40 );
405
+    copies[202] = new CopyPixel( 39, 45, 1, 40 );
406
+    copies[203] = new CopyPixel( 39, 47, 0, 40 );
407
+    copies[204] = new CopyPixel( 39, 47, 1, 40 );
408
+    copies[205] = new CopyPixel( 44, 52, 0, 41 );
409
+    copies[206] = new CopyPixel( 43, 51, 0, 41 );
410
+    copies[207] = new CopyPixel( 43, 51, 1, 41 );
411
+    copies[208] = new CopyPixel( 45, 53, 0, 41 );
412
+    copies[209] = new CopyPixel( 45, 53, 1, 41 );
413
+    setCopies( copies );
414
+  }
415
+}
... ...
@@ -0,0 +1,18 @@
1
+/* BlinkenLightsInteractiveMovieProgram
2
+ * Copyright (C) 2019: Stefan Schuermans <stefan@blinkenarea.org>
3
+ * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
4
+ * a blinkenarea.org project
5
+ */
6
+
7
+package org.blinkenarea.Blimp;
8
+
9
+import org.blinkenarea.BlinkenLib.*;
10
+
11
+public interface FrameTemplateIf
12
+{
13
+  /// get template format as string
14
+  public String getFormat( );
15
+
16
+  /// apply template to frame - potentially modifying size and content
17
+  public void apply( BlinkenFrame frame );
18
+}
... ...
@@ -0,0 +1,155 @@
1
+/* BlinkenLightsInteractiveMovieProgram
2
+ * Copyright (C) 2019: Stefan Schuermans <stefan@blinkenarea.org>
3
+ * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
4
+ * a blinkenarea.org project
5
+ */
6
+
7
+package org.blinkenarea.Blimp;
8
+
9
+import org.blinkenarea.BlinkenLib.*;
10
+
11
+/// a template based on list of modifiable pixels and copied pixels
12
+public class FrameTemplatePixelLists implements FrameTemplateIf
13
+{
14
+  /// location and color of a fixed pixel
15
+  protected class FixedPixel {
16
+    public int y, x, c; ///< location
17
+    public byte val; ///< value
18
+    public FixedPixel( int y_, int x_, int c_, byte val_ ) {
19
+      y = y_;
20
+      x = x_;
21
+      c = c_;
22
+      val = val_;
23
+    }
24
+  };
25
+
26
+  /// location of a content pixel
27
+  protected class ContentPixel {
28
+    public int y, x, c; ///< source location of content
29
+    public ContentPixel( int y_, int x_, int c_ ) {
30
+      y = y_;
31
+      x = x_;
32
+      c = c_;
33
+    }
34
+  };
35
+
36
+  /// a copy of a content pixel
37
+  protected class CopyPixel {
38
+    public int y, x, c; ///< destination position
39
+    public int contentIdx; ///< index of content pixel
40
+    public CopyPixel( int y_, int x_, int c_, int contentIdx_ ) {
41
+      y = y_;
42
+      x = x_;
43
+      c = c_;
44
+      contentIdx = contentIdx_;
45
+    }
46
+  }
47
+
48
+  int height, width, channels, maxval;
49
+  /// default color (for fixed pixels), must be of length channels
50
+  byte defColor[];
51
+  /// fixed pixels
52
+  FixedPixel fixed[];
53
+  /// actual content
54
+  ContentPixel content[];
55
+  /// copies of content pixels: copies[i] = { y, x, c, index }
56
+  CopyPixel copies[];
57
+  /// local buffer for content pixel colors (used in apply())
58
+  byte contentBuf[];
59
+
60
+  public FrameTemplatePixelLists( int height_, int width_, int channels_,
61
+                                  int maxval_ )
62
+  {
63
+    height = height_;
64
+    width = width_;
65
+    channels = channels_;
66
+    maxval = maxval_;
67
+    defColor = null;
68
+    fixed = null;
69
+    content = null;
70
+    copies = null;
71
+    contentBuf = null;
72
+  }
73
+
74
+  protected void setDefColor( byte defColor_[] )
75
+  {
76
+    defColor = defColor_;
77
+  }
78
+
79
+  protected void setFixed( FixedPixel fixed_[] )
80
+  {
81
+    fixed = fixed_;
82
+  }
83
+
84
+  protected void setContent( ContentPixel content_[] )
85
+  {
86
+    content = content_;
87
+    if( content == null ) {
88
+      contentBuf = null;
89
+    } else {
90
+      contentBuf = new byte [content.length];
91
+    }
92
+  }
93
+
94
+  protected void setCopies( CopyPixel copies_[] )
95
+  {
96
+    copies = copies_;
97
+  }
98
+
99
+  /// get template format as string
100
+  public String getFormat( )
101
+  {
102
+    return width + "x" + height + "-" + channels + "/" + (maxval + 1);
103
+  }
104
+
105
+  public void apply( BlinkenFrame frame )
106
+  {
107
+    // ensure frame has desired size (no-op if size is already equal)
108
+    frame.resize( height, width, channels, maxval );
109
+
110
+    // get content pixels
111
+    if( content != null ) {
112
+      for( int i = 0; i < content.length; ++i ) {
113
+        ContentPixel cp = content[i];
114
+        contentBuf[i] = frame.getPixel( cp.y, cp.x, cp.c );
115
+      }
116
+    }
117
+
118
+    // set entire frame to default color
119
+    if ( defColor != null && defColor.length >= channels ) {
120
+      for( int y = 0; y < height; ++y ) {
121
+        for( int x = 0; x < width; ++x ) {
122
+          for( int c = 0; c < channels; ++c ) {
123
+            frame.setPixel( y, x, c, defColor[c] );
124
+          }
125
+        }
126
+      }
127
+    }
128
+
129
+    // set fixed pixels
130
+    if( fixed != null ) {
131
+      for( int i = 0; i < fixed.length; ++i ) {
132
+        FixedPixel fp = fixed[i];
133
+        frame.setPixel( fp.y, fp.x, fp.c, fp.val );
134
+      }
135
+    }
136
+
137
+    // set content pixels
138
+    if( content != null ) {
139
+      for( int i = 0; i < content.length; ++i ) {
140
+        ContentPixel ct = content[i];
141
+        frame.setPixel( ct.y, ct.x, ct.c, contentBuf[i] );
142
+      }
143
+    }
144
+
145
+    // set copy pixels
146
+    if( copies != null && content != null ) {
147
+      for( int i = 0; i < copies.length; ++i ) {
148
+        CopyPixel cp = copies[i];
149
+        if( cp.contentIdx < content.length ) {
150
+          frame.setPixel( cp.y, cp.x, cp.c, contentBuf[cp.contentIdx] );
151
+        }
152
+      }
153
+    }
154
+  }
155
+}
0 156