140 public static final int TRANSFORM_ISIDENT = 0; /* Identity */
141
142 /* Clipping */
143 public static final int CLIP_SHAPE = 2; /* arbitrary clip */
144 public static final int CLIP_RECTANGULAR = 1; /* rectangular clip */
145 public static final int CLIP_DEVICE = 0; /* no clipping set */
146
147 /* The following fields are used when the current Paint is a Color. */
148 public int eargb; // ARGB value with ExtraAlpha baked in
149 public int pixel; // pixel value for eargb
150
151 public SurfaceData surfaceData;
152
153 public PixelDrawPipe drawpipe;
154 public PixelFillPipe fillpipe;
155 public DrawImagePipe imagepipe;
156 public ShapeDrawPipe shapepipe;
157 public TextPipe textpipe;
158 public MaskFill alphafill;
159
160 public RenderLoops loops;
161
162 public CompositeType imageComp; /* Image Transparency checked on fly */
163
164 public int paintState;
165 public int compositeState;
166 public int strokeState;
167 public int transformState;
168 public int clipState;
169
170 public Color foregroundColor;
171 public Color backgroundColor;
172
173 public AffineTransform transform;
174 public int transX;
175 public int transY;
176
177 protected static final Stroke defaultStroke = new BasicStroke();
178 protected static final Composite defaultComposite = AlphaComposite.SrcOver;
179 private static final Font defaultFont =
180 new Font(Font.DIALOG, Font.PLAIN, 12);
239
240 imageComp = CompositeType.SrcOverNoEa;
241
242 renderHint = SunHints.INTVAL_RENDER_DEFAULT;
243 antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF;
244 textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT;
245 fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF;
246 lcdTextContrast = lcdTextContrastDefaultValue;
247 interpolationHint = -1;
248 strokeHint = SunHints.INTVAL_STROKE_DEFAULT;
249
250 interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
251
252 validateColor();
253
254 font = f;
255 if (font == null) {
256 font = defaultFont;
257 }
258
259 loops = sd.getRenderLoops(this);
260 setDevClip(sd.getBounds());
261 invalidatePipe();
262 }
263
264 protected Object clone() {
265 try {
266 SunGraphics2D g = (SunGraphics2D) super.clone();
267 g.transform = new AffineTransform(this.transform);
268 if (hints != null) {
269 g.hints = (RenderingHints) this.hints.clone();
270 }
271 /* FontInfos are re-used, so must be cloned too, if they
272 * are valid, and be nulled out if invalid.
273 * The implied trade-off is that there is more to be gained
274 * from re-using these objects than is lost by having to
275 * clone them when the SG2D is cloned.
276 */
277 if (this.fontInfo != null) {
278 if (this.validFontInfo) {
279 g.fontInfo = (FontInfo)this.fontInfo.clone();
3288 }
3289
3290 /**
3291 * Returns destination that this Graphics renders to. This could be
3292 * either an Image or a Component; subclasses of SurfaceData are
3293 * responsible for returning the appropriate object.
3294 */
3295 public Object getDestination() {
3296 return surfaceData.getDestination();
3297 }
3298
3299 /**
3300 * {@inheritDoc}
3301 *
3302 * @see sun.java2d.DestSurfaceProvider#getDestSurface
3303 */
3304 @Override
3305 public Surface getDestSurface() {
3306 return surfaceData;
3307 }
3308 }
|
140 public static final int TRANSFORM_ISIDENT = 0; /* Identity */
141
142 /* Clipping */
143 public static final int CLIP_SHAPE = 2; /* arbitrary clip */
144 public static final int CLIP_RECTANGULAR = 1; /* rectangular clip */
145 public static final int CLIP_DEVICE = 0; /* no clipping set */
146
147 /* The following fields are used when the current Paint is a Color. */
148 public int eargb; // ARGB value with ExtraAlpha baked in
149 public int pixel; // pixel value for eargb
150
151 public SurfaceData surfaceData;
152
153 public PixelDrawPipe drawpipe;
154 public PixelFillPipe fillpipe;
155 public DrawImagePipe imagepipe;
156 public ShapeDrawPipe shapepipe;
157 public TextPipe textpipe;
158 public MaskFill alphafill;
159
160 private RenderLoops loops;
161
162 public CompositeType imageComp; /* Image Transparency checked on fly */
163
164 public int paintState;
165 public int compositeState;
166 public int strokeState;
167 public int transformState;
168 public int clipState;
169
170 public Color foregroundColor;
171 public Color backgroundColor;
172
173 public AffineTransform transform;
174 public int transX;
175 public int transY;
176
177 protected static final Stroke defaultStroke = new BasicStroke();
178 protected static final Composite defaultComposite = AlphaComposite.SrcOver;
179 private static final Font defaultFont =
180 new Font(Font.DIALOG, Font.PLAIN, 12);
239
240 imageComp = CompositeType.SrcOverNoEa;
241
242 renderHint = SunHints.INTVAL_RENDER_DEFAULT;
243 antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF;
244 textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT;
245 fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF;
246 lcdTextContrast = lcdTextContrastDefaultValue;
247 interpolationHint = -1;
248 strokeHint = SunHints.INTVAL_STROKE_DEFAULT;
249
250 interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
251
252 validateColor();
253
254 font = f;
255 if (font == null) {
256 font = defaultFont;
257 }
258
259 setDevClip(sd.getBounds());
260 invalidatePipe();
261 }
262
263 protected Object clone() {
264 try {
265 SunGraphics2D g = (SunGraphics2D) super.clone();
266 g.transform = new AffineTransform(this.transform);
267 if (hints != null) {
268 g.hints = (RenderingHints) this.hints.clone();
269 }
270 /* FontInfos are re-used, so must be cloned too, if they
271 * are valid, and be nulled out if invalid.
272 * The implied trade-off is that there is more to be gained
273 * from re-using these objects than is lost by having to
274 * clone them when the SG2D is cloned.
275 */
276 if (this.fontInfo != null) {
277 if (this.validFontInfo) {
278 g.fontInfo = (FontInfo)this.fontInfo.clone();
3287 }
3288
3289 /**
3290 * Returns destination that this Graphics renders to. This could be
3291 * either an Image or a Component; subclasses of SurfaceData are
3292 * responsible for returning the appropriate object.
3293 */
3294 public Object getDestination() {
3295 return surfaceData.getDestination();
3296 }
3297
3298 /**
3299 * {@inheritDoc}
3300 *
3301 * @see sun.java2d.DestSurfaceProvider#getDestSurface
3302 */
3303 @Override
3304 public Surface getDestSurface() {
3305 return surfaceData;
3306 }
3307
3308 /**
3309 * Return the {@code RenderLoops} associated to this Graphics object.
3310 *
3311 * @return the loops
3312 */
3313 public RenderLoops getLoops() {
3314
3315 if (loops == null) {
3316 loops = surfaceData.getRenderLoops(this);
3317 }
3318 return loops;
3319 }
3320
3321 /**
3322 * Sets new {@code RenderLoops} for this object.
3323 *
3324 * @param loops the loops to set
3325 */
3326 public void setLoops(RenderLoops loops) {
3327 this.loops = loops;
3328 }
3329 }
|