01: /*
02: * Copyright 2003-2007 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.opengl;
27:
28: import java.awt.Composite;
29: import sun.java2d.SunGraphics2D;
30: import sun.java2d.loops.GraphicsPrimitive;
31: import sun.java2d.loops.GraphicsPrimitiveMgr;
32: import sun.java2d.loops.CompositeType;
33: import sun.java2d.loops.SurfaceType;
34: import sun.java2d.pipe.BufferedMaskFill;
35: import static sun.java2d.loops.CompositeType.*;
36: import static sun.java2d.loops.SurfaceType.*;
37:
38: class OGLMaskFill extends BufferedMaskFill {
39:
40: static void register() {
41: GraphicsPrimitive[] primitives = {
42: new OGLMaskFill(AnyColor, SrcOver),
43: new OGLMaskFill(OpaqueColor, SrcNoEa),
44: new OGLMaskFill(GradientPaint, SrcOver),
45: new OGLMaskFill(OpaqueGradientPaint, SrcNoEa),
46: new OGLMaskFill(LinearGradientPaint, SrcOver),
47: new OGLMaskFill(OpaqueLinearGradientPaint, SrcNoEa),
48: new OGLMaskFill(RadialGradientPaint, SrcOver),
49: new OGLMaskFill(OpaqueRadialGradientPaint, SrcNoEa),
50: new OGLMaskFill(TexturePaint, SrcOver),
51: new OGLMaskFill(OpaqueTexturePaint, SrcNoEa), };
52: GraphicsPrimitiveMgr.register(primitives);
53: }
54:
55: protected OGLMaskFill(SurfaceType srcType, CompositeType compType) {
56: super (OGLRenderQueue.getInstance(), srcType, compType,
57: OGLSurfaceData.OpenGLSurface);
58: }
59:
60: @Override
61: protected native void maskFill(int x, int y, int w, int h,
62: int maskoff, int maskscan, int masklen, byte[] mask);
63:
64: @Override
65: protected void validateContext(SunGraphics2D sg2d, Composite comp,
66: int ctxflags) {
67: OGLSurfaceData dstData = (OGLSurfaceData) sg2d.surfaceData;
68: OGLContext.validateContext(dstData, dstData,
69: sg2d.getCompClip(), comp, null, sg2d.paint, sg2d,
70: ctxflags);
71: }
72: }
|