00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 package com.realtime.crossfire.jxclient.faces;
00023
00024 import java.awt.GraphicsConfiguration;
00025 import java.awt.GraphicsDevice;
00026 import java.awt.GraphicsEnvironment;
00027 import java.awt.Transparency;
00028 import javax.swing.ImageIcon;
00029 import org.jetbrains.annotations.NotNull;
00030
00035 public class FaceImagesUtils {
00036
00040 private FaceImagesUtils() {
00041 }
00042
00049 @NotNull
00050 public static FaceImages newFaceImages(@NotNull final ImageIcon originalImageIcon) {
00051 final ImageIcon scaledImageIcon = new ImageScale2x(originalImageIcon).getScaledImage();
00052 final ImageIcon magicMapImageIcon = new ImageScale8d(originalImageIcon).getScaledImage();
00053 return new FaceImages(originalImageIcon, scaledImageIcon, magicMapImageIcon);
00054 }
00055
00060 @NotNull
00061 public static FaceImages newEmptyFaceImages() {
00062 final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
00063 final GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();
00064 final GraphicsConfiguration graphicsConfiguration = graphicsDevice.getDefaultConfiguration();
00065
00066 final ImageIcon emptyOriginalImageIcon = new ImageIcon(graphicsConfiguration.createCompatibleImage(Face.SQUARE_SIZE, Face.SQUARE_SIZE, Transparency.OPAQUE));
00067 final ImageIcon emptyScaledImageIcon = new ImageIcon(graphicsConfiguration.createCompatibleImage(Face.SQUARE_SIZE*2, Face.SQUARE_SIZE*2, Transparency.OPAQUE));
00068 final ImageIcon emptyMagicMapImageIcon = new ImageIcon(graphicsConfiguration.createCompatibleImage(Face.SQUARE_SIZE/8, Face.SQUARE_SIZE/8, Transparency.OPAQUE));
00069 return new FaceImages(emptyOriginalImageIcon, emptyScaledImageIcon, emptyMagicMapImageIcon);
00070 }
00071
00072 }