1 17 18 19 20 package org.apache.fop.svg; 21 22 import java.awt.Rectangle ; 23 import java.awt.GraphicsDevice ; 24 import java.awt.Transparency ; 25 import java.awt.image.ColorModel ; 26 import java.awt.geom.AffineTransform ; 27 import java.awt.image.BufferedImage ; 28 29 33 class PDFGraphicsConfiguration extends GraphicsConfiguration { 34 private static final BufferedImage BI_WITH_ALPHA = 36 new BufferedImage (1, 1, BufferedImage.TYPE_INT_ARGB); 37 private static final BufferedImage BI_WITHOUT_ALPHA = 39 new BufferedImage (1, 1, BufferedImage.TYPE_INT_RGB); 40 41 50 public BufferedImage createCompatibleImage(int width, int height, 51 int transparency) { 52 if (transparency == Transparency.OPAQUE) { 53 return new BufferedImage (width, height, 54 BufferedImage.TYPE_INT_RGB); 55 } else { 56 return new BufferedImage (width, height, 57 BufferedImage.TYPE_INT_ARGB); 58 } 59 } 60 61 68 public BufferedImage createCompatibleImage(int width, int height) { 69 return new BufferedImage (width, height, 70 BufferedImage.TYPE_INT_ARGB); 71 } 72 73 81 public Rectangle getBounds() { 82 return null; 83 } 84 85 89 public ColorModel getColorModel() { 90 return BI_WITH_ALPHA.getColorModel(); 91 } 92 93 99 public ColorModel getColorModel(int transparency) { 100 if (transparency == Transparency.OPAQUE) { 101 return BI_WITHOUT_ALPHA.getColorModel(); 102 } else { 103 return BI_WITH_ALPHA.getColorModel(); 104 } 105 } 106 107 112 public AffineTransform getDefaultTransform() { 113 return new AffineTransform (); 114 } 115 116 123 public AffineTransform getNormalizingTransform() { 124 return new AffineTransform (2, 0, 0, 2, 0, 0); 125 } 126 127 132 public GraphicsDevice getDevice() { 133 return new PDFGraphicsDevice(this); 134 } 135 136 } 137 138 | Popular Tags |