libjava/ChangeLog:
[official-gcc.git] / libjava / classpath / gnu / java / awt / font / opentype / truetype / Point.java
blob31c12037c27974d6fed5827cdd8c604acd306b26
1 /* Point.java -- Holds information for one point on a glyph outline
2 Copyright (C) 2006 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package gnu.java.awt.font.opentype.truetype;
41 import gnu.java.lang.CPStringBuilder;
43 /**
44 * Encapsulates information regarding one point on a glyph outline.
46 public class Point
48 public static final short FLAG_TOUCHED_X = 1;
49 public static final short FLAG_TOUCHED_Y = 2;
50 public static final short FLAG_ON_CURVE = 4;
51 public static final short FLAG_CONTOUR_END = 8;
52 public static final short FLAG_WEAK_INTERPOLATION = 16;
53 public static final short FLAG_INFLECTION = 32;
54 public static final short FLAG_DONE_X = 64;
55 public static final short FLAG_DONE_Y = 128;
57 /**
58 * Right direction.
60 public static final int DIR_RIGHT = 1;
62 /**
63 * Left direction.
65 public static final int DIR_LEFT = -1;
67 /**
68 * Up direction.
70 public static final int DIR_UP = 2;
72 /**
73 * Down direction.
75 public static final int DIR_DOWN = -2;
77 /**
78 * The original x coordinate in font units.
80 int origX;
82 /**
83 * The original y coordinate in font units.
85 int origY;
87 /**
88 * The x coordinate scaled to the target.
90 int scaledX;
92 /**
93 * The y coordinate scaled to the target.
95 int scaledY;
97 /**
98 * The final hinted and scaled x coordinate.
100 int x;
103 * The final hinted and scaled y coordinate.
105 int y;
107 int u;
108 int v;
111 * The glyph flags.
113 short flags;
116 * The previous point in the contour.
118 private Point prev;
121 * The next point in the contour.
123 private Point next;
126 * The in-direction of the point, according to the DIR_* constants of this
127 * class.
129 int inDir;
132 * The out-direction of the point, according to the DIR_* constants of this
133 * class.
135 int outDir;
137 public Point getNext()
139 return next;
142 public void setNext(Point next)
144 this.next = next;
147 public Point getPrev()
149 return prev;
152 public void setPrev(Point prev)
154 this.prev = prev;
157 public int getOrigX()
159 return origX;
162 public void setOrigX(int origX)
164 this.origX = origX;
167 public int getOrigY()
169 return origY;
172 public void setOrigY(int origY)
174 this.origY = origY;
177 public int getInDir()
179 return inDir;
182 public void setInDir(int inDir)
184 this.inDir = inDir;
187 public int getOutDir()
189 return outDir;
192 public void setOutDir(int outDir)
194 this.outDir = outDir;
197 public short getFlags()
199 return flags;
202 public void setFlags(short flags)
204 this.flags = flags;
207 public void addFlags(short flags)
209 this.flags |= flags;
212 public boolean isControlPoint()
214 return (flags & FLAG_ON_CURVE) == 0;
217 public int getU()
219 return u;
222 public void setU(int u)
224 this.u = u;
227 public int getV()
229 return v;
232 public void setV(int v)
234 this.v = v;
237 public String toString()
239 CPStringBuilder s = new CPStringBuilder();
240 s.append("[Point] origX: ");
241 s.append(origX);
242 s.append(", origY: ");
243 s.append(origY);
244 // TODO: Add more info when needed.
245 return s.toString();
248 public int getX()
250 return x;
253 public void setX(int x)
255 this.x = x;
258 public int getY()
260 return y;
263 public void setY(int y)
265 this.y = y;
268 public int getScaledX()
270 return scaledX;
273 public void setScaledX(int scaledX)
275 this.scaledX = scaledX;
278 public int getScaledY()
280 return scaledY;
283 public void setScaledY(int scaledY)
285 this.scaledY = scaledY;