KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > font > LayoutPath


1 /*
2  * @(#)LayoutPath.java 1.2 05/11/17
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 /*
8  * (C) Copyright IBM Corp. 2005, All Rights Reserved.
9  */

10 package java.awt.font;
11
12 import java.awt.geom.Point2D JavaDoc;
13
14 /**
15  * LayoutPath provides a mapping between locations relative to the
16  * baseline and points in user space. Locations consist of an advance
17  * along the baseline, and an offset perpendicular to the baseline at
18  * the advance. Positive values along the perpendicular are in the
19  * direction that is 90 degrees clockwise from the baseline vector.
20  * Locations are represented as a <code>Point2D</code>, where x is the advance and
21  * y is the offset.
22  *
23  * @since 1.6
24  */

25 public abstract class LayoutPath {
26     /**
27      * Convert a point in user space to a location relative to the
28      * path. The location is chosen so as to minimize the distance
29      * from the point to the path (e.g., the magnitude of the offset
30      * will be smallest). If there is more than one such location,
31      * the location with the smallest advance is chosen.
32      * @param point the point to convert. If it is not the same
33      * object as location, point will remain unmodified by this call.
34      * @param location a <code>Point2D</code> to hold the returned location.
35      * It can be the same object as point.
36      * @return true if the point is associated with the portion of the
37      * path preceding the location, false if it is associated with
38      * the portion following. The default, if the location is not at
39      * a break or sharp bend in the path, is to return true.
40      * @throws NullPointerException if point or location is null
41      * @since 1.6
42      */

43     public abstract boolean pointToPath(Point2D JavaDoc point, Point2D JavaDoc location);
44
45     /**
46      * Convert a location relative to the path to a point in user
47      * coordinates. The path might bend abruptly or be disjoint at
48      * the location's advance. If this is the case, the value of
49      * 'preceding' is used to disambiguate the portion of the path
50      * whose location and slope is to be used to interpret the offset.
51      * @param location a <code>Point2D</code> representing the advance (in x) and
52      * offset (in y) of a location relative to the path. If location
53      * is not the same object as point, location will remain
54      * unmodified by this call.
55      * @param preceding if true, the portion preceding the advance
56      * should be used, if false the portion after should be used.
57      * This has no effect if the path does not break or bend sharply
58      * at the advance.
59      * @param point a <code>Point2D</code> to hold the returned point. It can be
60      * the same object as location.
61      * @throws NullPointerException if location or point is null
62      * @since 1.6
63      */

64     public abstract void pathToPoint(Point2D JavaDoc location, boolean preceding,
65                                      Point2D JavaDoc point);
66 }
67
68
Popular Tags