89 public static Win32GraphicsConfig getConfig(Win32GraphicsDevice device,
90 int pixFormatID)
91 {
92 return new Win32GraphicsConfig(device, pixFormatID);
93 }
94
95 /**
96 * @deprecated as of JDK version 1.3
97 * replaced by <code>getConfig()</code>
98 */
99 @Deprecated
100 public Win32GraphicsConfig(GraphicsDevice device, int visualnum) {
101 this.screen = (Win32GraphicsDevice)device;
102 this.visual = visualnum;
103 ((Win32GraphicsDevice)device).addDisplayChangedListener(this);
104 }
105
106 /**
107 * Return the graphics device associated with this configuration.
108 */
109 public GraphicsDevice getDevice() {
110 return screen;
111 }
112
113 /**
114 * Return the PixelFormatIndex this GraphicsConfig uses
115 */
116 public int getVisual() {
117 return visual;
118 }
119
120 public Object getProxyKey() {
121 return screen;
122 }
123
124 /**
125 * Return the RenderLoops this type of destination uses for
126 * solid fills and strokes.
127 */
128 private SurfaceType sTypeOrig = null;
129 public synchronized RenderLoops getSolidLoops(SurfaceType stype) {
165 return getColorModel();
166 case Transparency.BITMASK:
167 return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
168 case Transparency.TRANSLUCENT:
169 return ColorModel.getRGBdefault();
170 default:
171 return null;
172 }
173 }
174
175 /**
176 * Returns the default Transform for this configuration. This
177 * Transform is typically the Identity transform for most normal
178 * screens. Device coordinates for screen and printer devices will
179 * have the origin in the upper left-hand corner of the target region of
180 * the device, with X coordinates
181 * increasing to the right and Y coordinates increasing downwards.
182 * For image buffers, this Transform will be the Identity transform.
183 */
184 public AffineTransform getDefaultTransform() {
185 return new AffineTransform();
186 }
187
188 /**
189 *
190 * Returns a Transform that can be composed with the default Transform
191 * of a Graphics2D so that 72 units in user space will equal 1 inch
192 * in device space.
193 * Given a Graphics2D, g, one can reset the transformation to create
194 * such a mapping by using the following pseudocode:
195 * <pre>
196 * GraphicsConfiguration gc = g.getGraphicsConfiguration();
197 *
198 * g.setTransform(gc.getDefaultTransform());
199 * g.transform(gc.getNormalizingTransform());
200 * </pre>
201 * Note that sometimes this Transform will be identity (e.g. for
202 * printers or metafile output) and that this Transform is only
203 * as accurate as the information supplied by the underlying system.
204 * For image buffers, this Transform will be the Identity transform,
205 * since there is no valid distance measurement.
|
89 public static Win32GraphicsConfig getConfig(Win32GraphicsDevice device,
90 int pixFormatID)
91 {
92 return new Win32GraphicsConfig(device, pixFormatID);
93 }
94
95 /**
96 * @deprecated as of JDK version 1.3
97 * replaced by <code>getConfig()</code>
98 */
99 @Deprecated
100 public Win32GraphicsConfig(GraphicsDevice device, int visualnum) {
101 this.screen = (Win32GraphicsDevice)device;
102 this.visual = visualnum;
103 ((Win32GraphicsDevice)device).addDisplayChangedListener(this);
104 }
105
106 /**
107 * Return the graphics device associated with this configuration.
108 */
109 public Win32GraphicsDevice getDevice() {
110 return screen;
111 }
112
113 /**
114 * Return the PixelFormatIndex this GraphicsConfig uses
115 */
116 public int getVisual() {
117 return visual;
118 }
119
120 public Object getProxyKey() {
121 return screen;
122 }
123
124 /**
125 * Return the RenderLoops this type of destination uses for
126 * solid fills and strokes.
127 */
128 private SurfaceType sTypeOrig = null;
129 public synchronized RenderLoops getSolidLoops(SurfaceType stype) {
165 return getColorModel();
166 case Transparency.BITMASK:
167 return new DirectColorModel(25, 0xff0000, 0xff00, 0xff, 0x1000000);
168 case Transparency.TRANSLUCENT:
169 return ColorModel.getRGBdefault();
170 default:
171 return null;
172 }
173 }
174
175 /**
176 * Returns the default Transform for this configuration. This
177 * Transform is typically the Identity transform for most normal
178 * screens. Device coordinates for screen and printer devices will
179 * have the origin in the upper left-hand corner of the target region of
180 * the device, with X coordinates
181 * increasing to the right and Y coordinates increasing downwards.
182 * For image buffers, this Transform will be the Identity transform.
183 */
184 public AffineTransform getDefaultTransform() {
185 double scaleX = screen.getDefaultScaleX();
186 double scaleY = screen.getDefaultScaleY();
187 return AffineTransform.getScaleInstance(scaleX, scaleY);
188 }
189
190 /**
191 *
192 * Returns a Transform that can be composed with the default Transform
193 * of a Graphics2D so that 72 units in user space will equal 1 inch
194 * in device space.
195 * Given a Graphics2D, g, one can reset the transformation to create
196 * such a mapping by using the following pseudocode:
197 * <pre>
198 * GraphicsConfiguration gc = g.getGraphicsConfiguration();
199 *
200 * g.setTransform(gc.getDefaultTransform());
201 * g.transform(gc.getNormalizingTransform());
202 * </pre>
203 * Note that sometimes this Transform will be identity (e.g. for
204 * printers or metafile output) and that this Transform is only
205 * as accurate as the information supplied by the underlying system.
206 * For image buffers, this Transform will be the Identity transform,
207 * since there is no valid distance measurement.
|