1:
37:
38: package ;
39:
40: import ;
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54: import ;
55: import ;
56:
57: public class XGraphicsConfiguration
58: extends GraphicsConfiguration
59: {
60:
61: XGraphicsDevice device;
62:
63: XGraphicsConfiguration(XGraphicsDevice dev)
64: {
65: device = dev;
66: }
67:
68: public GraphicsDevice getDevice()
69: {
70: return device;
71: }
72:
73: public BufferedImage createCompatibleImage(int w, int h)
74: {
75: return createCompatibleImage(w, h, Transparency.OPAQUE);
76: }
77:
78: public BufferedImage createCompatibleImage(int w, int h, int transparency)
79: {
80: BufferedImage bi;
81: switch (transparency)
82: {
83: case Transparency.OPAQUE:
84: DataBuffer buffer = new ZPixmapDataBuffer(w, h);
85: SampleModel sm = new ComponentSampleModel(DataBuffer.TYPE_BYTE, w, h,
86: 4, w * 4,
87: new int[]{0, 1, 2, 3 });
88: ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
89: ColorModel cm = new ComponentColorModel(cs, true, false,
90: Transparency.OPAQUE,
91: DataBuffer.TYPE_BYTE);
92: WritableRaster raster = Raster.createWritableRaster(sm, buffer,
93: new Point(0, 0));
94: bi = new BufferedImage(cm, raster, false, null);
95: break;
96: case Transparency.BITMASK:
97: case Transparency.TRANSLUCENT:
98: bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
99: break;
100: default:
101: throw new IllegalArgumentException("Illegal transparency: "
102: + transparency);
103: }
104: return bi;
105: }
106:
107: public VolatileImage createCompatibleVolatileImage(int w, int h)
108: {
109: return createCompatibleVolatileImage(w, h, Transparency.OPAQUE);
110: }
111:
112: public VolatileImage createCompatibleVolatileImage(int width, int height,
113: int transparency)
114: {
115: VolatileImage im;
116: switch (transparency)
117: {
118: case Transparency.OPAQUE:
119: im = new PixmapVolatileImage(width, height);
120: break;
121: case Transparency.BITMASK:
122: case Transparency.TRANSLUCENT:
123: throw new UnsupportedOperationException("Not yet implemented");
124: default:
125: throw new IllegalArgumentException("Unknown transparency type: "
126: + transparency);
127: }
128: return im;
129: }
130:
131: public ColorModel getColorModel()
132: {
133:
134: throw new UnsupportedOperationException("Not yet implemented.");
135: }
136:
137: public ColorModel getColorModel(int transparency)
138: {
139:
140: throw new UnsupportedOperationException("Not yet implemented.");
141: }
142:
143: public AffineTransform getDefaultTransform()
144: {
145:
146: throw new UnsupportedOperationException("Not yet implemented.");
147: }
148:
149: public AffineTransform getNormalizingTransform()
150: {
151:
152: throw new UnsupportedOperationException("Not yet implemented.");
153: }
154:
155: public Rectangle getBounds()
156: {
157:
158: throw new UnsupportedOperationException("Not yet implemented.");
159: }
160:
161: }