1 /*
2 * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
247 int npoints)
248 {
249 try {
250 doFillPoly((GDIWindowSurfaceData)sg2d.surfaceData,
251 sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
252 sg2d.transX, sg2d.transY, xpoints, ypoints, npoints);
253 } catch (ClassCastException e) {
254 throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
255 }
256 }
257
258 native void doShape(GDIWindowSurfaceData sData,
259 Region clip, Composite comp, int color,
260 int transX, int transY,
261 Path2D.Float p2df, boolean isfill);
262
263 void doShape(SunGraphics2D sg2d, Shape s, boolean isfill) {
264 Path2D.Float p2df;
265 int transX;
266 int transY;
267 if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
268 if (s instanceof Path2D.Float) {
269 p2df = (Path2D.Float)s;
270 } else {
271 p2df = new Path2D.Float(s);
272 }
273 transX = sg2d.transX;
274 transY = sg2d.transY;
275 } else {
276 p2df = new Path2D.Float(s, sg2d.transform);
277 transX = 0;
278 transY = 0;
279 }
280 try {
281 doShape((GDIWindowSurfaceData)sg2d.surfaceData,
282 sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
283 transX, transY, p2df, isfill);
284 } catch (ClassCastException e) {
285 throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
286 }
287 }
291 // by a native FillSpans method or a getHintedStrokeGeneralPath()
292 // method that could be filled by the doShape method more quickly.
293 public void doFillSpans(SunGraphics2D sg2d, SpanIterator si) {
294 int box[] = new int[4];
295 GDIWindowSurfaceData sd;
296 try {
297 sd = (GDIWindowSurfaceData)sg2d.surfaceData;
298 } catch (ClassCastException e) {
299 throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
300 }
301 Region clip = sg2d.getCompClip();
302 Composite comp = sg2d.composite;
303 int eargb = sg2d.eargb;
304 while (si.nextSpan(box)) {
305 doFillRect(sd, clip, comp, eargb,
306 box[0], box[1], box[2]-box[0], box[3]-box[1]);
307 }
308 }
309
310 public void draw(SunGraphics2D sg2d, Shape s) {
311 if (sg2d.strokeState == sg2d.STROKE_THIN) {
312 doShape(sg2d, s, false);
313 } else if (sg2d.strokeState < sg2d.STROKE_CUSTOM) {
314 ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
315 try {
316 doFillSpans(sg2d, si);
317 } finally {
318 si.dispose();
319 }
320 } else {
321 doShape(sg2d, sg2d.stroke.createStrokedShape(s), true);
322 }
323 }
324
325 public void fill(SunGraphics2D sg2d, Shape s) {
326 doShape(sg2d, s, true);
327 }
328
329 public native void devCopyArea(GDIWindowSurfaceData sData,
330 int srcx, int srcy,
331 int dx, int dy,
332 int w, int h);
333
|
1 /*
2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
247 int npoints)
248 {
249 try {
250 doFillPoly((GDIWindowSurfaceData)sg2d.surfaceData,
251 sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
252 sg2d.transX, sg2d.transY, xpoints, ypoints, npoints);
253 } catch (ClassCastException e) {
254 throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
255 }
256 }
257
258 native void doShape(GDIWindowSurfaceData sData,
259 Region clip, Composite comp, int color,
260 int transX, int transY,
261 Path2D.Float p2df, boolean isfill);
262
263 void doShape(SunGraphics2D sg2d, Shape s, boolean isfill) {
264 Path2D.Float p2df;
265 int transX;
266 int transY;
267 if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
268 if (s instanceof Path2D.Float) {
269 p2df = (Path2D.Float)s;
270 } else {
271 p2df = new Path2D.Float(s);
272 }
273 transX = sg2d.transX;
274 transY = sg2d.transY;
275 } else {
276 p2df = new Path2D.Float(s, sg2d.transform);
277 transX = 0;
278 transY = 0;
279 }
280 try {
281 doShape((GDIWindowSurfaceData)sg2d.surfaceData,
282 sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
283 transX, transY, p2df, isfill);
284 } catch (ClassCastException e) {
285 throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
286 }
287 }
291 // by a native FillSpans method or a getHintedStrokeGeneralPath()
292 // method that could be filled by the doShape method more quickly.
293 public void doFillSpans(SunGraphics2D sg2d, SpanIterator si) {
294 int box[] = new int[4];
295 GDIWindowSurfaceData sd;
296 try {
297 sd = (GDIWindowSurfaceData)sg2d.surfaceData;
298 } catch (ClassCastException e) {
299 throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
300 }
301 Region clip = sg2d.getCompClip();
302 Composite comp = sg2d.composite;
303 int eargb = sg2d.eargb;
304 while (si.nextSpan(box)) {
305 doFillRect(sd, clip, comp, eargb,
306 box[0], box[1], box[2]-box[0], box[3]-box[1]);
307 }
308 }
309
310 public void draw(SunGraphics2D sg2d, Shape s) {
311 if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
312 doShape(sg2d, s, false);
313 } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
314 ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
315 try {
316 doFillSpans(sg2d, si);
317 } finally {
318 si.dispose();
319 }
320 } else {
321 doShape(sg2d, sg2d.stroke.createStrokedShape(s), true);
322 }
323 }
324
325 public void fill(SunGraphics2D sg2d, Shape s) {
326 doShape(sg2d, s, true);
327 }
328
329 public native void devCopyArea(GDIWindowSurfaceData sData,
330 int srcx, int srcy,
331 int dx, int dy,
332 int w, int h);
333
|