Some minor changes.

This commit is contained in:
LevelX2 2016-10-24 17:55:28 +02:00
parent 070a0ca3fa
commit 8f317305fa
4 changed files with 40 additions and 35 deletions

View file

@ -4,7 +4,6 @@ import com.google.common.base.Function;
import com.google.common.collect.MapMaker;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
@ -16,10 +15,8 @@ import mage.client.util.ImageCaches;
import org.jdesktop.swingx.graphics.GraphicsUtilities;
import org.jdesktop.swingx.graphics.ShadowRenderer;
/**
* Mage round pane with transparency.
* Used for tooltips.
* Mage round pane with transparency. Used for tooltips.
*
* @author nantuko
*/
@ -31,7 +28,7 @@ public class MageRoundPane extends JPanel {
private Color backgroundColor = defaultBackgroundColor;
private final int alpha = 0;
private static Map<ShadowKey, BufferedImage> SHADOW_IMAGE_CACHE;
private static Map<Key, BufferedImage> IMAGE_CACHE;
private static final Map<Key, BufferedImage> IMAGE_CACHE;
static {
SHADOW_IMAGE_CACHE = ImageCaches.register(new MapMaker().softValues().makeComputingMap(new Function<ShadowKey, BufferedImage>() {
@ -49,8 +46,8 @@ public class MageRoundPane extends JPanel {
}));
}
private final static class ShadowKey
{
private final static class ShadowKey {
final int width;
final int height;
@ -89,8 +86,8 @@ public class MageRoundPane extends JPanel {
}
}
private final static class Key
{
private final static class Key {
final int width;
final int height;
final int xOffset;
@ -173,7 +170,6 @@ public class MageRoundPane extends JPanel {
//////////////////////////////////////////////////////////////////
// fill content
/**
* Add white translucent substrate
*/
@ -181,7 +177,6 @@ public class MageRoundPane extends JPanel {
g2.setColor(new Color(255, 255, 255, alpha));
g2.fillRoundRect(x, y, w, h, arc, arc);
}*/
g2.setColor(key.backgroundColor);
g2.fillRoundRect(x, y, w, h, arc, arc);
//////////////////////////////////////////////////////////////////
@ -229,7 +224,7 @@ public class MageRoundPane extends JPanel {
public void resetBackgroundColor() {
this.backgroundColor = defaultBackgroundColor;
}
public void setBackgroundColor(Color backgroundColor) {
this.backgroundColor = backgroundColor;
}

View file

@ -1,32 +1,53 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.client.util;
import java.util.ArrayList;
import java.util.Map;
import java.util.Vector;
/**
*
* @author user
* @author draxdyn
*/
public class ImageCaches {
private static Vector<Map> IMAGE_CACHES;
private final static ArrayList<Map> IMAGE_CACHES;
static {
IMAGE_CACHES = new Vector<Map>();
IMAGE_CACHES = new ArrayList<>();
}
public static Map register(Map map)
{
public static Map register(Map map) {
IMAGE_CACHES.add(map);
return map;
}
public static void flush()
{
public static void flush() {
for (Map map : IMAGE_CACHES) {
map.clear();
}

View file

@ -27,32 +27,21 @@
*/
package mage.client.util;
import com.mortennobel.imagescaling.ResampleOp;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Transparency;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.awt.image.MemoryImageSource;
import java.awt.image.PixelGrabber;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import javax.imageio.ImageIO;
import mage.cards.CardDimensions;
import static mage.client.constants.Constants.FRAME_MAX_HEIGHT;
import static mage.client.constants.Constants.FRAME_MAX_WIDTH;
import static mage.client.constants.Constants.SYMBOL_MAX_SPACE;
import mage.view.CardView;
import org.mage.card.arcane.UI;
import org.mage.plugins.card.images.ImageCache;
/**
*

View file

@ -28,7 +28,7 @@ public class GlowText extends JLabel {
private Color glowColor;
private boolean wrap;
private int lineCount = 0;
private static Map<Key, BufferedImage> IMAGE_CACHE;
private final static Map<Key, BufferedImage> IMAGE_CACHE;
private final static class Key {