Reduced jpg image for background (no visible effect but saves 115 Mb of memory used).

This commit is contained in:
magenoxx 2011-01-23 22:15:26 +03:00
parent c23b065479
commit e286f6ff72
5 changed files with 9 additions and 14 deletions

View file

@ -1,11 +1,6 @@
package mage.components; package mage.components;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp; import java.awt.image.BufferedImageOp;
import java.awt.image.ConvolveOp; import java.awt.image.ConvolveOp;
@ -22,16 +17,16 @@ public class ImagePanel extends JPanel {
public static final int SCALED = 1; public static final int SCALED = 1;
public static final int ACTUAL = 2; public static final int ACTUAL = 2;
private BufferedImage image; private Image image;
private int style; private int style;
private float alignmentX = 0.5f; private float alignmentX = 0.5f;
private float alignmentY = 0.5f; private float alignmentY = 0.5f;
public ImagePanel(BufferedImage image) { public ImagePanel(Image image) {
this(image, TILED); this(image, TILED);
} }
public ImagePanel(BufferedImage image, int style) { public ImagePanel(Image image, int style) {
this.image = image; this.image = image;
this.style = style; this.style = style;
setLayout(new BorderLayout()); setLayout(new BorderLayout());
@ -103,8 +98,8 @@ public class ImagePanel extends JPanel {
private void drawActual(Graphics g) { private void drawActual(Graphics g) {
Dimension d = getSize(); Dimension d = getSize();
float x = (d.width - image.getWidth()) * alignmentX; float x = (d.width - image.getWidth(null)) * alignmentX;
float y = (d.height - image.getHeight()) * alignmentY; float y = (d.height - image.getHeight(null)) * alignmentY;
g.drawImage(image, (int) x, (int) y, this); g.drawImage(image, (int) x, (int) y, this);
} }
} }

View file

@ -34,7 +34,7 @@ public class ThemePluginImpl implements ThemePlugin {
} }
public String toString() { public String toString() {
return "[Theme plugin, version 0.3]"; return "[Theme plugin, version 0.4]";
} }
public void applyInGame(Map<String, JComponent> ui) { public void applyInGame(Map<String, JComponent> ui) {
@ -74,7 +74,7 @@ public class ThemePluginImpl implements ThemePlugin {
} }
public JComponent updateTable(Map<String, JComponent> ui) { public JComponent updateTable(Map<String, JComponent> ui) {
String filename = "/regret.jpg"; String filename = "/background.png";
try { try {
InputStream is = this.getClass().getResourceAsStream(filename); InputStream is = this.getClass().getResourceAsStream(filename);
@ -86,7 +86,7 @@ public class ThemePluginImpl implements ThemePlugin {
if (background == null) if (background == null)
throw new FileNotFoundException("Couldn't find " + filename + " in resources."); throw new FileNotFoundException("Couldn't find " + filename + " in resources.");
ImagePanel bgPanel = new ImagePanel(background, ImagePanel.TILED); ImagePanel bgPanel = new ImagePanel(background, ImagePanel.SCALED);
unsetOpaque(ui.get("jScrollPane1")); unsetOpaque(ui.get("jScrollPane1"));
unsetOpaque(ui.get("jPanel1")); unsetOpaque(ui.get("jPanel1"));

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB