Showing the changes to java/pkg/java/awt/font/LayoutPath.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,84 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2005, 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 | * (C) Copyright IBM Corp. 2005, All Rights Reserved. | ||
| 27 | */ | ||
| 28 | package java.awt.font; | ||
| 29 | |||
| 30 | import java.awt.geom.Point2D; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * LayoutPath provides a mapping between locations relative to the | ||
| 34 | * baseline and points in user space. Locations consist of an advance | ||
| 35 | * along the baseline, and an offset perpendicular to the baseline at | ||
| 36 | * the advance. Positive values along the perpendicular are in the | ||
| 37 | * direction that is 90 degrees clockwise from the baseline vector. | ||
| 38 | * Locations are represented as a <code>Point2D</code>, where x is the advance and | ||
| 39 | * y is the offset. | ||
| 40 | * | ||
| 41 | * @since 1.6 | ||
| 42 | */ | ||
| 43 | public abstract class LayoutPath { | ||
| 44 | /** | ||
| 45 | * Convert a point in user space to a location relative to the | ||
| 46 | * path. The location is chosen so as to minimize the distance | ||
| 47 | * from the point to the path (e.g., the magnitude of the offset | ||
| 48 | * will be smallest). If there is more than one such location, | ||
| 49 | * the location with the smallest advance is chosen. | ||
| 50 | * @param point the point to convert. If it is not the same | ||
| 51 | * object as location, point will remain unmodified by this call. | ||
| 52 | * @param location a <code>Point2D</code> to hold the returned location. | ||
| 53 | * It can be the same object as point. | ||
| 54 | * @return true if the point is associated with the portion of the | ||
| 55 | * path preceding the location, false if it is associated with | ||
| 56 | * the portion following. The default, if the location is not at | ||
| 57 | * a break or sharp bend in the path, is to return true. | ||
| 58 | * @throws NullPointerException if point or location is null | ||
| 59 | * @since 1.6 | ||
| 60 | */ | ||
| 61 | public abstract boolean pointToPath(Point2D point, Point2D location); | ||
| 62 | |||
| 63 | /** | ||
| 64 | * Convert a location relative to the path to a point in user | ||
| 65 | * coordinates. The path might bend abruptly or be disjoint at | ||
| 66 | * the location's advance. If this is the case, the value of | ||
| 67 | * 'preceding' is used to disambiguate the portion of the path | ||
| 68 | * whose location and slope is to be used to interpret the offset. | ||
| 69 | * @param location a <code>Point2D</code> representing the advance (in x) and | ||
| 70 | * offset (in y) of a location relative to the path. If location | ||
| 71 | * is not the same object as point, location will remain | ||
| 72 | * unmodified by this call. | ||
| 73 | * @param preceding if true, the portion preceding the advance | ||
| 74 | * should be used, if false the portion after should be used. | ||
| 75 | * This has no effect if the path does not break or bend sharply | ||
| 76 | * at the advance. | ||
| 77 | * @param point a <code>Point2D</code> to hold the returned point. It can be | ||
| 78 | * the same object as location. | ||
| 79 | * @throws NullPointerException if location or point is null | ||
| 80 | * @since 1.6 | ||
| 81 | */ | ||
| 82 | public abstract void pathToPoint(Point2D location, boolean preceding, | ||
| 83 | Point2D point); | ||
| 84 | } | ||