|
@@ -6,40 +6,52 @@
|
|
|
|
|
|
package de.nplusc.izc.izstreamer;
|
|
|
|
|
|
+import de.nplusc.izc.tools.UiToolz.HoloJPanel;
|
|
|
import de.nplusc.izc.tools.baseTools.Messagers;
|
|
|
import java.awt.Canvas;
|
|
|
+import java.awt.Color;
|
|
|
import java.awt.Desktop;
|
|
|
+import java.awt.Font;
|
|
|
import java.awt.Graphics;
|
|
|
import java.awt.Graphics2D;
|
|
|
+import java.awt.Image;
|
|
|
import java.awt.event.ActionEvent;
|
|
|
import java.awt.event.MouseAdapter;
|
|
|
import java.awt.event.MouseEvent;
|
|
|
import java.awt.event.MouseMotionAdapter;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
+import java.awt.image.ImageObserver;
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URI;
|
|
|
import java.net.URISyntaxException;
|
|
|
+import java.net.URL;
|
|
|
import java.nio.ByteBuffer;
|
|
|
import java.util.zip.CRC32;
|
|
|
+import javax.imageio.ImageIO;
|
|
|
import javax.swing.JButton;
|
|
|
import javax.swing.JFrame;
|
|
|
import javax.swing.JLabel;
|
|
|
import javax.swing.JPanel;
|
|
|
import javax.swing.JSlider;
|
|
|
import javax.swing.WindowConstants;
|
|
|
+import org.apache.commons.io.FileUtils;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @author LH
|
|
|
*/
|
|
|
|
|
|
-public class VisualizedGUI extends JFrame implements PlayerStructure
|
|
|
+public class VisualizedGUI extends JFrame implements PlayerStructure, ImageObserver
|
|
|
{
|
|
|
private boolean eeggt=false;
|
|
|
+ private boolean eeggd=false;
|
|
|
private BufferedImage image;
|
|
|
private final int x = iZstreamer.width;
|
|
|
private final int y = iZstreamer.height;
|
|
|
private Canvas surface;
|
|
|
+ HoloJPanel drawer = new HoloJPanel();
|
|
|
+ private VisualizedGUI thiz ;
|
|
|
|
|
|
// @Override
|
|
|
/* public void display(DirectMediaPlayer mediaPlayer, Memory[] nativeBuffer, BufferFormat bufferFormat)
|
|
@@ -66,25 +78,86 @@ public class VisualizedGUI extends JFrame implements PlayerStructure
|
|
|
{
|
|
|
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
|
}
|
|
|
-
|
|
|
+ BufferedImage i2=null;
|
|
|
MouseAdapter eegg = new MouseAdapter()
|
|
|
{
|
|
|
private int progress=0;
|
|
|
private String urlin = "";
|
|
|
+ private String dfile = "";
|
|
|
@Override
|
|
|
public void mouseClicked(MouseEvent e)
|
|
|
{
|
|
|
+ progress++;
|
|
|
//
|
|
|
eeggt=true;
|
|
|
//Messagers.SingleLineMsg(String.format("%8h",temp.getValue()), "NOP");
|
|
|
- urlin+=iZstreamer.magic[e.getX()/5]+"|";
|
|
|
- if(progress>13)
|
|
|
+ urlin+=iZstreamer.magic[e.getX()/7]+"|";
|
|
|
+ System.out.println(urlin);
|
|
|
+ if(progress>=13)
|
|
|
{
|
|
|
- CRC32 temp = new CRC32()
|
|
|
- urlin= "nplusc.de/"+String
|
|
|
-
|
|
|
+ eeggd=true;
|
|
|
+ CRC32 temp = new CRC32();
|
|
|
+ temp.update(urlin.getBytes());
|
|
|
+ long temp2=temp.getValue();
|
|
|
+ urlin= "http://nplusc.de/"+String.format("%8h", temp2)+".png";
|
|
|
+ dfile=iZstreamer.jpath+"\\"+String.format("%8h", temp2)+".png";
|
|
|
+ System.out.println(dfile);
|
|
|
tit.removeMouseListener(eegg);//einweggag
|
|
|
- new Thread(()->{}).start();
|
|
|
+ System.out.println(urlin);
|
|
|
+ new Thread(() ->
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+
|
|
|
+ File f = new File(dfile);
|
|
|
+ FileUtils.copyURLToFile(new URL(urlin), f);
|
|
|
+ System.out.println("dled");
|
|
|
+ System.out.println(f.length());
|
|
|
+ if(f.length()>5000)
|
|
|
+ {
|
|
|
+ BufferedImage i = ImageIO.read(f);
|
|
|
+ System.out.println("loading");
|
|
|
+
|
|
|
+ BufferedImage surfy = new BufferedImage(x,y,BufferedImage.TYPE_4BYTE_ABGR);
|
|
|
+ /*
|
|
|
+ i = (BufferedImage) i.getScaledInstance(surface.getWidth(), -1, 0);
|
|
|
+ surfy.getGraphics().drawImage(i, 0, 0, thiz);
|
|
|
+ ready=false;
|
|
|
+ //while(!ready);
|
|
|
+ System.out.println("scaling1");
|
|
|
+ if(i.getHeight()>surface.getHeight())
|
|
|
+ {
|
|
|
+ i = (BufferedImage) i2.getScaledInstance(-1, surface.getHeight(), 0);
|
|
|
+ System.out.println("scaling2");
|
|
|
+ }
|
|
|
+ surfy.getGraphics().drawImage(i, 0, 0, thiz);
|
|
|
+ ready=false;
|
|
|
+ // while(!ready);
|
|
|
+
|
|
|
+ */
|
|
|
+ Graphics g =surfy.getGraphics() ;
|
|
|
+ g.setColor(Color.black);
|
|
|
+ g.drawRect(0, 0, x, y);
|
|
|
+ g.fillRect(0, 0, x, y);
|
|
|
+ System.out.println("cleared");
|
|
|
+ g.drawImage(i, x, y, null);
|
|
|
+ Thread.sleep(1200);
|
|
|
+ System.out.println("ready");
|
|
|
+ remove(surface);
|
|
|
+
|
|
|
+ drawer.setdrawIMG(i);
|
|
|
+ drawer.setSize(x,y);
|
|
|
+ drawer.setBounds(0,0,x, y);
|
|
|
+ add(drawer);
|
|
|
+ repaint();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ ex.printStackTrace();
|
|
|
+
|
|
|
+ }
|
|
|
+ }).start();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -99,6 +172,7 @@ public class VisualizedGUI extends JFrame implements PlayerStructure
|
|
|
private boolean playing;
|
|
|
public VisualizedGUI()
|
|
|
{
|
|
|
+ thiz=this;
|
|
|
/*
|
|
|
|
|
|
surface= new EJP();
|
|
@@ -124,6 +198,7 @@ public class VisualizedGUI extends JFrame implements PlayerStructure
|
|
|
//Optimus Prime
|
|
|
tit.setBounds(0, y,x, 15);
|
|
|
tit.addMouseListener(eegg);
|
|
|
+ tit.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
|
|
|
play = new JButton("Play");
|
|
|
play.setBounds(0,y+15,300,80);
|
|
|
info = new JButton("Info");
|
|
@@ -154,6 +229,10 @@ public class VisualizedGUI extends JFrame implements PlayerStructure
|
|
|
add(last20trax);
|
|
|
play.addActionListener((ActionEvent e) ->
|
|
|
{
|
|
|
+ if(eeggd)
|
|
|
+ {remove(drawer);
|
|
|
+ add(surface);
|
|
|
+ }
|
|
|
tit.setText("Now Playing:");
|
|
|
tit.removeMouseListener(eegg);
|
|
|
if (playing)
|
|
@@ -193,7 +272,7 @@ public class VisualizedGUI extends JFrame implements PlayerStructure
|
|
|
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
|
|
validate();
|
|
|
StreamGUI.player.setPlayerStructure(this);
|
|
|
- setResizable(false);
|
|
|
+ setResizable(false);/*
|
|
|
new Thread(() ->
|
|
|
{
|
|
|
try
|
|
@@ -212,7 +291,7 @@ public class VisualizedGUI extends JFrame implements PlayerStructure
|
|
|
tit.setText("Now Playing:");
|
|
|
tit.removeMouseListener(eegg);
|
|
|
}
|
|
|
- }).start();
|
|
|
+ }).start();*/
|
|
|
// setSize(x, y);
|
|
|
}
|
|
|
|
|
@@ -246,4 +325,26 @@ public class VisualizedGUI extends JFrame implements PlayerStructure
|
|
|
}
|
|
|
};
|
|
|
*/
|
|
|
+ private boolean ready = false;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean imageUpdate(final Image img, int infoflags, int x, int y,
|
|
|
+ int width, int height) {
|
|
|
+
|
|
|
+ boolean result = true;
|
|
|
+ if((infoflags | ImageObserver.FRAMEBITS) == ImageObserver.FRAMEBITS){
|
|
|
+ result = false;
|
|
|
+ } else if((infoflags | ImageObserver.ALLBITS) == ImageObserver.ALLBITS){
|
|
|
+ result = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(result){
|
|
|
+ System.out.println("Image incomplete");
|
|
|
+ } else{
|
|
|
+ System.out.println("Complete");
|
|
|
+ }
|
|
|
+ ready=result;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|