History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/sun/java2d/loops/DrawLine.java (1 of 18352 files). Show all

Unified · Split

java/pkg/sun/java2d/loops/DrawLine.java+114−0
@@ -0,0 +1,114 @@
1/*
2 * Copyright (c) 1997, 2002, 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
30package sun.java2d.loops;
31
32import sun.java2d.loops.GraphicsPrimitive;
33import java.awt.Color;
34import java.awt.image.ColorModel;
35import java.awt.image.Raster;
36import sun.java2d.SunGraphics2D;
37import sun.java2d.SurfaceData;
38
39/**
40 * DrawLine
41 * 1) draw solid color single width line onto destination surface
42 * 2) must accept output area [x, y, dx, dy]
43 * from within the surface description data for clip rect
44 */
45public class DrawLine extends GraphicsPrimitive
46{
47 public final static String methodSignature = "DrawLine(...)".toString();
48
49 public final static int primTypeID = makePrimTypeID();
50
51 public static DrawLine locate(SurfaceType srctype,
52 CompositeType comptype,
53 SurfaceType dsttype)
54 {
55 return (DrawLine) GraphicsPrimitiveMgr.locate(primTypeID,
56 srctype, comptype, dsttype);
57 }
58
59 protected DrawLine(SurfaceType srctype,
60 CompositeType comptype,
61 SurfaceType dsttype)
62 {
63 super(methodSignature, primTypeID, srctype, comptype, dsttype);
64 }
65
66 public DrawLine(long pNativePrim,
67 SurfaceType srctype,
68 CompositeType comptype,
69 SurfaceType dsttype)
70 {
71 super(pNativePrim, methodSignature, primTypeID, srctype, comptype, dsttype);
72 }
73
74 /**
75 * All DrawLine implementors must have this invoker method
76 */
77 public native void DrawLine(SunGraphics2D sg2d, SurfaceData dest,
78 int x1, int y1, int x2, int y2);
79
80 public GraphicsPrimitive makePrimitive(SurfaceType srctype,
81 CompositeType comptype,
82 SurfaceType dsttype)
83 {
84 // REMIND: use FillSpans or converter object?
85 throw new InternalError("DrawLine not implemented for "+
86 srctype+" with "+comptype);
87 }
88
89 public GraphicsPrimitive traceWrap() {
90 return new TraceDrawLine(this);
91 }
92
93 private static class TraceDrawLine extends DrawLine {
94 DrawLine target;
95
96 public TraceDrawLine(DrawLine target) {
97 super(target.getSourceType(),
98 target.getCompositeType(),
99 target.getDestType());
100 this.target = target;
101 }
102
103 public GraphicsPrimitive traceWrap() {
104 return this;
105 }
106
107 public void DrawLine(SunGraphics2D sg2d, SurfaceData dest,
108 int x1, int y1, int x2, int y2)
109 {
110 tracePrimitive(target);
111 target.DrawLine(sg2d, dest, x1, y1, x2, y2);
112 }
113 }
114}