Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/sun/java2d/loops/DrawLine.java
41159 views
1
/*
2
* Copyright (c) 1997, 2021, 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
/*
27
* @author Charlton Innovations, Inc.
28
*/
29
30
package sun.java2d.loops;
31
32
import sun.java2d.SunGraphics2D;
33
import sun.java2d.SurfaceData;
34
35
/**
36
* DrawLine
37
* 1) draw solid color single width line onto destination surface
38
* 2) must accept output area [x, y, dx, dy]
39
* from within the surface description data for clip rect
40
*/
41
public class DrawLine extends GraphicsPrimitive
42
{
43
public static final String methodSignature = "DrawLine(...)".toString();
44
45
public static final int primTypeID = makePrimTypeID();
46
47
public static DrawLine locate(SurfaceType srctype,
48
CompositeType comptype,
49
SurfaceType dsttype)
50
{
51
return (DrawLine) GraphicsPrimitiveMgr.locate(primTypeID,
52
srctype, comptype, dsttype);
53
}
54
55
protected DrawLine(SurfaceType srctype,
56
CompositeType comptype,
57
SurfaceType dsttype)
58
{
59
super(methodSignature, primTypeID, srctype, comptype, dsttype);
60
}
61
62
public DrawLine(long pNativePrim,
63
SurfaceType srctype,
64
CompositeType comptype,
65
SurfaceType dsttype)
66
{
67
super(pNativePrim, methodSignature, primTypeID, srctype, comptype, dsttype);
68
}
69
70
/**
71
* All DrawLine implementors must have this invoker method
72
*/
73
public native void DrawLine(SunGraphics2D sg2d, SurfaceData dest,
74
int x1, int y1, int x2, int y2);
75
76
public GraphicsPrimitive traceWrap() {
77
return new TraceDrawLine(this);
78
}
79
80
private static class TraceDrawLine extends DrawLine {
81
DrawLine target;
82
83
public TraceDrawLine(DrawLine target) {
84
super(target.getSourceType(),
85
target.getCompositeType(),
86
target.getDestType());
87
this.target = target;
88
}
89
90
public GraphicsPrimitive traceWrap() {
91
return this;
92
}
93
94
public void DrawLine(SunGraphics2D sg2d, SurfaceData dest,
95
int x1, int y1, int x2, int y2)
96
{
97
tracePrimitive(target);
98
target.DrawLine(sg2d, dest, x1, y1, x2, y2);
99
}
100
}
101
}
102
103