home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / sun / awt / image / BufferedImageGraphicsConfig.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.5 KB  |  95 lines

  1. package sun.awt.image;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Graphics2D;
  5. import java.awt.GraphicsConfiguration;
  6. import java.awt.GraphicsDevice;
  7. import java.awt.Rectangle;
  8. import java.awt.geom.AffineTransform;
  9. import java.awt.image.BufferedImage;
  10. import java.awt.image.ColorModel;
  11. import java.awt.image.Raster;
  12. import java.awt.image.WritableRaster;
  13. import java.util.Hashtable;
  14. import sun.java2d.OutputManager;
  15. import sun.java2d.loops.RasterOutputManager;
  16.  
  17. public class BufferedImageGraphicsConfig extends GraphicsConfiguration {
  18.    private static final int numconfigs = 12;
  19.    private static BufferedImageGraphicsConfig[] configs = new BufferedImageGraphicsConfig[12];
  20.    // $FF: renamed from: gd java.awt.GraphicsDevice
  21.    GraphicsDevice field_0;
  22.    ColorModel model;
  23.    Raster raster;
  24.    int width;
  25.    int height;
  26.  
  27.    public static GraphicsConfiguration getConfig(BufferedImage var0) {
  28.       int var2 = var0.getType();
  29.       if (var2 > 0 && var2 < 12) {
  30.          BufferedImageGraphicsConfig var1 = configs[var2];
  31.          if (var1 != null) {
  32.             return var1;
  33.          }
  34.       }
  35.  
  36.       BufferedImageGraphicsConfig var3 = new BufferedImageGraphicsConfig(var0, (Component)null);
  37.       if (var2 > 0 && var2 < 12) {
  38.          configs[var2] = var3;
  39.       }
  40.  
  41.       return var3;
  42.    }
  43.  
  44.    public static OutputManager getOutputManager(BufferedImage var0) {
  45.       return RasterOutputManager.getManager();
  46.    }
  47.  
  48.    public BufferedImageGraphicsConfig(BufferedImage var1, Component var2) {
  49.       if (var2 == null) {
  50.          this.field_0 = new BufferedImageDevice(this);
  51.       } else {
  52.          Graphics2D var3 = (Graphics2D)var2.getGraphics();
  53.          this.field_0 = var3.getDeviceConfiguration().getDevice();
  54.       }
  55.  
  56.       this.model = var1.getColorModel();
  57.       this.raster = var1.getRaster().createCompatibleWritableRaster(1, 1);
  58.       this.width = var1.getWidth();
  59.       this.height = var1.getHeight();
  60.    }
  61.  
  62.    public GraphicsDevice getDevice() {
  63.       return this.field_0;
  64.    }
  65.  
  66.    public BufferedImage createCompatibleImage(int var1, int var2) {
  67.       WritableRaster var3 = this.raster.createCompatibleWritableRaster(var1, var2);
  68.       return new BufferedImage(this.model, var3, this.model.isAlphaPremultiplied(), (Hashtable)null);
  69.    }
  70.  
  71.    public BufferedImage createCompatibleImage(int var1, int var2, int var3) {
  72.       return this.createCompatibleImage(var1, var2);
  73.    }
  74.  
  75.    public ColorModel getColorModel() {
  76.       return this.model;
  77.    }
  78.  
  79.    public ColorModel getColorModel(int var1) {
  80.       return this.model.getTransparency() == var1 ? this.model : null;
  81.    }
  82.  
  83.    public AffineTransform getDefaultTransform() {
  84.       return new AffineTransform();
  85.    }
  86.  
  87.    public AffineTransform getNormalizingTransform() {
  88.       return new AffineTransform();
  89.    }
  90.  
  91.    public Rectangle getBounds() {
  92.       return new Rectangle(0, 0, this.width, this.height);
  93.    }
  94. }
  95.