101 |
* Note: An ellipse cannot be represented exactly in PathIterator |
* Note: An ellipse cannot be represented exactly in PathIterator |
102 |
* segments, the outline is thefore approximated with cubic |
* segments, the outline is thefore approximated with cubic |
103 |
* Bezier segments. |
* Bezier segments. |
104 |
|
* |
105 |
|
* @param at an optional transform. |
106 |
|
* @return A path iterator. |
107 |
*/ |
*/ |
108 |
public PathIterator getPathIterator(AffineTransform at) |
public PathIterator getPathIterator(AffineTransform at) |
109 |
{ |
{ |
142 |
return false; |
return false; |
143 |
} |
} |
144 |
|
|
145 |
|
/** |
146 |
|
* An {@link Ellipse2D} that stores its coordinates using <code>double</code> |
147 |
|
* primitives. |
148 |
|
*/ |
149 |
public static class Double extends Ellipse2D |
public static class Double extends Ellipse2D |
150 |
{ |
{ |
151 |
/** |
/** |
169 |
public double y; |
public double y; |
170 |
|
|
171 |
/** |
/** |
172 |
* Creates a new Ellipse2D with an upper-right coordinate of (0,0) |
* Creates a new Ellipse2D with an upper-left coordinate of (0,0) |
173 |
* and a zero size. |
* and a zero size. |
174 |
*/ |
*/ |
175 |
public Double() |
public Double() |
179 |
/** |
/** |
180 |
* Creates a new Ellipse2D within a given rectangle |
* Creates a new Ellipse2D within a given rectangle |
181 |
* using double-precision coordinates.<P> |
* using double-precision coordinates.<P> |
182 |
* @param x - x coordinate of the upper-right of the bounding rectangle |
* @param x - x coordinate of the upper-left of the bounding rectangle |
183 |
* @param y - y coordinate of the upper-right of the bounding rectangle |
* @param y - y coordinate of the upper-left of the bounding rectangle |
184 |
* @param w - width of the ellipse |
* @param w - width of the ellipse |
185 |
* @param h - height of the ellipse |
* @param h - height of the ellipse |
|
* |
|
186 |
*/ |
*/ |
187 |
public Double(double x, double y, double w, double h) |
public Double(double x, double y, double w, double h) |
188 |
{ |
{ |
194 |
|
|
195 |
/** |
/** |
196 |
* Returns the bounding-box of the ellipse. |
* Returns the bounding-box of the ellipse. |
197 |
|
* @return The bounding box. |
198 |
*/ |
*/ |
199 |
public Rectangle2D getBounds2D() |
public Rectangle2D getBounds2D() |
200 |
{ |
{ |
203 |
|
|
204 |
/** |
/** |
205 |
* Returns the height of the ellipse. |
* Returns the height of the ellipse. |
206 |
|
* @return The height of the ellipse. |
207 |
*/ |
*/ |
208 |
public double getHeight() |
public double getHeight() |
209 |
{ |
{ |
212 |
|
|
213 |
/** |
/** |
214 |
* Returns the width of the ellipse. |
* Returns the width of the ellipse. |
215 |
|
* @return The width of the ellipse. |
216 |
*/ |
*/ |
217 |
public double getWidth() |
public double getWidth() |
218 |
{ |
{ |
222 |
/** |
/** |
223 |
* Returns x coordinate of the upper-left corner of |
* Returns x coordinate of the upper-left corner of |
224 |
* the ellipse's bounding-box. |
* the ellipse's bounding-box. |
225 |
|
* @return The x coordinate. |
226 |
*/ |
*/ |
227 |
public double getX() |
public double getX() |
228 |
{ |
{ |
232 |
/** |
/** |
233 |
* Returns y coordinate of the upper-left corner of |
* Returns y coordinate of the upper-left corner of |
234 |
* the ellipse's bounding-box. |
* the ellipse's bounding-box. |
235 |
|
* @return The y coordinate. |
236 |
*/ |
*/ |
237 |
public double getY() |
public double getY() |
238 |
{ |
{ |
240 |
} |
} |
241 |
|
|
242 |
/** |
/** |
243 |
* Returns true if the ellipse encloses any area. |
* Returns <code>true</code> if the ellipse encloses no area, and |
244 |
|
* <code>false</code> otherwise. |
245 |
|
* |
246 |
|
* @return A boolean. |
247 |
*/ |
*/ |
248 |
public boolean isEmpty() |
public boolean isEmpty() |
249 |
{ |
{ |
253 |
/** |
/** |
254 |
* Sets the geometry of the ellipse's bounding box.<P> |
* Sets the geometry of the ellipse's bounding box.<P> |
255 |
* |
* |
256 |
* @param x - x coordinate of the upper-right of the bounding rectangle |
* @param x - x coordinate of the upper-left of the bounding rectangle |
257 |
* @param y - y coordinate of the upper-right of the bounding rectangle |
* @param y - y coordinate of the upper-left of the bounding rectangle |
258 |
* @param w - width of the ellipse |
* @param w - width of the ellipse |
259 |
* @param h - height of the ellipse |
* @param h - height of the ellipse |
260 |
*/ |
*/ |
267 |
} |
} |
268 |
} // class Double |
} // class Double |
269 |
|
|
270 |
|
/** |
271 |
|
* An {@link Ellipse2D} that stores its coordinates using <code>float</code> |
272 |
|
* primitives. |
273 |
|
*/ |
274 |
public static class Float extends Ellipse2D |
public static class Float extends Ellipse2D |
275 |
{ |
{ |
276 |
/** |
/** |
294 |
public float y; |
public float y; |
295 |
|
|
296 |
/** |
/** |
297 |
* Creates a new Ellipse2D with an upper-right coordinate of (0,0) |
* Creates a new Ellipse2D with an upper-left coordinate of (0,0) |
298 |
* and a zero size. |
* and a zero size. |
299 |
*/ |
*/ |
300 |
public Float() |
public Float() |
304 |
/** |
/** |
305 |
* Creates a new Ellipse2D within a given rectangle |
* Creates a new Ellipse2D within a given rectangle |
306 |
* using floating-point precision.<P> |
* using floating-point precision.<P> |
307 |
* @param x - x coordinate of the upper-right of the bounding rectangle |
* @param x - x coordinate of the upper-left of the bounding rectangle |
308 |
* @param y - y coordinate of the upper-right of the bounding rectangle |
* @param y - y coordinate of the upper-left of the bounding rectangle |
309 |
* @param w - width of the ellipse |
* @param w - width of the ellipse |
310 |
* @param h - height of the ellipse |
* @param h - height of the ellipse |
311 |
* |
* |
320 |
|
|
321 |
/** |
/** |
322 |
* Returns the bounding-box of the ellipse. |
* Returns the bounding-box of the ellipse. |
323 |
|
* @return The bounding box. |
324 |
*/ |
*/ |
325 |
public Rectangle2D getBounds2D() |
public Rectangle2D getBounds2D() |
326 |
{ |
{ |
329 |
|
|
330 |
/** |
/** |
331 |
* Returns the height of the ellipse. |
* Returns the height of the ellipse. |
332 |
|
* @return The height of the ellipse. |
333 |
*/ |
*/ |
334 |
public double getHeight() |
public double getHeight() |
335 |
{ |
{ |
338 |
|
|
339 |
/** |
/** |
340 |
* Returns the width of the ellipse. |
* Returns the width of the ellipse. |
341 |
|
* @return The width of the ellipse. |
342 |
*/ |
*/ |
343 |
public double getWidth() |
public double getWidth() |
344 |
{ |
{ |
348 |
/** |
/** |
349 |
* Returns x coordinate of the upper-left corner of |
* Returns x coordinate of the upper-left corner of |
350 |
* the ellipse's bounding-box. |
* the ellipse's bounding-box. |
351 |
|
* @return The x coordinate. |
352 |
*/ |
*/ |
353 |
public double getX() |
public double getX() |
354 |
{ |
{ |
358 |
/** |
/** |
359 |
* Returns y coordinate of the upper-left corner of |
* Returns y coordinate of the upper-left corner of |
360 |
* the ellipse's bounding-box. |
* the ellipse's bounding-box. |
361 |
|
* @return The y coordinate. |
362 |
*/ |
*/ |
363 |
public double getY() |
public double getY() |
364 |
{ |
{ |
366 |
} |
} |
367 |
|
|
368 |
/** |
/** |
369 |
* Returns true if the ellipse encloses any area. |
* Returns <code>true</code> if the ellipse encloses no area, and |
370 |
|
* <code>false</code> otherwise. |
371 |
|
* |
372 |
|
* @return A boolean. |
373 |
*/ |
*/ |
374 |
public boolean isEmpty() |
public boolean isEmpty() |
375 |
{ |
{ |
379 |
/** |
/** |
380 |
* Sets the geometry of the ellipse's bounding box.<P> |
* Sets the geometry of the ellipse's bounding box.<P> |
381 |
* |
* |
382 |
* @param x - x coordinate of the upper-right of the bounding rectangle |
* @param x - x coordinate of the upper-left of the bounding rectangle |
383 |
* @param y - y coordinate of the upper-right of the bounding rectangle |
* @param y - y coordinate of the upper-left of the bounding rectangle |
384 |
* @param w - width of the ellipse |
* @param w - width of the ellipse |
385 |
* @param h - height of the ellipse |
* @param h - height of the ellipse |
386 |
*/ |
*/ |
397 |
* |
* |
398 |
* Note: This leads to a loss of precision.<P> |
* Note: This leads to a loss of precision.<P> |
399 |
* |
* |
400 |
* @param x - x coordinate of the upper-right of the bounding rectangle |
* @param x - x coordinate of the upper-left of the bounding rectangle |
401 |
* @param y - y coordinate of the upper-right of the bounding rectangle |
* @param y - y coordinate of the upper-left of the bounding rectangle |
402 |
* @param w - width of the ellipse |
* @param w - width of the ellipse |
403 |
* @param h - height of the ellipse |
* @param h - height of the ellipse |
404 |
*/ |
*/ |