Example #1
0
 public static BufferedImage getCardImage(IRenderableCard cardDef) {
   File cropFile = MagicFileSystem.getCroppedCardImageFile(cardDef);
   if (cropFile.exists()) {
     if (cardDef.isPlaneswalker()) {
       BufferedImage crop =
           GraphicsUtils.scale(ImageFileIO.toImg(cropFile, MagicImages.MISSING_CARD), 320, 234);
       if (OracleText.getPlaneswalkerAbilityCount(cardDef) == 3) {
         BufferedImage blend = ResourceManager.newFrame(ResourceManager.getPlaneswalkerImageBlend);
         return Frame.getBlendedFrame(
             new BufferedImage(320, 234, BufferedImage.TYPE_INT_ARGB), blend, crop);
       } else {
         BufferedImage cropSmall = crop.getSubimage(0, 0, 320, 201);
         BufferedImage blend =
             GraphicsUtils.scale(
                 ResourceManager.newFrame(ResourceManager.getPlaneswalkerImageBlend), 320, 201);
         return Frame.getBlendedFrame(
             new BufferedImage(320, 210, BufferedImage.TYPE_INT_ARGB), blend, cropSmall);
       }
     } else {
       BufferedImage image = ImageFileIO.toImg(cropFile, MagicImages.MISSING_CARD);
       return GraphicsUtils.scale(image, 316, 231);
     }
   }
   if (cardDef.isPlaneswalker()) {
     return buildPlaneswalkerImage(cardDef);
   }
   return buildDefaultImage(cardDef);
 }
Example #2
0
 private static BufferedImage buildPlaneswalkerImage(IRenderableCard cardDef) {
   int WIDTH = 320;
   int HEIGHT;
   BufferedImage blend;
   if (OracleText.getPlaneswalkerAbilityCount(cardDef) == 3) {
     HEIGHT = 234;
     blend = ResourceManager.newFrame(ResourceManager.getPlaneswalkerImageBlend);
   } else {
     HEIGHT = 201;
     blend =
         GraphicsUtils.scale(
             ResourceManager.newFrame(ResourceManager.getPlaneswalkerImageBlend), WIDTH, HEIGHT);
   }
   BufferedImage background = GraphicsUtils.scale(getDefaultBackground(cardDef), WIDTH, HEIGHT);
   BufferedImage symbol = GraphicsUtils.scale(getDefaultSymbol(cardDef), WIDTH, HEIGHT);
   BufferedImage image =
       Frame.getBlendedFrame(
           new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB), blend, background);
   return getCompositeImage(image, symbol);
 }