forked from External/mage
GUI: added HD screen support (resizing) for player panels (preferences settings under development, part of #12455, #12451, #7563);
This commit is contained in:
parent
7d675de876
commit
72586616ae
10 changed files with 340 additions and 242 deletions
|
|
@ -11,6 +11,8 @@ import java.io.InputStream;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
|
||||
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;
|
||||
|
|
@ -124,4 +126,14 @@ public final class ImageHelper {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Image getImageFromResourcesScaledToHeight(String pathToImage, int height) {
|
||||
Image res = null;
|
||||
Image image = ImageHelper.getImageFromResources(pathToImage);
|
||||
if (image != null) {
|
||||
int width = Math.round(height * image.getWidth(null) / image.getHeight(null));
|
||||
res = ImageHelper.scale((BufferedImage) image, BufferedImage.TYPE_4BYTE_ABGR, width, height);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue