Blimp v.0.6 (2005-03-10)
Christian Heimke

Christian Heimke commited on 2011-07-15 09:16:52
Showing 11 changed files, with 117 additions and 39 deletions.

... ...
@@ -1,6 +1,6 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 0.5 date 2004-11-19
3
- * Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+ * version 0.6 date 2005-03-10
3
+ * Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6
  * powered by eventphone.de
... ...
@@ -39,11 +39,13 @@ public class Blimp extends JApplet
39 39
   JMenu menuFile, menuInfo, menuEdit, menuPlay, menuHelp; //menus
40 40
   JMenuItem menuFileNew, menuFileLoad, menuFileSave, menuFileSaveAs, menuFileQuit;
41 41
   JMenuItem menuInfoShow, menuInfoAdd, menuInfoDelete;
42
-  JMenuItem menuEditResize, menuEditScale, menuEditInsertFrame, menuEditDuplicateFrame, menuEditDeleteFrame;
42
+  JMenuItem menuEditResize, menuEditScale;
43
+  JMenuItem menuEditInsertFrame, menuEditDuplicateFrame, menuEditDeleteFrame;
44
+  JMenuItem menuEditImportFrame;
43 45
   JMenuItem menuPlayStart, menuPlayStop;
44 46
   JCheckBoxMenuItem menuPlayBegin, menuPlayLoop;
45 47
   JMenuItem menuHelpAbout;
46
-  JPanel panel, panelStatus, panelMain, panelFrames, panelOuterFrame; //panels of in window
48
+  JPanel panel, panelStatus, panelMain, panelFrames, panelOuterFrame; //panels of main window
47 49
   JPanel panelMiddleFrame, panelFrame, panelDuration, panelColors;
48 50
   JLabel labelStatus, labelFrames, labelFrameInfo, labelDuration;
49 51
   JScrollBar scrollFrames;
... ...
@@ -143,7 +145,7 @@ public class Blimp extends JApplet
143 145
     labelStatus.setText( "new movie..." );
144 146
     curFile = null;
145 147
     curMovie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval );
146
-    curMovie.insertInfo( 0, "creator", "Blimp (version 0.5 date 2004-11-19)" );
148
+    curMovie.insertInfo( 0, "creator", "Blimp (version 0.6 date 2005-03-10)" );
147 149
     curMovie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) );
148 150
     curMovieChanged = false;
149 151
 
... ...
@@ -252,8 +254,6 @@ public class Blimp extends JApplet
252 254
   //"File Quit" was chosen from menu
253 255
   private void actionFileQuit( )
254 256
   {
255
-    JFileChooser fileChooser;
256
-
257 257
     //ask if to save changes
258 258
     if( askSaveChanges( ) ) //returns true on cancel
259 259
       return;
... ...
@@ -533,6 +533,74 @@ public class Blimp extends JApplet
533 533
     updateFrames( frameNo );
534 534
   }
535 535
 
536
+  //"Edit Import Frame..." was chosen from menu
537
+  private void actionEditImportFrame( )
538
+  {
539
+    JFileChooser fileChooser;
540
+    ImageIcon icon;
541
+    Image image;
542
+    BufferedImage bufferedImage;
543
+    BlinkenFrame frame;
544
+    int width, height, x, y, frameCnt, frameNo;
545
+
546
+    //show file select dialog
547
+    fileChooser = new JFileChooser( );
548
+    fileChooser.setDialogTitle( "Blimp - Import Frame..." );
549
+    if( curDir != null )
550
+      fileChooser.setCurrentDirectory( curDir );
551
+    if( fileChooser.showOpenDialog( dialogParent ) != JFileChooser.APPROVE_OPTION ) //not successful
552
+      return;
553
+    //save current directory
554
+    curDir = fileChooser.getCurrentDirectory( );
555
+
556
+    //load image
557
+    icon = new ImageIcon( fileChooser.getSelectedFile( ).getPath( ) );
558
+    if( icon == null )
559
+    {
560
+      labelStatus.setText( "could not import frame from \"" + fileChooser.getSelectedFile( ).getPath( ) +  "\"..." );
561
+      return;
562
+    }
563
+    width = icon.getIconWidth( );
564
+    height = icon.getIconHeight( );
565
+    image = icon.getImage( );
566
+    if( width <= 0 || height <= 0 || image == null )
567
+    {
568
+      labelStatus.setText( "could not import frame from \"" + fileChooser.getSelectedFile( ).getPath( ) +  "\"..." );
569
+      return;
570
+    }
571
+    //convert image to a buffered one
572
+    bufferedImage = new BufferedImage( width, height, BufferedImage.TYPE_INT_ARGB );
573
+    bufferedImage.getGraphics( ).drawImage( image, 0, 0, width, height, null );
574
+
575
+    //create new empty frame
576
+    frame = new BlinkenFrame( height, width,
577
+                              curMovie.getChannels( ), curMovie.getMaxval( ), defDuration );
578
+    height = frame.getHeight( ); //dimensions might have been invalid and thus been adapted
579
+    width = frame.getWidth( );
580
+    frame.clear( );
581
+
582
+    //put pixels of image into frame
583
+    for( y = 0; y < height; y++ )
584
+      for( x = 0; x < width; x++ )
585
+        frame.setColor( y, x, new Color( bufferedImage.getRGB( x, y ) ) );
586
+
587
+    //insert frame behind current position
588
+    frameCnt = curMovie.getFrameCnt( );
589
+    frameNo = scrollFrames.getValue( ) + 1;
590
+    if( frameNo < 0 )
591
+      frameNo = 0;
592
+    if( frameNo > frameCnt )
593
+      frameNo = frameCnt;
594
+    curMovie.insertFrame( frameNo, frame ); //this resizes the frame to fit the movie dimensions
595
+    curMovieChanged = true;
596
+
597
+    //show status message
598
+    labelStatus.setText( "frame was sucessfully imported from \"" + fileChooser.getSelectedFile( ).getPath( ) +  "\"..." );
599
+
600
+    //update controls
601
+    updateFrames( frameNo );
602
+  }
603
+
536 604
   //"Play Start" was chosen from menu
537 605
   private void actionPlayStart( )
538 606
   {
... ...
@@ -613,8 +681,8 @@ public class Blimp extends JApplet
613 681
   {
614 682
     JOptionPane.showMessageDialog( dialogParent,
615 683
                                    "BlinkenLightsInteractiveMovieProgram\n" +
616
-                                   "version 0.5 date 2004-11-19\n" +
617
-                                   "Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>\n" +
684
+                                   "version 0.6 date 2005-03-10\n" +
685
+                                   "Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>\n" +
618 686
                                    "Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" +
619 687
                                    "a blinkenarea.org project\n" +
620 688
                                    "powered by eventphone.de",
... ...
@@ -1069,6 +1137,8 @@ public class Blimp extends JApplet
1069 1137
       actionEditDuplicateFrame( );
1070 1138
     else if( e.getSource( ) == menuEditDeleteFrame )
1071 1139
       actionEditDeleteFrame( );
1140
+    else if( e.getSource( ) == menuEditImportFrame )
1141
+      actionEditImportFrame( );
1072 1142
     else if( e.getSource( ) == menuPlayStart )
1073 1143
       actionPlayStart( );
1074 1144
     else if( e.getSource( ) == menuPlayStop )
... ...
@@ -1247,7 +1317,7 @@ public class Blimp extends JApplet
1247 1317
     //initialize current movie, frame
1248 1318
     curDir = new File( "." );
1249 1319
     curMovie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval );
1250
-    curMovie.insertInfo( 0, "creator", "Blimp (version 0.5 date 2004-11-19)" );
1320
+    curMovie.insertInfo( 0, "creator", "Blimp (version 0.6 date 2005-03-10)" );
1251 1321
     curMovie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) );
1252 1322
     curFrame = null;
1253 1323
 
... ...
@@ -1338,6 +1408,10 @@ public class Blimp extends JApplet
1338 1408
     menuEditDeleteFrame.setEnabled( false );
1339 1409
     menuEditDeleteFrame.addActionListener( this );
1340 1410
     menuEdit.add( menuEditDeleteFrame );
1411
+    menuEdit.addSeparator( );
1412
+    menuEditImportFrame = new JMenuItem( "Import Frame..." );
1413
+    menuEditImportFrame.addActionListener( this );
1414
+    menuEdit.add( menuEditImportFrame );
1341 1415
     //play menu
1342 1416
     menuPlay = new JMenu( "Play" );
1343 1417
     menubar.add( menuPlay );
... ...
@@ -1709,8 +1783,8 @@ public class Blimp extends JApplet
1709 1783
 
1710 1784
     //running as command line tool
1711 1785
     System.out.println( "BlinkenLightsInteractiveMovieProgram\n" +
1712
-                        "version 0.5 date 2004-11-19\n" +
1713
-                        "Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>\n" +
1786
+                        "version 0.6 date 2005-03-10\n" +
1787
+                        "Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>\n" +
1714 1788
                         "Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html\n" +
1715 1789
                         "a blinkenarea.org project\n" +
1716 1790
                         "powered by eventphone.de\n" );
... ...
@@ -1721,7 +1795,7 @@ public class Blimp extends JApplet
1721 1795
 
1722 1796
     //get initial movie
1723 1797
     movie = new BlinkenMovie( defHeight, defWidth, defChannels, defMaxval );
1724
-    movie.insertInfo( 0, "creator", "Blimp (version 0.5 date 2004-11-19)" );
1798
+    movie.insertInfo( 0, "creator", "Blimp (version 0.6 date 2005-03-10)" );
1725 1799
     movie.insertFrame( 0, new BlinkenFrame( defHeight, defWidth, defChannels, defMaxval, defDuration ) );
1726 1800
 
1727 1801
     //process parameters
... ...
@@ -1,6 +1,6 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 0.5 date 2004-11-19
3
- * Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+ * version 0.6 date 2005-03-10
3
+ * Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6
  * powered by eventphone.de
... ...
@@ -1,6 +1,6 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 0.5 date 2004-11-19
3
- * Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+ * version 0.6 date 2005-03-10
3
+ * Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6
  * powered by eventphone.de
... ...
@@ -353,7 +353,7 @@ public class BlinkenFrame
353 353
       {
354 354
         val = 0;
355 355
         for( val = 0, c = 0; c < channels; c++ )
356
-          val += (data[h][w][c] & 0xFF);
356
+          val += ((int)data[h][w][c] & 0xFF);
357 357
         val = val * 7 / maxval / channels;
358 358
         str = str + " -+*%#&@".substring( val, val + 1); 
359 359
       }
... ...
@@ -1,6 +1,6 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 0.5 date 2004-11-19
3
- * Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+ * version 0.6 date 2005-03-10
3
+ * Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6
  * powered by eventphone.de
... ...
@@ -1,6 +1,6 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 0.5 date 2004-11-19
3
- * Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+ * version 0.6 date 2005-03-10
3
+ * Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6
  * powered by eventphone.de
... ...
@@ -1,6 +1,6 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 0.5 date 2004-11-19
3
- * Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+ * version 0.6 date 2005-03-10
3
+ * Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6
  * powered by eventphone.de
... ...
@@ -1,6 +1,6 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 0.5 date 2004-11-19
3
- * Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+ * version 0.6 date 2005-03-10
3
+ * Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6
  * powered by eventphone.de
... ...
@@ -1,6 +1,6 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 0.5 date 2004-11-19
3
- * Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+ * version 0.6 date 2005-03-10
3
+ * Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6
  * powered by eventphone.de
... ...
@@ -1,6 +1,6 @@
1 1
 /* BlinkenLightsInteractiveMovieProgram
2
- * version 0.5 date 2004-11-19
3
- * Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+ * version 0.6 date 2005-03-10
3
+ * Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
  * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
  * a blinkenarea.org project
6 6
  * powered by eventphone.de
... ...
@@ -573,9 +573,9 @@ public class BlinkenMovie
573 573
               //get attributes
574 574
               width = 0;
575 575
               height = 0;
576
-              channels = 0;
577
-              bits = 0;
578
-              maxval = 0;
576
+              channels = 1;
577
+              bits = 4;
578
+              maxval = 15;
579 579
               if( (submatcher = blmHeight.matcher( matcher.group( 1 ) )).find( ) ) //height
580 580
                 height = Integer.parseInt( submatcher.group( 1 ) );
581 581
               if( (submatcher = blmWidth.matcher( matcher.group( 1 ) )).find( ) ) //width
... ...
@@ -783,7 +783,7 @@ public class BlinkenMovie
783 783
           subHeaderSize = ((int)subHeader[4] & 0xFF) << 8 | ((int)subHeader[5] & 0xFF);
784 784
 
785 785
           //header fits into gap to frame start
786
-          if( file.getFilePointer( ) + subHeaderSize - 6 <= headerFramePtr )
786
+          if( subHeaderSize >= 6 && file.getFilePointer( ) + subHeaderSize - 6 <= headerFramePtr )
787 787
           {
788 788
             //info header
789 789
             if( subHeaderMagic == 0x696E666F ) //'i' 'n' 'f' 'o'
... ...
@@ -1,9 +1,15 @@
1 1
 BlinkenLightsInteractiveMovieProgram
2
-Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
3 3
 Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
4 4
 a blinkenarea.org project
5 5
 powered by eventphone.de
6 6
 
7
+version 0.6 date 2005-03-10
8
+---------------------------
9
+ - fixed a bug with corrupt bbm files (sub header size < 6)
10
+ - loading *.bml: channels="1", bits="4" is now default
11
+ - added importing frames from image files
12
+
7 13
 version 0.5 date 2004-11-19
8 14
 ---------------------------
9 15
  - fixed a bug in channels 3..inf when drawing with alpha < 255
... ...
@@ -1,6 +1,6 @@
1 1
 # BlinkenLightsInteractiveMovieProgram
2
-# version 0.5 date 2004-11-19
3
-# Copyright (C) 2004: Stefan Schuermans <1stein@schuermans.info>
2
+# version 0.6 date 2005-03-10
3
+# Copyright (C) 2004-2005: Stefan Schuermans <1stein@schuermans.info>
4 4
 # Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
5 5
 # a blinkenarea.org project
6 6
 # powered by eventphone.de
... ...
@@ -11,8 +11,6 @@ KEYTOOL=keytool
11 11
 JARSIGNER=jarsigner
12 12
 KEYPASS=BlinkenLightsInteractiveMovieProgram
13 13
 JAVA=java
14
-UPLOAD_CMD=scp -r
15
-UPLOAD_DEST=gate:~/www/html/Blimp/
16 14
 
17 15
 CLASS_FILES=BlinkenFileFilter.class BlinkenFrame.class BlinkenFrameDisplay.class \
18 16
             BlinkenFrameDisplayListener.class BlinkenFrameDisplayInterceptor.class \
19 17