1 /* 2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.webkit.graphics; 27 28 public abstract class WCPath<P> extends Ref { 29 30 /* The WindRule should be compliant with 31 * WebCore/platform/graphics/Path.h 32 */ 33 34 /** 35 * The winding rule constant for specifying a non-zero rule 36 * for determining the interior of a path. 37 * The non-zero rule specifies that a point lies inside the 38 * path if a ray drawn in any direction from that point to 39 * infinity is crossed by path segments a different number 40 * of times in the counter-clockwise direction than the 41 * clockwise direction. 42 */ 43 public static final int RULE_NONZERO = 0; 44 45 /** 46 * The winding rule constant for specifying an even-odd rule 47 * for determining the interior of a path. 48 * The even-odd rule specifies that a point lies inside the 49 * path if a ray drawn in any direction from that point to 50 * infinity is crossed by path segments an odd number of times. 51 */ 52 public static final int RULE_EVENODD = 1; 53 54 public abstract void addRect(double x, double y, double w, double h); 55 56 public abstract void addEllipse(double x, double y, double w, double h); 57 58 public abstract void addArcTo(double x1, double y1, double x2, double y2, double r); 59 60 public abstract void addArc(double x, double y, double r, double startAngle, 61 double endAngle, boolean aclockwise); 62 63 public abstract boolean contains(int rule, double x, double y); 64 65 public abstract WCRectangle getBounds(); 66 67 public abstract void clear(); 68 69 public abstract void moveTo(double x, double y); 70 71 public abstract void addLineTo(double x, double y); 72 73 public abstract void addQuadCurveTo(double x0, double y0, double x1, double y1); 74 75 public abstract void addBezierCurveTo(double x0, double y0, 76 double x1, double y1, 77 double x2, double y2); 78 79 public abstract void addPath(WCPath path); 80 81 public abstract void closeSubpath(); 82 83 public abstract boolean hasCurrentPoint(); 84 85 public abstract boolean isEmpty(); 86 87 public abstract void translate(double x, double y); 88 89 public abstract void transform(double mxx, double myx, 90 double mxy, double myy, 91 double mxt, double myt); 92 93 public abstract int getWindingRule(); 94 95 public abstract void setWindingRule(int rule); 96 97 public abstract P getPlatformPath(); 98 99 public abstract WCPathIterator getPathIterator(); 100 }