2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
|
2
|
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
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
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 |
*
|
5506
|
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
|
|
23 |
* questions.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
/*
|
|
27 |
* @author Jim Graham
|
|
28 |
* @author Charlton Innovations, Inc.
|
|
29 |
*/
|
|
30 |
|
|
31 |
package sun.java2d.loops;
|
|
32 |
|
|
33 |
import sun.java2d.loops.GraphicsPrimitive;
|
|
34 |
import sun.java2d.pipe.SpanIterator;
|
|
35 |
import java.awt.Color;
|
|
36 |
import java.awt.image.ColorModel;
|
|
37 |
import java.awt.image.Raster;
|
|
38 |
import sun.java2d.SunGraphics2D;
|
|
39 |
import sun.java2d.SurfaceData;
|
|
40 |
|
|
41 |
/**
|
|
42 |
* FillSpans
|
|
43 |
* 1) draw solid color onto destination surface
|
|
44 |
* 2) rectangular areas to fill come from SpanIterator
|
|
45 |
*/
|
|
46 |
public class FillSpans extends GraphicsPrimitive
|
|
47 |
{
|
|
48 |
public final static String methodSignature = "FillSpans(...)".toString();
|
|
49 |
|
|
50 |
public final static int primTypeID = makePrimTypeID();
|
|
51 |
|
|
52 |
public static FillSpans locate(SurfaceType srctype,
|
|
53 |
CompositeType comptype,
|
|
54 |
SurfaceType dsttype)
|
|
55 |
{
|
|
56 |
return (FillSpans)
|
|
57 |
GraphicsPrimitiveMgr.locate(primTypeID,
|
|
58 |
srctype, comptype, dsttype);
|
|
59 |
}
|
|
60 |
|
|
61 |
protected FillSpans(SurfaceType srctype,
|
|
62 |
CompositeType comptype,
|
|
63 |
SurfaceType dsttype)
|
|
64 |
{
|
|
65 |
super(methodSignature, primTypeID, srctype, comptype, dsttype);
|
|
66 |
}
|
|
67 |
|
|
68 |
public FillSpans(long pNativePrim,
|
|
69 |
SurfaceType srctype,
|
|
70 |
CompositeType comptype,
|
|
71 |
SurfaceType dsttype)
|
|
72 |
{
|
|
73 |
super(pNativePrim, methodSignature, primTypeID, srctype, comptype, dsttype);
|
|
74 |
}
|
|
75 |
|
|
76 |
private native void FillSpans(SunGraphics2D sg2d, SurfaceData dest,
|
|
77 |
int pixel, long pIterator, SpanIterator si);
|
|
78 |
|
|
79 |
/**
|
|
80 |
* All FillSpan implementors must have this invoker method
|
|
81 |
*/
|
|
82 |
public void FillSpans(SunGraphics2D sg2d, SurfaceData dest,
|
|
83 |
SpanIterator si)
|
|
84 |
{
|
|
85 |
FillSpans(sg2d, dest, sg2d.pixel, si.getNativeIterator(), si);
|
|
86 |
}
|
|
87 |
|
|
88 |
public GraphicsPrimitive makePrimitive(SurfaceType srctype,
|
|
89 |
CompositeType comptype,
|
|
90 |
SurfaceType dsttype)
|
|
91 |
{
|
|
92 |
// REMIND: iterate with a FillRect primitive?
|
|
93 |
throw new InternalError("FillSpans not implemented for "+
|
|
94 |
srctype+" with "+comptype);
|
|
95 |
}
|
|
96 |
|
|
97 |
public GraphicsPrimitive traceWrap() {
|
|
98 |
return new TraceFillSpans(this);
|
|
99 |
}
|
|
100 |
|
|
101 |
private static class TraceFillSpans extends FillSpans {
|
|
102 |
FillSpans target;
|
|
103 |
|
|
104 |
public TraceFillSpans(FillSpans target) {
|
|
105 |
super(target.getSourceType(),
|
|
106 |
target.getCompositeType(),
|
|
107 |
target.getDestType());
|
|
108 |
this.target = target;
|
|
109 |
}
|
|
110 |
|
|
111 |
public GraphicsPrimitive traceWrap() {
|
|
112 |
return this;
|
|
113 |
}
|
|
114 |
|
|
115 |
public void FillSpans(SunGraphics2D sg2d, SurfaceData dest,
|
|
116 |
SpanIterator si)
|
|
117 |
{
|
|
118 |
tracePrimitive(target);
|
|
119 |
target.FillSpans(sg2d, dest, si);
|
|
120 |
}
|
|
121 |
}
|
|
122 |
}
|