2
|
1 |
/*
|
|
2 |
* Copyright 2005-2006 Sun Microsystems, Inc. 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. Sun designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* 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 |
* DrawPath
|
|
35 |
* 1. draw single-width line 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 DrawPath extends GraphicsPrimitive {
|
|
40 |
|
|
41 |
public final static String methodSignature =
|
|
42 |
"DrawPath(...)".toString();
|
|
43 |
|
|
44 |
public final static int primTypeID = makePrimTypeID();
|
|
45 |
|
|
46 |
public static DrawPath locate(SurfaceType srctype,
|
|
47 |
CompositeType comptype,
|
|
48 |
SurfaceType dsttype)
|
|
49 |
{
|
|
50 |
return (DrawPath)
|
|
51 |
GraphicsPrimitiveMgr.locate(primTypeID,
|
|
52 |
srctype, comptype, dsttype);
|
|
53 |
}
|
|
54 |
|
|
55 |
protected DrawPath(SurfaceType srctype,
|
|
56 |
CompositeType comptype,
|
|
57 |
SurfaceType dsttype)
|
|
58 |
{
|
|
59 |
super(methodSignature, primTypeID,
|
|
60 |
srctype, comptype, dsttype);
|
|
61 |
}
|
|
62 |
|
|
63 |
public DrawPath(long pNativePrim,
|
|
64 |
SurfaceType srctype,
|
|
65 |
CompositeType comptype,
|
|
66 |
SurfaceType dsttype)
|
|
67 |
{
|
|
68 |
super(pNativePrim, methodSignature, primTypeID,
|
|
69 |
srctype, comptype, dsttype);
|
|
70 |
}
|
|
71 |
|
|
72 |
|
|
73 |
/**
|
|
74 |
* All DrawPath implementors must have this invoker method
|
|
75 |
*/
|
|
76 |
public native void DrawPath(SunGraphics2D sg2d, SurfaceData sData,
|
|
77 |
int transX, int transY,
|
|
78 |
Path2D.Float p2df);
|
|
79 |
|
|
80 |
public GraphicsPrimitive makePrimitive(SurfaceType srctype,
|
|
81 |
CompositeType comptype,
|
|
82 |
SurfaceType dsttype)
|
|
83 |
{
|
|
84 |
throw new InternalError("DrawPath not implemented for "+
|
|
85 |
srctype+" with "+comptype);
|
|
86 |
}
|
|
87 |
|
|
88 |
public GraphicsPrimitive traceWrap() {
|
|
89 |
return new TraceDrawPath(this);
|
|
90 |
}
|
|
91 |
|
|
92 |
private static class TraceDrawPath extends DrawPath {
|
|
93 |
DrawPath target;
|
|
94 |
|
|
95 |
public TraceDrawPath(DrawPath target) {
|
|
96 |
super(target.getSourceType(),
|
|
97 |
target.getCompositeType(),
|
|
98 |
target.getDestType());
|
|
99 |
this.target = target;
|
|
100 |
}
|
|
101 |
|
|
102 |
public GraphicsPrimitive traceWrap() {
|
|
103 |
return this;
|
|
104 |
}
|
|
105 |
|
|
106 |
public void DrawPath(SunGraphics2D sg2d, SurfaceData sData,
|
|
107 |
int transX, int transY,
|
|
108 |
Path2D.Float p2df)
|
|
109 |
{
|
|
110 |
tracePrimitive(target);
|
|
111 |
target.DrawPath(sg2d, sData, transX, transY, p2df);
|
|
112 |
}
|
|
113 |
}
|
|
114 |
}
|