Path: blob/master/src/java.desktop/share/classes/sun/java2d/loops/DrawParallelogram.java
41159 views
/*1* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/*26* @author Jim Graham27*/2829package sun.java2d.loops;3031import sun.java2d.SunGraphics2D;32import sun.java2d.SurfaceData;3334/**35* DrawParallelogram36* 1) fill the area between the 4 edges of an outer parallelogram37* (as specified by an origin and 2 delta vectors)38* but also outside the 4 edges of an inner parallelogram39* (as specified by proportional amounts of the outer delta vectors)40*/41public class DrawParallelogram extends GraphicsPrimitive42{43public static final String methodSignature =44"DrawParallelogram(...)".toString();4546public static final int primTypeID = makePrimTypeID();4748public static DrawParallelogram locate(SurfaceType srctype,49CompositeType comptype,50SurfaceType dsttype)51{52return (DrawParallelogram)53GraphicsPrimitiveMgr.locate(primTypeID,54srctype, comptype, dsttype);55}5657protected DrawParallelogram(SurfaceType srctype,58CompositeType comptype,59SurfaceType dsttype)60{61super(methodSignature, primTypeID,62srctype, comptype, dsttype);63}6465public DrawParallelogram(long pNativePrim,66SurfaceType srctype,67CompositeType comptype,68SurfaceType dsttype)69{70super(pNativePrim, methodSignature, primTypeID,71srctype, comptype, dsttype);72}7374/**75* All DrawParallelogram implementors must have this invoker method76*/77public native void DrawParallelogram(SunGraphics2D sg, SurfaceData dest,78double x, double y,79double dx1, double dy1,80double dx2, double dy2,81double lw1, double lw2);8283public GraphicsPrimitive traceWrap() {84return new TraceDrawParallelogram(this);85}8687private static class TraceDrawParallelogram extends DrawParallelogram {88DrawParallelogram target;8990public TraceDrawParallelogram(DrawParallelogram target) {91super(target.getSourceType(),92target.getCompositeType(),93target.getDestType());94this.target = target;95}9697public GraphicsPrimitive traceWrap() {98return this;99}100101public void DrawParallelogram(SunGraphics2D sg2d, SurfaceData dest,102double x, double y,103double dx1, double dy1,104double dx2, double dy2,105double lw1, double lw2)106{107tracePrimitive(target);108target.DrawParallelogram(sg2d, dest,109x, y, dx1, dy1, dx2, dy2, lw1, lw2);110}111}112}113114115