3172N/A/*
3261N/A * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
3172N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3172N/A *
3172N/A * This code is free software; you can redistribute it and/or modify it
3172N/A * under the terms of the GNU General Public License version 2 only, as
3172N/A * published by the Free Software Foundation. Oracle designates this
3172N/A * particular file as subject to the "Classpath" exception as provided
3172N/A * by Oracle in the LICENSE file that accompanied this code.
3172N/A *
3172N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3172N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3172N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3172N/A * version 2 for more details (a copy is included in the LICENSE file that
3172N/A * accompanied this code).
3172N/A *
3172N/A * You should have received a copy of the GNU General Public License version
3172N/A * 2 along with this work; if not, write to the Free Software Foundation,
3172N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3172N/A *
3172N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3172N/A * or visit www.oracle.com if you need additional information or have any
3172N/A * questions.
3172N/A */
3172N/A
3172N/A/*
3172N/A * @author Jim Graham
3172N/A */
3172N/A
3172N/Apackage sun.java2d.loops;
3172N/A
3172N/Aimport sun.java2d.loops.GraphicsPrimitive;
3172N/Aimport sun.java2d.SunGraphics2D;
3172N/Aimport sun.java2d.SurfaceData;
3172N/A
3172N/A/**
3172N/A * FillParallelogram
3172N/A * 1) fill the area between the 4 edges of a parallelogram
3172N/A * (as specified by an origin and 2 delta vectors)
3172N/A */
3172N/Apublic class FillParallelogram extends GraphicsPrimitive
3172N/A{
3172N/A public final static String methodSignature =
3172N/A "FillParallelogram(...)".toString();
3172N/A
3172N/A public final static int primTypeID = makePrimTypeID();
3172N/A
3172N/A public static FillParallelogram locate(SurfaceType srctype,
3172N/A CompositeType comptype,
3172N/A SurfaceType dsttype)
3172N/A {
3172N/A return (FillParallelogram)
3172N/A GraphicsPrimitiveMgr.locate(primTypeID,
3172N/A srctype, comptype, dsttype);
3172N/A }
3172N/A
3172N/A protected FillParallelogram(SurfaceType srctype,
3172N/A CompositeType comptype,
3172N/A SurfaceType dsttype)
3172N/A {
3172N/A super(methodSignature, primTypeID,
3172N/A srctype, comptype, dsttype);
3172N/A }
3172N/A
3172N/A public FillParallelogram(long pNativePrim,
3172N/A SurfaceType srctype,
3172N/A CompositeType comptype,
3172N/A SurfaceType dsttype)
3172N/A {
3172N/A super(pNativePrim, methodSignature, primTypeID,
3172N/A srctype, comptype, dsttype);
3172N/A }
3172N/A
3172N/A /**
3172N/A * All FillParallelogram implementors must have this invoker method
3172N/A */
3172N/A public native void FillParallelogram(SunGraphics2D sg2d, SurfaceData dest,
3172N/A double x0, double y0,
3172N/A double dx1, double dy1,
3172N/A double dx2, double dy2);
3172N/A
3172N/A public GraphicsPrimitive makePrimitive(SurfaceType srctype,
3172N/A CompositeType comptype,
3172N/A SurfaceType dsttype)
3172N/A {
3172N/A // REMIND: iterate with a FillRect primitive?
3172N/A throw new InternalError("FillParallelogram not implemented for "+
3172N/A srctype+" with "+comptype);
3172N/A }
3172N/A
3172N/A public GraphicsPrimitive traceWrap() {
3172N/A return new TraceFillParallelogram(this);
3172N/A }
3172N/A
3172N/A private static class TraceFillParallelogram extends FillParallelogram {
3172N/A FillParallelogram target;
3172N/A
3172N/A public TraceFillParallelogram(FillParallelogram target) {
3172N/A super(target.getSourceType(),
3172N/A target.getCompositeType(),
3172N/A target.getDestType());
3172N/A this.target = target;
3172N/A }
3172N/A
3172N/A public GraphicsPrimitive traceWrap() {
3172N/A return this;
3172N/A }
3172N/A
3172N/A public void FillParallelogram(SunGraphics2D sg2d, SurfaceData dest,
3172N/A double x0, double y0,
3172N/A double dx1, double dy1,
3172N/A double dx2, double dy2)
3172N/A {
3172N/A tracePrimitive(target);
3172N/A target.FillParallelogram(sg2d, dest, x0, y0, dx1, dy1, dx2, dy2);
3172N/A }
3172N/A }
3172N/A}