01: /*
02: * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: package sun.java2d.loops;
27:
28: import sun.java2d.loops.GraphicsPrimitive;
29: import sun.java2d.SunGraphics2D;
30: import sun.java2d.SurfaceData;
31: import java.awt.geom.Path2D;
32:
33: /**
34: * FillPath
35: * 1. fill path onto destination surface
36: * 2. must accept output area [x, y, dx, dy]
37: * from within the surface description data for clip rect
38: */
39: public class FillPath extends GraphicsPrimitive {
40:
41: public final static String methodSignature = "FillPath(...)"
42: .toString();
43:
44: public final static int primTypeID = makePrimTypeID();
45:
46: public static FillPath locate(SurfaceType srctype,
47: CompositeType comptype, SurfaceType dsttype) {
48: return (FillPath) GraphicsPrimitiveMgr.locate(primTypeID,
49: srctype, comptype, dsttype);
50: }
51:
52: protected FillPath(SurfaceType srctype, CompositeType comptype,
53: SurfaceType dsttype) {
54: super (methodSignature, primTypeID, srctype, comptype, dsttype);
55: }
56:
57: public FillPath(long pNativePrim, SurfaceType srctype,
58: CompositeType comptype, SurfaceType dsttype) {
59: super (pNativePrim, methodSignature, primTypeID, srctype,
60: comptype, dsttype);
61: }
62:
63: /**
64: * All FillPath implementors must have this invoker method
65: */
66: public native void FillPath(SunGraphics2D sg2d, SurfaceData sData,
67: int transX, int transY, Path2D.Float p2df);
68:
69: public GraphicsPrimitive makePrimitive(SurfaceType srctype,
70: CompositeType comptype, SurfaceType dsttype) {
71: throw new InternalError("FillPath not implemented for "
72: + srctype + " with " + comptype);
73: }
74:
75: public GraphicsPrimitive traceWrap() {
76: return new TraceFillPath(this );
77: }
78:
79: private static class TraceFillPath extends FillPath {
80: FillPath target;
81:
82: public TraceFillPath(FillPath target) {
83: super (target.getSourceType(), target.getCompositeType(),
84: target.getDestType());
85: this .target = target;
86: }
87:
88: public GraphicsPrimitive traceWrap() {
89: return this ;
90: }
91:
92: public void FillPath(SunGraphics2D sg2d, SurfaceData sData,
93: int transX, int transY, Path2D.Float p2df) {
94: tracePrimitive(target);
95: target.FillPath(sg2d, sData, transX, transY, p2df);
96: }
97: }
98: }
|