Path: blob/master/src/java.desktop/share/classes/sun/java2d/loops/DrawPath.java
41159 views
/*1* Copyright (c) 2005, 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*/2425package sun.java2d.loops;2627import java.awt.geom.Path2D;2829import sun.java2d.SunGraphics2D;30import sun.java2d.SurfaceData;3132/**33* DrawPath34* 1. draw single-width line path onto destination surface35* 2. must accept output area [x, y, dx, dy]36* from within the surface description data for clip rect37*/38public class DrawPath extends GraphicsPrimitive {3940public static final String methodSignature =41"DrawPath(...)".toString();4243public static final int primTypeID = makePrimTypeID();4445public static DrawPath locate(SurfaceType srctype,46CompositeType comptype,47SurfaceType dsttype)48{49return (DrawPath)50GraphicsPrimitiveMgr.locate(primTypeID,51srctype, comptype, dsttype);52}5354protected DrawPath(SurfaceType srctype,55CompositeType comptype,56SurfaceType dsttype)57{58super(methodSignature, primTypeID,59srctype, comptype, dsttype);60}6162public DrawPath(long pNativePrim,63SurfaceType srctype,64CompositeType comptype,65SurfaceType dsttype)66{67super(pNativePrim, methodSignature, primTypeID,68srctype, comptype, dsttype);69}707172/**73* All DrawPath implementors must have this invoker method74*/75public native void DrawPath(SunGraphics2D sg2d, SurfaceData sData,76int transX, int transY,77Path2D.Float p2df);7879public GraphicsPrimitive traceWrap() {80return new TraceDrawPath(this);81}8283private static class TraceDrawPath extends DrawPath {84DrawPath target;8586public TraceDrawPath(DrawPath target) {87super(target.getSourceType(),88target.getCompositeType(),89target.getDestType());90this.target = target;91}9293public GraphicsPrimitive traceWrap() {94return this;95}9697public void DrawPath(SunGraphics2D sg2d, SurfaceData sData,98int transX, int transY,99Path2D.Float p2df)100{101tracePrimitive(target);102target.DrawPath(sg2d, sData, transX, transY, p2df);103}104}105}106107108