blob: 491fc62a511e52678cc13123d02a0bcc94be9d65 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
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
26package sun.java2d.loops;
27
28import sun.java2d.loops.GraphicsPrimitive;
29import sun.java2d.SunGraphics2D;
30import sun.java2d.SurfaceData;
31import 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 */
39public class FillPath extends GraphicsPrimitive {
40
41 public final static String methodSignature =
42 "FillPath(...)".toString();
43
44 public final static int primTypeID = makePrimTypeID();
45
46 public static FillPath locate(SurfaceType srctype,
47 CompositeType comptype,
48 SurfaceType dsttype)
49 {
50 return (FillPath)
51 GraphicsPrimitiveMgr.locate(primTypeID,
52 srctype, comptype, dsttype);
53 }
54
55 protected FillPath(SurfaceType srctype,
56 CompositeType comptype,
57 SurfaceType dsttype)
58 {
59 super(methodSignature, primTypeID,
60 srctype, comptype, dsttype);
61 }
62
63 public FillPath(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 FillPath implementors must have this invoker method
75 */
76 public native void FillPath(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("FillPath not implemented for "+
85 srctype+" with "+comptype);
86 }
87
88 public GraphicsPrimitive traceWrap() {
89 return new TraceFillPath(this);
90 }
91
92 private static class TraceFillPath extends FillPath {
93 FillPath target;
94
95 public TraceFillPath(FillPath 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 FillPath(SunGraphics2D sg2d, SurfaceData sData,
107 int transX, int transY,
108 Path2D.Float p2df)
109 {
110 tracePrimitive(target);
111 target.FillPath(sg2d, sData, transX, transY, p2df);
112 }
113 }
114}