mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Improved handling of enlarged images. Added mode to show other side of flip and transform cards. Added icon for copied cards and possibility to show enlarged original or copied card.
This commit is contained in:
parent
0babf49392
commit
59d907c981
24 changed files with 490 additions and 233 deletions
|
|
@ -47,6 +47,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
import static mage.constants.Constants.*;
|
||||
import mage.constants.EnlargeMode;
|
||||
|
||||
/**
|
||||
* Class for displaying big image of the card
|
||||
|
|
@ -65,6 +66,7 @@ public class BigCard extends JComponent {
|
|||
protected Thread foilThread;
|
||||
protected float hue = 0.005f;
|
||||
protected float dh = 0.005f;
|
||||
protected EnlargeMode enlargeMode;
|
||||
|
||||
public BigCard() {
|
||||
initComponents();
|
||||
|
|
@ -87,19 +89,20 @@ public class BigCard extends JComponent {
|
|||
|
||||
}
|
||||
|
||||
public void setCard(UUID cardId, Image image, List<String> strings, boolean foil) {
|
||||
if (this.cardId == null || !this.cardId.equals(cardId)) {
|
||||
public void setCard(UUID cardId, EnlargeMode enlargeMode, Image image, List<String> strings) {
|
||||
if (this.cardId == null || !enlargeMode.equals(this.enlargeMode) || !this.cardId.equals(cardId)) {
|
||||
if (this.panel != null) {
|
||||
remove(this.panel);
|
||||
}
|
||||
this.cardId = cardId;
|
||||
this.enlargeMode = enlargeMode;
|
||||
bigImage = image;
|
||||
synchronized (this) {
|
||||
source = null;
|
||||
hue = 0.000f;
|
||||
}
|
||||
drawText(strings);
|
||||
setFoil(foil);
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -143,10 +146,6 @@ public class BigCard extends JComponent {
|
|||
this.scrollPane.setVisible(true);
|
||||
}
|
||||
|
||||
public void setFoil(boolean foil) {
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void addJXPanel(UUID cardId, JXPanel jxPanel) {
|
||||
bigImage = null;
|
||||
synchronized (this) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
|
|
|
|||
|
|
@ -34,36 +34,64 @@
|
|||
|
||||
package mage.client.cards;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.Popup;
|
||||
import javax.swing.PopupFactory;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Style;
|
||||
import javax.swing.text.StyleConstants;
|
||||
import javax.swing.text.StyleContext;
|
||||
import javax.swing.text.StyledDocument;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.TextPopup;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.client.MageFrame;
|
||||
import static mage.client.constants.Constants.CONTENT_MAX_XOFFSET;
|
||||
import static mage.client.constants.Constants.FRAME_MAX_HEIGHT;
|
||||
import static mage.client.constants.Constants.FRAME_MAX_WIDTH;
|
||||
import static mage.client.constants.Constants.NAME_FONT_MAX_SIZE;
|
||||
import static mage.client.constants.Constants.NAME_MAX_YOFFSET;
|
||||
import static mage.client.constants.Constants.POWBOX_TEXT_MAX_LEFT;
|
||||
import static mage.client.constants.Constants.POWBOX_TEXT_MAX_TOP;
|
||||
import static mage.client.constants.Constants.SYMBOL_MAX_XOFFSET;
|
||||
import static mage.client.constants.Constants.SYMBOL_MAX_YOFFSET;
|
||||
import static mage.client.constants.Constants.TYPE_MAX_YOFFSET;
|
||||
import mage.client.game.PlayAreaPanel;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.DefaultActionCallback;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.EnlargeMode;
|
||||
import mage.remote.Session;
|
||||
import mage.cards.Sets;
|
||||
import mage.view.AbilityView;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CounterView;
|
||||
import mage.view.PermanentView;
|
||||
import mage.view.StackAbilityView;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static mage.constants.Constants.*;
|
||||
import mage.view.CounterView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -89,7 +117,14 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
protected BufferedImage small;
|
||||
protected String backgroundName;
|
||||
|
||||
/** Creates new form Card */
|
||||
/**
|
||||
* Creates new form Card
|
||||
*
|
||||
* @param card
|
||||
* @param bigCard
|
||||
* @param dimension
|
||||
* @param gameId
|
||||
*/
|
||||
public Card(CardView card, BigCard bigCard, CardDimensions dimension, UUID gameId) {
|
||||
this.dimension = dimension;
|
||||
initComponents();
|
||||
|
|
@ -120,10 +155,12 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
return card.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(PermanentView permanent) {
|
||||
this.update((CardView)permanent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(CardView card) {
|
||||
this.card = card;
|
||||
Graphics2D gImage = image.createGraphics();
|
||||
|
|
@ -141,8 +178,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
gImage.setColor(Color.BLACK);
|
||||
gImage.drawImage(background, 0, 0, this);
|
||||
|
||||
if (card.getManaCost().size() > 0)
|
||||
if (card.getManaCost().size() > 0) {
|
||||
ImageHelper.drawCosts(card.getManaCost(), gImage, FRAME_MAX_WIDTH - SYMBOL_MAX_XOFFSET, SYMBOL_MAX_YOFFSET, this);
|
||||
}
|
||||
|
||||
gSmall.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
gSmall.setColor(Color.BLACK);
|
||||
|
|
@ -157,8 +195,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
gImage.drawString(card.getLoyalty(), POWBOX_TEXT_MAX_LEFT, POWBOX_TEXT_MAX_TOP);
|
||||
}
|
||||
|
||||
if (card.getCardTypes().size() > 0)
|
||||
if (card.getCardTypes().size() > 0) {
|
||||
gImage.drawString(cardType, CONTENT_MAX_XOFFSET, TYPE_MAX_YOFFSET);
|
||||
}
|
||||
|
||||
gImage.dispose();
|
||||
|
||||
|
|
@ -171,8 +210,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
gSmall.drawString(card.getLoyalty(), Config.dimensions.powBoxTextLeft, Config.dimensions.powBoxTextTop);
|
||||
}
|
||||
|
||||
if (card.getCardTypes().size() > 0)
|
||||
if (card.getCardTypes().size() > 0) {
|
||||
gSmall.drawString(cardType, Config.dimensions.contentXOffset, Config.dimensions.typeYOffset);
|
||||
}
|
||||
drawText();
|
||||
|
||||
gSmall.dispose();
|
||||
|
|
@ -217,7 +257,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
protected String getBackgroundName() {
|
||||
private String getBackgroundName() {
|
||||
if (card instanceof StackAbilityView || card instanceof AbilityView) {
|
||||
return "effect";
|
||||
}
|
||||
|
|
@ -237,8 +277,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
StyledDocument doc = text.getStyledDocument();
|
||||
|
||||
try {
|
||||
for (String rule: getRules())
|
||||
for (String rule: getRules()) {
|
||||
doc.insertString(doc.getLength(), rule + "\n", doc.getStyle("small"));
|
||||
}
|
||||
} catch (BadLocationException e) {}
|
||||
|
||||
text.setCaretPosition(0);
|
||||
|
|
@ -246,7 +287,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
|
||||
protected List<String> getRules() {
|
||||
if (card.getCounters() != null) {
|
||||
List<String> rules = new ArrayList<String>(card.getRules());
|
||||
List<String> rules = new ArrayList<>(card.getRules());
|
||||
for (CounterView counter: card.getCounters()) {
|
||||
rules.add(counter.getCount() + " x " + counter.getName());
|
||||
}
|
||||
|
|
@ -333,7 +374,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
@Override
|
||||
public void mouseMoved(MouseEvent arg0) {
|
||||
this.bigCard.showTextComponent();
|
||||
this.bigCard.setCard(card.getId(), image, getRules(), false);
|
||||
this.bigCard.setCard(card.getId(), EnlargeMode.NORMAL, image, getRules());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -353,8 +394,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
@Override
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
if (!popupShowing) {
|
||||
if (popup != null)
|
||||
if (popup != null) {
|
||||
popup.hide();
|
||||
}
|
||||
PopupFactory factory = PopupFactory.getSharedInstance();
|
||||
popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + Config.dimensions.frameWidth, (int) this.getLocationOnScreen().getY() + 40);
|
||||
popup.show();
|
||||
|
|
@ -368,9 +410,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
List<UUID> targets = card.getTargets();
|
||||
if (targets != null) {
|
||||
for (UUID uuid : targets) {
|
||||
PlayAreaPanel p = MageFrame.getGame(gameId).getPlayers().get(uuid);
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
PlayAreaPanel playAreaPanel = MageFrame.getGame(gameId).getPlayers().get(uuid);
|
||||
if (playAreaPanel != null) {
|
||||
Point target = playAreaPanel.getLocationOnScreen();
|
||||
Point me = this.getLocationOnScreen();
|
||||
ArrowBuilder.getBuilder().addArrow(gameId, (int)me.getX() + 35, (int)me.getY(), (int)target.getX() + 40, (int)target.getY() - 40, Color.red, ArrowBuilder.Type.TARGET);
|
||||
} else {
|
||||
|
|
@ -390,7 +432,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
if(getMousePosition(true) != null) return;
|
||||
if(getMousePosition(true) != null) {
|
||||
return;
|
||||
}
|
||||
if (popup != null) {
|
||||
popup.hide();
|
||||
popupShowing = false;
|
||||
|
|
@ -408,8 +452,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
|
||||
@Override
|
||||
public void focusLost(FocusEvent arg0) {
|
||||
if (popup != null)
|
||||
if (popup != null) {
|
||||
popup.hide();
|
||||
}
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
|
|
@ -433,8 +478,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
if (popup != null)
|
||||
if (popup != null) {
|
||||
popup.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -491,7 +537,9 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getAlpha() {return 0;}
|
||||
public float getAlpha() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggleTransformed() {
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ import mage.client.util.ImageHelper;
|
|||
import mage.client.util.Listener;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.EnlargeMode;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -380,7 +381,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
if (image != null && image instanceof BufferedImage) {
|
||||
// XXX: scaled to fit width
|
||||
image = ImageHelper.getResizedImage((BufferedImage) image, bigCard.getWidth());
|
||||
bigCard.setCard(card.getId(), image, new ArrayList<String>(), false);
|
||||
bigCard.setCard(card.getId(), EnlargeMode.NORMAL, image, new ArrayList<String>());
|
||||
} else {
|
||||
drawCardText(card);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ import mage.client.util.Config;
|
|||
import mage.client.util.GameManager;
|
||||
import mage.client.util.PhaseManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.constants.EnlargeMode;
|
||||
import mage.constants.PhaseStep;
|
||||
import static mage.constants.PhaseStep.BEGIN_COMBAT;
|
||||
import static mage.constants.PhaseStep.COMBAT_DAMAGE;
|
||||
|
|
@ -952,7 +953,17 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
ActionCallback callback = Plugins.getInstance().getActionCallback();
|
||||
((MageActionCallback)callback).enlargeCard();
|
||||
((MageActionCallback)callback).enlargeCard(EnlargeMode.NORMAL);
|
||||
}
|
||||
});
|
||||
|
||||
KeyStroke ksAltS = KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK);
|
||||
this.getInputMap(c).put(ksAltS, "ENLARGE_SOURCE");
|
||||
this.getActionMap().put("ENLARGE_SOURCE", new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
ActionCallback callback = Plugins.getInstance().getActionCallback();
|
||||
((MageActionCallback)callback).enlargeCard(EnlargeMode.ALTERNATE);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -989,16 +1000,19 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
});
|
||||
|
||||
KeyStroke ksAltShiftReleased = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK, true);
|
||||
this.getInputMap(c).put(ksAltShiftReleased, "ENLARGE_RELEASE");
|
||||
KeyStroke ksAltEReleased = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK, true);
|
||||
this.getInputMap(c).put(ksAltEReleased, "ENLARGE_RELEASE");
|
||||
KeyStroke ksAltSReleased = KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK, true);
|
||||
this.getInputMap(c).put(ksAltSReleased, "ENLARGE_RELEASE");
|
||||
this.getActionMap().put("ENLARGE_RELEASE", new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
ActionCallback callback = Plugins.getInstance().getActionCallback();
|
||||
((MageActionCallback)callback).hideCard();
|
||||
((MageActionCallback)callback).hideEnlargedCard();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
btnSwitchHands.setText("Switch Hands");
|
||||
btnSwitchHands.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -34,13 +34,16 @@ import mage.client.util.ImageHelper;
|
|||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.components.CardInfoPane;
|
||||
import mage.constants.EnlargeMode;
|
||||
import mage.remote.Session;
|
||||
import mage.utils.ThreadUtils;
|
||||
import mage.view.CardView;
|
||||
import mage.view.PermanentView;
|
||||
import mage.view.PlayerView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdesktop.swingx.JXPanel;
|
||||
import org.mage.plugins.card.images.ImageCache;
|
||||
|
||||
public class MageActionCallback implements ActionCallback {
|
||||
|
||||
|
|
@ -54,13 +57,16 @@ public class MageActionCallback implements ActionCallback {
|
|||
private CardView popupCard;
|
||||
private TransferData popupData;
|
||||
private JComponent cardInfoPane;
|
||||
private volatile boolean state = false;
|
||||
private boolean enlarged = false;
|
||||
private volatile boolean popupTextWindowOpen = false;
|
||||
private volatile boolean enlargedImageWindowOpen = false;
|
||||
// shows the alternative card the normal card or the alternative card (copy source, other flip side, other transformed side)
|
||||
private volatile EnlargeMode enlargeMode;
|
||||
|
||||
private static final ScheduledExecutorService timeoutExecutor = Executors.newScheduledThreadPool(1);
|
||||
private ScheduledFuture<?> hideTimeout;
|
||||
|
||||
public MageActionCallback() {
|
||||
enlargeMode = EnlargeMode.NORMAL;
|
||||
}
|
||||
|
||||
public void setCardPreviewComponent(BigCard bigCard) {
|
||||
|
|
@ -227,7 +233,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
public void run() {
|
||||
ThreadUtils.sleep(300);
|
||||
|
||||
if (popupCard == null || !popupCard.equals(data.card) || session == null || !state || enlarged) {
|
||||
if (popupCard == null || !popupCard.equals(data.card) || session == null || !popupTextWindowOpen || enlargedImageWindowOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +254,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!state || enlarged) {
|
||||
if (!popupTextWindowOpen || enlargedImageWindowOpen) {
|
||||
return;
|
||||
}
|
||||
popupContainer.setVisible(true);
|
||||
|
|
@ -265,7 +271,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e, TransferData data) {
|
||||
public void mouseMoved(MouseEvent e, TransferData transferData) {
|
||||
if (!Plugins.getInstance().isCardPluginLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -273,26 +279,32 @@ public class MageActionCallback implements ActionCallback {
|
|||
return;
|
||||
}
|
||||
|
||||
MageCard card = (MageCard) data.component;
|
||||
if (!state || card.getOriginal().getId() != bigCard.getCardId()) {
|
||||
MageCard mageCard = (MageCard) transferData.component;
|
||||
if (!popupTextWindowOpen || mageCard.getOriginal().getId() != bigCard.getCardId()) {
|
||||
if (bigCard.getWidth() > 0) {
|
||||
synchronized (MageActionCallback.class) {
|
||||
if (!state || card.getOriginal().getId() != bigCard.getCardId()) {
|
||||
if (!state) {
|
||||
if (!popupTextWindowOpen || mageCard.getOriginal().getId() != bigCard.getCardId()) {
|
||||
if (!popupTextWindowOpen) {
|
||||
bigCard.resetCardId();
|
||||
}
|
||||
state = true;
|
||||
Image image = card.getImage();
|
||||
displayCardInfo(card, image, bigCard);
|
||||
popupTextWindowOpen = true;
|
||||
Image image = mageCard.getImage();
|
||||
displayCardInfo(mageCard, image, bigCard);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
state = true;
|
||||
popupTextWindowOpen = true;
|
||||
}
|
||||
if (enlargedImageWindowOpen) {
|
||||
displayEnlargedCard(mageCard.getOriginal(), transferData);
|
||||
}
|
||||
displayCard(card.getOriginal(), data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the text popup window
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void hidePopup() {
|
||||
this.popupCard = null;
|
||||
|
|
@ -306,6 +318,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
// set enlarged card display to visible = false
|
||||
Component popupContainer = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
|
||||
popupContainer.setVisible(false);
|
||||
} catch (Exception e2) {
|
||||
|
|
@ -325,7 +338,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
public void hideAll(UUID gameId) {
|
||||
hidePopup();
|
||||
startHideTimeout();
|
||||
this.state = false;
|
||||
this.popupTextWindowOpen = false;
|
||||
if (gameId != null) {
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.TARGET);
|
||||
ArrowBuilder.getBuilder().removeArrowsByType(gameId, ArrowBuilder.Type.PAIRED);
|
||||
|
|
@ -334,26 +347,49 @@ public class MageActionCallback implements ActionCallback {
|
|||
}
|
||||
}
|
||||
|
||||
public void enlargeCard() {
|
||||
if (!enlarged) {
|
||||
enlarged = true;
|
||||
CardView card = null;
|
||||
if (popupData != null) {
|
||||
card = popupData.card;
|
||||
@Override
|
||||
public void mouseWheelMoved(MouseWheelEvent e, TransferData transferData) {
|
||||
if (enlargedImageWindowOpen) {
|
||||
hideEnlargedCard();
|
||||
return;
|
||||
}
|
||||
int notches = e.getWheelRotation();
|
||||
if (notches < 0) {
|
||||
// move up - show normal image
|
||||
|
||||
enlargeCard(EnlargeMode.NORMAL);
|
||||
|
||||
} else {
|
||||
// move down - show alternate image
|
||||
enlargeCard(EnlargeMode.ALTERNATE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the big card image on mouse position while hoovering over a card
|
||||
*
|
||||
* @param showAlternative defines if the original image (if it's a copied card) or the opposite side of a transformable card will be shown
|
||||
*/
|
||||
public void enlargeCard(EnlargeMode showAlternative) {
|
||||
if (!enlargedImageWindowOpen) {
|
||||
this.enlargeMode = showAlternative;
|
||||
CardView cardView = null;
|
||||
if (popupData != null) {
|
||||
cardView = popupData.card;
|
||||
}
|
||||
if (this.state) {
|
||||
if (this.popupTextWindowOpen) {
|
||||
hidePopup();
|
||||
}
|
||||
if (card != null) {
|
||||
displayCard(card, popupData);
|
||||
if (cardView != null) {
|
||||
enlargedImageWindowOpen = true;
|
||||
displayEnlargedCard(cardView, popupData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hideCard() {
|
||||
if (enlarged) {
|
||||
enlarged = false;
|
||||
public void hideEnlargedCard() {
|
||||
if (enlargedImageWindowOpen) {
|
||||
enlargedImageWindowOpen = false;
|
||||
try {
|
||||
Component cardPreviewContainer = MageFrame.getUI().getComponent(MageComponents.CARD_PREVIEW_CONTAINER);
|
||||
cardPreviewContainer.setVisible(false);
|
||||
|
|
@ -363,52 +399,59 @@ public class MageActionCallback implements ActionCallback {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseWheelMoved(MouseWheelEvent e, TransferData data) {
|
||||
int notches = e.getWheelRotation();
|
||||
if (notches < 0) {
|
||||
enlargeCard();
|
||||
} else {
|
||||
hideCard();
|
||||
}
|
||||
}
|
||||
|
||||
private void displayCard(final CardView card, final TransferData data) {
|
||||
if (!enlarged) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
private void displayEnlargedCard(final CardView cardView, final TransferData transferData) {
|
||||
ThreadUtils.threadPool2.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (card == null) {
|
||||
if (cardView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!enlarged) {
|
||||
if (!enlargedImageWindowOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
Component parentComponent = SwingUtilities.getRoot(data.component);
|
||||
Component parentComponent = SwingUtilities.getRoot(transferData.component);
|
||||
Point parentPoint = parentComponent.getLocationOnScreen();
|
||||
|
||||
final Component popupContainer = MageFrame.getUI().getComponent(MageComponents.CARD_PREVIEW_CONTAINER);
|
||||
Component cardPreview = MageFrame.getUI().getComponent(MageComponents.CARD_PREVIEW_PANE);
|
||||
if (cardPreview != null) {
|
||||
Point location = new Point((int) data.locationOnScreen.getX() + data.popupOffsetX - 40, (int) data.locationOnScreen.getY() + data.popupOffsetY - 40);
|
||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, cardPreview, parentComponent);
|
||||
Component cardPreviewPane = MageFrame.getUI().getComponent(MageComponents.CARD_PREVIEW_PANE);
|
||||
if (cardPreviewPane != null) {
|
||||
Point location = new Point((int) transferData.locationOnScreen.getX() + transferData.popupOffsetX - 40, (int) transferData.locationOnScreen.getY() + transferData.popupOffsetY - 40);
|
||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, cardPreviewPane, parentComponent);
|
||||
location.translate(-parentPoint.x, -parentPoint.y);
|
||||
popupContainer.setLocation(location);
|
||||
popupContainer.setVisible(true);
|
||||
|
||||
MageCard mageCard = (MageCard) transferData.component;
|
||||
Image image = null;
|
||||
switch (enlargeMode) {
|
||||
case COPY:
|
||||
if (cardView instanceof PermanentView) {
|
||||
image = ImageCache.getImageOriginal(((PermanentView) cardView).getOriginal());
|
||||
}
|
||||
break;
|
||||
case ALTERNATE:
|
||||
if (cardView.getAlternateName() != null) {
|
||||
if (cardView instanceof PermanentView && !cardView.isFlipCard() && !cardView.canTransform() && ((PermanentView) cardView).isCopy()) {
|
||||
image = ImageCache.getImageOriginal(((PermanentView) cardView).getOriginal());
|
||||
} else {
|
||||
image = ImageCache.getImageOriginalAlternateName(cardView);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (image == null) {
|
||||
image = mageCard.getImage();
|
||||
}
|
||||
// shows the card in the popup Container
|
||||
BigCard bigCard = (BigCard)cardPreviewPane;
|
||||
displayCardInfo(mageCard, image, bigCard);
|
||||
|
||||
|
||||
MageCard card = (MageCard) data.component;
|
||||
Image image = card.getImage();
|
||||
BigCard bigCard = (BigCard)cardPreview;
|
||||
displayCardInfo(card, image, bigCard);
|
||||
} else {
|
||||
Logger.getLogger(MageActionCallback.class).warn("No Card preview Pane in Mage Frame defined. Card: " + card.getName());
|
||||
logger.warn("No Card preview Pane in Mage Frame defined. Card: " + cardView.getName());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
@ -418,21 +461,22 @@ public class MageActionCallback implements ActionCallback {
|
|||
});
|
||||
}
|
||||
|
||||
private void displayCardInfo(MageCard card, Image image, BigCard bigCard) {
|
||||
private void displayCardInfo(MageCard mageCard, Image image, BigCard bigCard) {
|
||||
if (image != null && image instanceof BufferedImage) {
|
||||
// XXX: scaled to fit width
|
||||
image = ImageHelper.getResizedImage((BufferedImage) image, bigCard.getWidth());
|
||||
bigCard.setCard(card.getOriginal().getId(), image, card.getOriginal().getRules(), false);
|
||||
if (card.getOriginal().isAbility()) {
|
||||
bigCard.setCard(mageCard.getOriginal().getId(), enlargeMode, image, mageCard.getOriginal().getRules());
|
||||
// if it's an ability, show only the ability text as overlay
|
||||
if (mageCard.getOriginal().isAbility()) {
|
||||
bigCard.showTextComponent();
|
||||
} else {
|
||||
bigCard.hideTextComponent();
|
||||
}
|
||||
} else {
|
||||
JXPanel panel = GuiDisplayUtil.getDescription(card.getOriginal(), bigCard.getWidth(), bigCard.getHeight());
|
||||
JXPanel panel = GuiDisplayUtil.getDescription(mageCard.getOriginal(), bigCard.getWidth(), bigCard.getHeight());
|
||||
panel.setVisible(true);
|
||||
bigCard.hideTextComponent();
|
||||
bigCard.addJXPanel(card.getOriginal().getId(), panel);
|
||||
bigCard.addJXPanel(mageCard.getOriginal().getId(), panel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -441,7 +485,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
hideTimeout = timeoutExecutor.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
hideCard();
|
||||
hideEnlargedCard();
|
||||
}
|
||||
}, 700, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -379,7 +379,8 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
switch (usedPanel.getChatType()) {
|
||||
case GAME:
|
||||
usedPanel.receiveMessage("", new StringBuilder("You may use hot keys to play faster:")
|
||||
.append("\nTurn Mousewheel - Show big image of card your mousepointer hovers over")
|
||||
.append("\nTurn mousewheel up (ALT-e) - enlarge image of card the mousepointer hovers over")
|
||||
.append("\nTurn mousewheel down (ALT-s) - enlarge original/alternate image of card the mousepointer hovers over")
|
||||
.append("\nF2 - Confirm \"Ok\", \"Yes\" or \"Done\" button")
|
||||
.append("\nF4 - Skip current turn but stop on declare attackers/blockers and something on the stack")
|
||||
.append("\nF9 - Skip everything until your next turn")
|
||||
|
|
|
|||
|
|
@ -24,15 +24,17 @@ import java.util.UUID;
|
|||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.TextPopup;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.cards.action.TransferData;
|
||||
import mage.client.plugins.adapters.MageActionCallback;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.components.ImagePanel;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.EnlargeMode;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.AbilityView;
|
||||
import mage.view.CardView;
|
||||
|
|
@ -76,7 +78,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
// for two faced cards
|
||||
public CardView temporary;
|
||||
|
||||
private List<MagePermanent> links = new ArrayList<MagePermanent>();
|
||||
private List<MagePermanent> links = new ArrayList<>();
|
||||
|
||||
public double tappedAngle = 0;
|
||||
public double flippedAngle = 0;
|
||||
|
|
@ -84,6 +86,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
public ImagePanel overlayPanel;
|
||||
public JPanel buttonPanel;
|
||||
public JPanel iconPanel;
|
||||
public JPanel copyIconPanel;
|
||||
|
||||
private GlowText titleText;
|
||||
private GlowText ptText;
|
||||
|
|
@ -111,8 +114,10 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
|
||||
private boolean transformed;
|
||||
private boolean animationInProgress = false;
|
||||
|
||||
private JButton dayNightButton;
|
||||
private JButton tokenButton;
|
||||
private JButton showCopySourceButton;
|
||||
|
||||
private boolean displayTitleAnyway;
|
||||
|
||||
|
|
@ -140,7 +145,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
dayNightButton.setLocation(2, 2);
|
||||
dayNightButton.setSize(25, 25);
|
||||
|
||||
buttonPanel.setVisible(this.gameCard.canTransform());
|
||||
buttonPanel.setVisible(true);
|
||||
|
||||
BufferedImage day = ImageManagerImpl.getInstance().getDayImage();
|
||||
dayNightButton.setIcon(new ImageIcon(day));
|
||||
|
|
@ -154,9 +159,6 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
// if card is tapped, no visual transforming is possible (implementation limitation)
|
||||
// if card is permanent, it will be rotated by Mage, so manual rotate should be possible
|
||||
if (animationInProgress || isTapped() || isPermanent) {
|
||||
if (isPermanent) {
|
||||
JOptionPane.showMessageDialog(null, "You can't transform cards on battlefield.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
Animation.transformCard(CardPanel.this, CardPanel.this, true);
|
||||
|
|
@ -183,6 +185,32 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
iconPanel.add(tokenButton);
|
||||
}
|
||||
|
||||
// icon to inform about permanent is copying something
|
||||
if (this.gameCard instanceof PermanentView) {
|
||||
copyIconPanel = new JPanel();
|
||||
copyIconPanel.setLayout(null);
|
||||
copyIconPanel.setOpaque(false);
|
||||
add(copyIconPanel);
|
||||
|
||||
showCopySourceButton = new JButton("");
|
||||
showCopySourceButton.setLocation(2, 2);
|
||||
showCopySourceButton.setSize(25, 25);
|
||||
showCopySourceButton.setToolTipText("This permanent is copying a target. To see original image, push this button or turn mouse wheel down while hoovering with the mouse pointer over the permanent.");
|
||||
copyIconPanel.setVisible(((PermanentView) this.gameCard).isCopy());
|
||||
|
||||
showCopySourceButton.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getCopyInformIconImage()));
|
||||
|
||||
copyIconPanel.add(showCopySourceButton);
|
||||
|
||||
showCopySourceButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ActionCallback callback = Plugins.getInstance().getActionCallback();
|
||||
((MageActionCallback) callback).enlargeCard(EnlargeMode.COPY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setBackground(Color.black);
|
||||
setOpaque(false);
|
||||
|
||||
|
|
@ -462,6 +490,10 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
iconPanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
|
||||
iconPanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
|
||||
}
|
||||
if (copyIconPanel != null) {
|
||||
copyIconPanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
|
||||
copyIconPanel.setSize(cardWidth - borderSize * 2, cardHeight - borderSize * 2);
|
||||
}
|
||||
int fontHeight = Math.round(cardHeight * (27f / 680));
|
||||
boolean showText = (!isAnimationPanel && fontHeight < 12);
|
||||
titleText.setVisible(showText);
|
||||
|
|
@ -634,7 +666,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
|
||||
@Override
|
||||
public void update(CardView card) {
|
||||
if (isPermanent) {
|
||||
if (isPermanent && (card instanceof PermanentView)) {
|
||||
boolean needsTapping = isTapped() != ((PermanentView) card).isTapped();
|
||||
boolean needsFlipping = isFlipped() != ((PermanentView) card).isFlipped();
|
||||
if (needsTapping || needsFlipping) {
|
||||
|
|
@ -648,6 +680,10 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
Animation.transformCard(this, this, card.isTransformed());
|
||||
}
|
||||
}
|
||||
if (card.canTransform()) {
|
||||
dayNightButton.setVisible(!isPermanent);
|
||||
}
|
||||
|
||||
if (CardUtil.isCreature(card) && CardUtil.isPlaneswalker(card)) {
|
||||
ptText.setText(card.getPower() + "/" + card.getToughness() + " (" + card.getLoyalty() + ")");
|
||||
} else if (CardUtil.isCreature(card)) {
|
||||
|
|
@ -658,6 +694,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
ptText.setText("");
|
||||
}
|
||||
setText(card);
|
||||
|
||||
boolean updateImage = !gameCard.getName().equals(card.getName()); // update after e.g. turning a night/day card
|
||||
this.gameCard = card;
|
||||
|
||||
String cardType = getType(card);
|
||||
|
|
@ -668,7 +706,18 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
} else {
|
||||
overlayPanel.setVisible(false);
|
||||
}
|
||||
|
||||
if (updateImage) {
|
||||
updateImage();
|
||||
if (card.canTransform()) {
|
||||
BufferedImage transformIcon;
|
||||
if (card.isTransformed()) {
|
||||
transformIcon = ImageManagerImpl.getInstance().getNightImage();
|
||||
} else {
|
||||
transformIcon = ImageManagerImpl.getInstance().getDayImage();
|
||||
}
|
||||
dayNightButton.setIcon(new ImageIcon(transformIcon));
|
||||
}
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
|
|
@ -859,8 +908,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
|
||||
@Override
|
||||
public void update(PermanentView card) {
|
||||
update((CardView) card);
|
||||
this.hasSickness = card.hasSummoningSickness();
|
||||
this.copyIconPanel.setVisible(card.isCopy());
|
||||
update((CardView) card);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -883,7 +933,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
this.transformed = !this.transformed;
|
||||
if (transformed) {
|
||||
BufferedImage night = ImageManagerImpl.getInstance().getNightImage();
|
||||
dayNightButton.setIcon(new ImageIcon(night));
|
||||
if (dayNightButton != null) { // if transformbable card is copied, button can be null
|
||||
dayNightButton.setIcon(new ImageIcon(night));
|
||||
}
|
||||
if (this.gameCard.getSecondCardFace() == null) {
|
||||
log.error("no second side for card to transform!");
|
||||
return;
|
||||
|
|
@ -892,17 +944,21 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
this.temporary = this.gameCard;
|
||||
update(this.gameCard.getSecondCardFace());
|
||||
}
|
||||
updateImage();
|
||||
} else {
|
||||
BufferedImage day = ImageManagerImpl.getInstance().getDayImage();
|
||||
dayNightButton.setIcon(new ImageIcon(day));
|
||||
if (dayNightButton != null) { // if transformbable card is copied, button can be null
|
||||
dayNightButton.setIcon(new ImageIcon(day));
|
||||
}
|
||||
if (!isPermanent) { // use only for custom transformation (when pressing day-night button)
|
||||
this.gameCard = this.temporary;
|
||||
this.temporary = null;
|
||||
update(this.gameCard);
|
||||
}
|
||||
updateImage();
|
||||
}
|
||||
}
|
||||
String temp = this.gameCard.getAlternateName();
|
||||
this.gameCard.setAlternateName(this.gameCard.getOriginalName());
|
||||
this.gameCard.setOriginalName(temp);
|
||||
updateImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
private int cardWidth, cardHeight;
|
||||
private int extraCardSpacingX, cardSpacingX, cardSpacingY;
|
||||
private int stackSpacingX, stackSpacingY;
|
||||
private List<Row> rows = new ArrayList<Row>();
|
||||
private List<Row> rows = new ArrayList<>();
|
||||
|
||||
@Init
|
||||
public void init() {
|
||||
|
|
@ -183,7 +183,7 @@ public class CardPluginImpl implements CardPlugin {
|
|||
int afterCreaturesIndex = rows.size();
|
||||
wrap(lands, rows, afterCreaturesIndex);
|
||||
// Store the current rows and others.
|
||||
List<Row> storedRows = new ArrayList<Row>(rows.size());
|
||||
List<Row> storedRows = new ArrayList<>(rows.size());
|
||||
for (Row row : rows) {
|
||||
storedRows.add((Row) row.clone());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,21 +7,21 @@ import com.mortennobel.imagescaling.ResampleOp;
|
|||
import de.schlichtherle.truezip.file.TFile;
|
||||
import de.schlichtherle.truezip.file.TFileInputStream;
|
||||
import de.schlichtherle.truezip.file.TFileOutputStream;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.view.CardView;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.card.constants.Constants;
|
||||
import org.mage.plugins.card.dl.sources.DirectLinksForDownload;
|
||||
import org.mage.plugins.card.utils.CardImageUtils;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.imageio.ImageIO;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.view.CardView;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.card.constants.Constants;
|
||||
import org.mage.plugins.card.dl.sources.DirectLinksForDownload;
|
||||
import org.mage.plugins.card.utils.CardImageUtils;
|
||||
|
||||
/**
|
||||
* This class stores ALL card images in a cache with soft values. this means
|
||||
|
|
@ -167,10 +167,20 @@ public class ImageCache {
|
|||
if (card.getUsesVariousArt()) {
|
||||
key += "#usesVariousArt";
|
||||
}
|
||||
// log.debug("#key: " + key);
|
||||
// log.warn("#key: " + key);
|
||||
return getImage(key);
|
||||
}
|
||||
|
||||
public static BufferedImage getImageOriginalAlternateName(CardView card) {
|
||||
String key = getKeyAlternateName(card, card.getAlternateName());
|
||||
if (card.getUsesVariousArt()) {
|
||||
key += "#usesVariousArt";
|
||||
}
|
||||
// log.warn("#key: " + key);
|
||||
return getImage(key);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the Image corresponding to the key
|
||||
*/
|
||||
|
|
@ -205,6 +215,18 @@ public class ImageCache {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the map key for the flip image of a card, without any suffixes for the image size.
|
||||
*/
|
||||
private static String getKeyAlternateName(CardView card, String alternateName) {
|
||||
StringBuilder sb = new StringBuilder(alternateName).append("#");
|
||||
sb.append(card.getExpansionSetCode()).append("#");
|
||||
sb.append(card.getType()).append("#");
|
||||
sb.append(card.getCardNumber()).append("#");
|
||||
sb.append(card.getTokenSetCode() == null ? "":card.getTokenSetCode());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load image from file
|
||||
*
|
||||
|
|
@ -251,6 +273,7 @@ public class ImageCache {
|
|||
|
||||
/**
|
||||
* Returns an image scaled to the size given
|
||||
* @param original
|
||||
* @return
|
||||
*/
|
||||
public static BufferedImage getNormalSizeImage(BufferedImage original) {
|
||||
|
|
@ -289,6 +312,9 @@ public class ImageCache {
|
|||
/**
|
||||
* Returns an image scaled to the size appropriate for the card picture
|
||||
* panel
|
||||
* @param original
|
||||
* @param sizeNeed
|
||||
* @return
|
||||
*/
|
||||
public static BufferedImage getResizedImage(BufferedImage original, Rectangle sizeNeed) {
|
||||
ResampleOp resampleOp = new ResampleOp(sizeNeed.width, sizeNeed.height);
|
||||
|
|
@ -298,6 +324,10 @@ public class ImageCache {
|
|||
|
||||
/**
|
||||
* Returns the image appropriate to display the card in the picture panel
|
||||
* @param card
|
||||
* @param width
|
||||
* @param height
|
||||
* @return
|
||||
*/
|
||||
public static BufferedImage getImage(CardView card, int width, int height) {
|
||||
if (Constants.THUMBNAIL_SIZE_FULL.width + 10 > width) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ public interface ImageManager {
|
|||
Image getNightImage();
|
||||
|
||||
Image getTokenIconImage();
|
||||
Image getCopyInformIconImage();
|
||||
|
||||
Image getDlgAcceptButtonImage();
|
||||
Image getDlgActiveAcceptButtonImage();
|
||||
|
|
|
|||
|
|
@ -106,6 +106,15 @@ public class ImageManagerImpl implements ImageManager {
|
|||
return imageTokenIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage getCopyInformIconImage() {
|
||||
if (imageCopyIcon == null) {
|
||||
Image image = getImageFromResourceTransparent("/card/copy.png", Color.WHITE, new Rectangle(20, 20));
|
||||
imageCopyIcon = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
|
||||
}
|
||||
return imageCopyIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getDlgCancelButtonImage() {
|
||||
if (imageDlgCancelButton == null) {
|
||||
|
|
@ -226,6 +235,7 @@ public class ImageManagerImpl implements ImageManager {
|
|||
private static BufferedImage imageNight;
|
||||
|
||||
private static BufferedImage imageTokenIcon;
|
||||
private static BufferedImage imageCopyIcon;
|
||||
|
||||
private static BufferedImage imageDlgAcceptButton;
|
||||
private static BufferedImage imageDlgActiveAcceptButton;
|
||||
|
|
|
|||
BIN
Mage.Client/src/main/resources/card/copy.png
Normal file
BIN
Mage.Client/src/main/resources/card/copy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 545 B |
Loading…
Add table
Add a link
Reference in a new issue