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:
51: public class QtScreenDeviceConfiguration extends GraphicsConfiguration {
52:
53: private QtScreenDevice owner;
54: private Rectangle bounds;
55: private double dpiX, dpiY;
56: private int depth;
57:
58: public QtScreenDeviceConfiguration(QtScreenDevice owner)
59: {
60: this.owner = owner;
61: bounds = owner.getBounds();
62: dpiX = owner.getDpiX();
63: dpiY = owner.getDpiY();
64: depth = owner.depth();
65: }
66:
67: public BufferedImage createCompatibleImage(int width, int height)
68: {
69: switch( depth )
70: {
71: case 24:
72: return new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
73: case 16:
74: return new BufferedImage(width, height,
75: BufferedImage.TYPE_USHORT_565_RGB);
76: case 8:
77: return new BufferedImage(width, height, BufferedImage.TYPE_BYTE_INDEXED);
78: default:
79: case 32:
80: return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
81: }
82: }
83:
84: public BufferedImage createCompatibleImage(int width, int height, int transparency)
85: {
86:
87:
88: if(depth == 32)
89: return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
90: return createCompatibleImage(width, height);
91: }
92:
93: public VolatileImage createCompatibleVolatileImage(int width, int height)
94: {
95: return new QtVolatileImage( width, height );
96: }
97:
98: public VolatileImage createCompatibleVolatileImage(int width, int height,
99: ImageCapabilities caps)
100: {
101: return createCompatibleVolatileImage( width, height );
102: }
103:
104: public Rectangle getBounds()
105: {
106: return bounds;
107: }
108:
109: public ColorModel getColorModel()
110: {
111:
112: return QtToolkit.getDefaultToolkit().getColorModel();
113: }
114:
115: public ColorModel getColorModel(int transparency)
116: {
117:
118: return QtToolkit.getDefaultToolkit().getColorModel();
119: }
120:
121: public AffineTransform getDefaultTransform()
122: {
123: return new AffineTransform();
124: }
125:
126: public GraphicsDevice getDevice()
127: {
128: return owner;
129: }
130:
131:
135: public AffineTransform getNormalizingTransform()
136: {
137: AffineTransform nTrans = new AffineTransform();
138: nTrans.scale( 72.0 / dpiX, 72.0 / dpiY );
139: return nTrans;
140: }
141:
142: public VolatileImage createCompatibleVolatileImage(int width, int height,
143: int transparency)
144: {
145: return createCompatibleVolatileImage(width, height);
146: }
147: }