Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/java2d/loops/DrawParallelogram.java
38918 views
/*1* Copyright (c) 2008, 2010, 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.loops.GraphicsPrimitive;32import sun.java2d.SunGraphics2D;33import sun.java2d.SurfaceData;3435/**36* DrawParallelogram37* 1) fill the area between the 4 edges of an outer parallelogram38* (as specified by an origin and 2 delta vectors)39* but also outside the 4 edges of an inner parallelogram40* (as specified by proportional amounts of the outer delta vectors)41*/42public class DrawParallelogram extends GraphicsPrimitive43{44public final static String methodSignature =45"DrawParallelogram(...)".toString();4647public final static int primTypeID = makePrimTypeID();4849public static DrawParallelogram locate(SurfaceType srctype,50CompositeType comptype,51SurfaceType dsttype)52{53return (DrawParallelogram)54GraphicsPrimitiveMgr.locate(primTypeID,55srctype, comptype, dsttype);56}5758protected DrawParallelogram(SurfaceType srctype,59CompositeType comptype,60SurfaceType dsttype)61{62super(methodSignature, primTypeID,63srctype, comptype, dsttype);64}6566public DrawParallelogram(long pNativePrim,67SurfaceType srctype,68CompositeType comptype,69SurfaceType dsttype)70{71super(pNativePrim, methodSignature, primTypeID,72srctype, comptype, dsttype);73}7475/**76* All DrawParallelogram implementors must have this invoker method77*/78public native void DrawParallelogram(SunGraphics2D sg, SurfaceData dest,79double x, double y,80double dx1, double dy1,81double dx2, double dy2,82double lw1, double lw2);8384public GraphicsPrimitive makePrimitive(SurfaceType srctype,85CompositeType comptype,86SurfaceType dsttype)87{88// REMIND: iterate with a FillRect primitive?89throw new InternalError("DrawParallelogram not implemented for "+90srctype+" with "+comptype);91}9293public GraphicsPrimitive traceWrap() {94return new TraceDrawParallelogram(this);95}9697private static class TraceDrawParallelogram extends DrawParallelogram {98DrawParallelogram target;99100public TraceDrawParallelogram(DrawParallelogram target) {101super(target.getSourceType(),102target.getCompositeType(),103target.getDestType());104this.target = target;105}106107public GraphicsPrimitive traceWrap() {108return this;109}110111public void DrawParallelogram(SunGraphics2D sg2d, SurfaceData dest,112double x, double y,113double dx1, double dy1,114double dx2, double dy2,115double lw1, double lw2)116{117tracePrimitive(target);118target.DrawParallelogram(sg2d, dest,119x, y, dx1, dy1, dx2, dy2, lw1, lw2);120}121}122}123124125