1 /*
2 * Copyright (c) 2006, 2015, 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
829 // REMIND: Can we do both somehow?
830 if (this instanceof GeneralPath) {
831 return new GeneralPath(this);
832 } else {
833 return new Path2D.Float(this);
834 }
835 }
836
837 /*
838 * JDK 1.6 serialVersionUID
839 */
840 private static final long serialVersionUID = 6990832515060788886L;
841
842 /**
843 * Writes the default serializable fields to the
844 * {@code ObjectOutputStream} followed by an explicit
845 * serialization of the path segments stored in this
846 * path.
847 *
848 * @serialData
849 * <a name="Path2DSerialData"><!-- --></a>
850 * <ol>
851 * <li>The default serializable fields.
852 * There are no default serializable fields as of 1.6.
853 * <li>followed by
854 * a byte indicating the storage type of the original object
855 * as a hint (SERIAL_STORAGE_FLT_ARRAY)
856 * <li>followed by
857 * an integer indicating the number of path segments to follow (NP)
858 * or -1 to indicate an unknown number of path segments follows
859 * <li>followed by
860 * an integer indicating the total number of coordinates to follow (NC)
861 * or -1 to indicate an unknown number of coordinates follows
862 * (NC should always be even since coordinates always appear in pairs
863 * representing an x,y pair)
864 * <li>followed by
865 * a byte indicating the winding rule
866 * ({@link #WIND_EVEN_ODD WIND_EVEN_ODD} or
867 * {@link #WIND_NON_ZERO WIND_NON_ZERO})
868 * <li>followed by
869 * {@code NP} (or unlimited if {@code NP < 0}) sets of values consisting of
1588 // Note: It would be nice to have this return Path2D
1589 // but one of our subclasses (GeneralPath) needs to
1590 // offer "public Object clone()" for backwards
1591 // compatibility so we cannot restrict it further.
1592 // REMIND: Can we do both somehow?
1593 return new Path2D.Double(this);
1594 }
1595
1596 /*
1597 * JDK 1.6 serialVersionUID
1598 */
1599 private static final long serialVersionUID = 1826762518450014216L;
1600
1601 /**
1602 * Writes the default serializable fields to the
1603 * {@code ObjectOutputStream} followed by an explicit
1604 * serialization of the path segments stored in this
1605 * path.
1606 *
1607 * @serialData
1608 * <a name="Path2DSerialData"><!-- --></a>
1609 * <ol>
1610 * <li>The default serializable fields.
1611 * There are no default serializable fields as of 1.6.
1612 * <li>followed by
1613 * a byte indicating the storage type of the original object
1614 * as a hint (SERIAL_STORAGE_DBL_ARRAY)
1615 * <li>followed by
1616 * an integer indicating the number of path segments to follow (NP)
1617 * or -1 to indicate an unknown number of path segments follows
1618 * <li>followed by
1619 * an integer indicating the total number of coordinates to follow (NC)
1620 * or -1 to indicate an unknown number of coordinates follows
1621 * (NC should always be even since coordinates always appear in pairs
1622 * representing an x,y pair)
1623 * <li>followed by
1624 * a byte indicating the winding rule
1625 * ({@link #WIND_EVEN_ODD WIND_EVEN_ODD} or
1626 * {@link #WIND_NON_ZERO WIND_NON_ZERO})
1627 * <li>followed by
1628 * {@code NP} (or unlimited if {@code NP < 0}) sets of values consisting of
|
1 /*
2 * Copyright (c) 2006, 2017, 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
829 // REMIND: Can we do both somehow?
830 if (this instanceof GeneralPath) {
831 return new GeneralPath(this);
832 } else {
833 return new Path2D.Float(this);
834 }
835 }
836
837 /*
838 * JDK 1.6 serialVersionUID
839 */
840 private static final long serialVersionUID = 6990832515060788886L;
841
842 /**
843 * Writes the default serializable fields to the
844 * {@code ObjectOutputStream} followed by an explicit
845 * serialization of the path segments stored in this
846 * path.
847 *
848 * @serialData
849 * <a id="Path2DSerialData"><!-- --></a>
850 * <ol>
851 * <li>The default serializable fields.
852 * There are no default serializable fields as of 1.6.
853 * <li>followed by
854 * a byte indicating the storage type of the original object
855 * as a hint (SERIAL_STORAGE_FLT_ARRAY)
856 * <li>followed by
857 * an integer indicating the number of path segments to follow (NP)
858 * or -1 to indicate an unknown number of path segments follows
859 * <li>followed by
860 * an integer indicating the total number of coordinates to follow (NC)
861 * or -1 to indicate an unknown number of coordinates follows
862 * (NC should always be even since coordinates always appear in pairs
863 * representing an x,y pair)
864 * <li>followed by
865 * a byte indicating the winding rule
866 * ({@link #WIND_EVEN_ODD WIND_EVEN_ODD} or
867 * {@link #WIND_NON_ZERO WIND_NON_ZERO})
868 * <li>followed by
869 * {@code NP} (or unlimited if {@code NP < 0}) sets of values consisting of
1588 // Note: It would be nice to have this return Path2D
1589 // but one of our subclasses (GeneralPath) needs to
1590 // offer "public Object clone()" for backwards
1591 // compatibility so we cannot restrict it further.
1592 // REMIND: Can we do both somehow?
1593 return new Path2D.Double(this);
1594 }
1595
1596 /*
1597 * JDK 1.6 serialVersionUID
1598 */
1599 private static final long serialVersionUID = 1826762518450014216L;
1600
1601 /**
1602 * Writes the default serializable fields to the
1603 * {@code ObjectOutputStream} followed by an explicit
1604 * serialization of the path segments stored in this
1605 * path.
1606 *
1607 * @serialData
1608 * <a id="Path2DSerialData"><!-- --></a>
1609 * <ol>
1610 * <li>The default serializable fields.
1611 * There are no default serializable fields as of 1.6.
1612 * <li>followed by
1613 * a byte indicating the storage type of the original object
1614 * as a hint (SERIAL_STORAGE_DBL_ARRAY)
1615 * <li>followed by
1616 * an integer indicating the number of path segments to follow (NP)
1617 * or -1 to indicate an unknown number of path segments follows
1618 * <li>followed by
1619 * an integer indicating the total number of coordinates to follow (NC)
1620 * or -1 to indicate an unknown number of coordinates follows
1621 * (NC should always be even since coordinates always appear in pairs
1622 * representing an x,y pair)
1623 * <li>followed by
1624 * a byte indicating the winding rule
1625 * ({@link #WIND_EVEN_ODD WIND_EVEN_ODD} or
1626 * {@link #WIND_NON_ZERO WIND_NON_ZERO})
1627 * <li>followed by
1628 * {@code NP} (or unlimited if {@code NP < 0}) sets of values consisting of
|