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