From 537f4ac57ae2b34f0a04fa63874c8ca6534c9a6d Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Tue, 20 Aug 2019 02:31:25 -0400 Subject: [PATCH] Faster JPG reader. --- ObjEditor.java | 82 +++++++++++++++++++++++++++++++++++++---- 1 files changed, 74 insertions(+), 8 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index 098f83d..a9b5c11 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -134,8 +134,14 @@ try { - BufferedImage image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); - + BufferedImage image; + + if (name.endsWith("jpg")) + // Much faster! + image = new sun.awt.image.codec.JPEGImageDecoderImpl(ObjEditor.class.getClassLoader().getResourceAsStream(name)).decodeAsBufferedImage(); + else + image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream(name)); + // if (image.getWidth() > 48 && image.getHeight() > 48) // { // BufferedImage resized = new BufferedImage(48, 48, image.getType()); @@ -460,8 +466,11 @@ importOBJItem.addActionListener(this); import3DSItem = menu.add(new MenuItem("3DS file...")); import3DSItem.addActionListener(this); + if (Globals.ADVANCED) + { importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file...")); importVRMLX3DItem.addActionListener(this); + } menu.add("-"); importGFDItem = menu.add(new MenuItem("Grafreed file...")); importGFDItem.addActionListener(this); @@ -1786,14 +1795,14 @@ cGridBag creditsPanel = new cGridBag().setVertical(true); creditsPanel.setName("Credits"); - cLabel ogaLabel = new cLabel(" Most Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); + cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); creditsPanel.add(ogaLabel); - cButton opengameartButton; - creditsPanel.add(opengameartButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); - opengameartButton.setToolTipText("https://opengameart.org"); + cButton creditButton; + creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); + creditButton.setToolTipText("https://opengameart.org"); - opengameartButton.addMouseListener(new MouseAdapter() + creditButton.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { @@ -1808,7 +1817,64 @@ } }); - for (int i=10; --i>=0;) + ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF); + creditsPanel.add(ogaLabel); + + creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF)); + creditButton.setToolTipText("https://3delicious.net"); + + creditButton.addMouseListener(new MouseAdapter() + { + public void mouseClicked(MouseEvent e) + { + try + { + Desktop.getDesktop().browse(new java.net.URI("https://3delicious.net")); + } catch (Exception e1) +// } catch (java.io.IOException | java.net.URISyntaxException e1) + { + e1.printStackTrace(); + } + } + }); + + creditsPanel.add(creditButton = GetButton("icons/archive3d.png", !Globals.NIMBUSLAF)); + creditButton.setToolTipText("https://archive3d.net"); + + creditButton.addMouseListener(new MouseAdapter() + { + public void mouseClicked(MouseEvent e) + { + try + { + Desktop.getDesktop().browse(new java.net.URI("https://archive3d.net")); + } catch (Exception e1) +// } catch (java.io.IOException | java.net.URISyntaxException e1) + { + e1.printStackTrace(); + } + } + }); + + creditsPanel.add(creditButton = GetButton("icons/turbosquid.png", !Globals.NIMBUSLAF)); + creditButton.setToolTipText("https://turbosquid.com"); + + creditButton.addMouseListener(new MouseAdapter() + { + public void mouseClicked(MouseEvent e) + { + try + { + Desktop.getDesktop().browse(new java.net.URI("https://www.turbosquid.com/Search/3D-Models/free")); + } catch (Exception e1) +// } catch (java.io.IOException | java.net.URISyntaxException e1) + { + e1.printStackTrace(); + } + } + }); + + for (int i=6; --i>=0;) { creditsPanel.add(new cGridBag()); } -- Gitblit v1.6.2