1 /*
2  * Copyright (c) 2008, 2012, 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 package sun.java2d.pipe;
27 
28 import sun.java2d.SunGraphics2D;
29 
30 /**
31  * This interface defines the set of calls that pipeline objects
32  * can use to pass on responsibility for drawing arbitrary
33  * parallelogram shapes.
34  * Six floating point numbers are provided and the parallelogram
35  * is defined as the quadrilateral with the following vertices:
36  * <pre>
37  *     origin: (x, y)
38  *          => (x+dx1, y+dy1)
39  *          => (x+dx1+dx2, y+dy1+dy2)
40  *          => (x+dx2, y+dy2)
41  *          => origin
42  * </pre>
43  * The four u[xy][12] parameters are the unsorted extreme coordinates
44  * of the primitive in user space.  They may have been generated by a
45  * line or a rectangle so they could have u[xy]2 < u[xy]1 in some cases.
46  * They should be sorted before calculating the bounds of the original
47  * primitive (such as for calculating the user space bounds for the
48  * Paint.createContext() method).
49  */
50 public interface ParallelogramPipe {
fillParallelogram(SunGraphics2D sg, double ux1, double uy1, double ux2, double uy2, double x, double y, double dx1, double dy1, double dx2, double dy2)51     public void fillParallelogram(SunGraphics2D sg,
52                                   double ux1, double uy1,
53                                   double ux2, double uy2,
54                                   double x, double y,
55                                   double dx1, double dy1,
56                                   double dx2, double dy2);
57 
58     /**
59      * Draw a Parallelogram with the indicated line widths
60      * assuming a standard BasicStroke with MITER joins.
61      * lw1 specifies the width of the stroke along the dx1,dy1
62      * vector and lw2 specifies the width of the stroke along
63      * the dx2,dy2 vector.
64      * This is equivalent to outsetting the indicated
65      * parallelogram by lw/2 pixels, then insetting the
66      * same parallelogram by lw/2 pixels and filling the
67      * difference between the outer and inner parallelograms.
68      */
drawParallelogram(SunGraphics2D sg, double ux1, double uy1, double ux2, double uy2, double x, double y, double dx1, double dy1, double dx2, double dy2, double lw1, double lw2)69     public void drawParallelogram(SunGraphics2D sg,
70                                   double ux1, double uy1,
71                                   double ux2, double uy2,
72                                   double x, double y,
73                                   double dx1, double dy1,
74                                   double dx2, double dy2,
75                                   double lw1, double lw2);
76 }
77