01: /*
02: *
03: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
04: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License version
08: * 2 only, as published by the Free Software Foundation.
09: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * General Public License version 2 for more details (a copy is
14: * included at /legal/license.txt).
15: *
16: * You should have received a copy of the GNU General Public License
17: * version 2 along with this work; if not, write to the Free Software
18: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19: * 02110-1301 USA
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
22: * Clara, CA 95054 or visit www.sun.com if you need additional
23: * information or have any questions.
24: */
25:
26: package com.sun.pisces;
27:
28: /**
29: * The <code>LineSink</code> interface extends the
30: * <code>PathSink</code> interface, and additionally accepts curve
31: * drawing commands: <code>quadTo</code> and <code>curveTo</code>.
32: */
33: public abstract class PathSink extends LineSink {
34:
35: /**
36: * Draws a quadratic Bezier curve starting at the current drawing
37: * position and ending at the point <code>(x2, y2)</code>
38: * according to the formulas:
39: *
40: * <pre>
41: * x(t) = (1 - t)^2*x0 + 2*(1 - t)*t*x1 + t^2*x2
42: * y(t) = (1 - t)^2*y0 + 2*(1 - t)*t*y1 + t^2*x2
43: *
44: * 0 <= t <= 1
45: * </pre>
46: *
47: * where <code>(x0, y0)</code> is the current drawing position.
48: * Finally, the current drawing position is set to <code>(x2,
49: * y2)</code>.
50: *
51: * @param x1 the X coordinate of the control point in S15.16 format
52: * @param y1 the Y coordinate of the control point in S15.16 format
53: * @param x2 the final X coordinate in S15.16 format
54: * @param y2 the final Y coordinate in S15.16 format
55: */
56: public abstract void quadTo(int x1, int y1, int x2, int y2);
57:
58: /**
59: * Draws a cubic Bezier curve starting at the current drawing
60: * position and ending at the point <code>(x3, y3)</code>
61: * according to the formulas:
62: *
63: * <pre>
64: * x(t) = (1 - t)^3*x0 + 3*(1 - t)^2*t*x1 + 3*(1 - t)*t^2*x2 + t^3*x3
65: * y(t) = (1 - t)^3*y0 + 3*(1 - t)^2*t*y1 + 3*(1 - t)*t^2*y2 + t^3*x3
66: *
67: * 0 <= t <= 1
68: * </pre>
69: *
70: * where <code>(x0, y0)</code> is the current drawing position.
71: * Finally, the current drawing position is set to <code>(x3,
72: * y3)</code>.
73: *
74: * @param x1 the X coordinate of the first control point in S15.16 format
75: * @param y1 the Y coordinate of the first control point in S15.16 format
76: * @param x2 the X coordinate of the second control point in S15.16 format
77: * @param y2 the Y coordinate of the second control point in S15.16 format
78: * @param x3 the final X coordinate in S15.16 format
79: * @param y3 the final Y coordinate in S15.16 format
80: */
81: public abstract void cubicTo(int x1, int y1, int x2, int y2,
82: int x3, int y3);
83: }
|