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/awt/iDrawingSurfaceInfo.java (1 of 18352 files). Show all

Unified · Split

java/pkg/awt/iDrawingSurfaceInfo.java+117−0
@@ -0,0 +1,117 @@
1/*
2 *
3 * Adapted from MDrawingSurfaceInfo.java version - 1.3 96/12/20
4 *
5 */
6
7package inferno.awt;
8
9import sun.awt.DrawingSurfaceInfo;
10import sun.awt.PhysicalDrawingSurface;
11import sun.awt.image.ImageRepresentation;
12import java.awt.Rectangle;
13import java.awt.Shape;
14import java.awt.image.ColorModel;
15import java.awt.peer.ComponentPeer; // eventually inferno.awt.iComponentPeer ??
16
17/**
18 * The iDrawingSurfaceInfo object provides direct access for rendering
19 * on Components maintained by the Inferno iToolkit.
20 *
21 */
22
23public class iDrawingSurfaceInfo
24 implements DrawingSurfaceInfo, PhysicalDrawingSurface /* , iDrawingSurface */
25{
26 int state;
27 int w, h;
28 ComponentPeer peer = null; // eventually an iComponentPeer
29 ImageRepresentation imgrep;
30
31 /**
32 * Construct a new iDrawingSurfaceInfo for the specified peer.
33 */
34 /* To date Inferno doesn't need this constructor from
35 MDrawingSurfaceInfo if it does, we'll need an
36 inferno.awt.iComponentPeer
37 iDrawingSurfaceInfo(iComponentPeer peer) {
38 this.peer = peer;
39 }
40 */
41
42 /**
43 * Construct a new iDrawingSurfaceInfo for the specified offscreen image.
44 */
45 iDrawingSurfaceInfo(ImageRepresentation imgrep) {
46 this.imgrep = imgrep;
47 }
48
49 // implementation of lock from sun.awt.DrawingSurfaceInfo interface
50 public native int lock();
51
52 // implementation of unlock from sun.awt.DrawingSurfaceInfo interface
53 public native void unlock();
54
55 // implementation of getBounds from sun.awt.DrawingSurfaceInfo interface
56 public Rectangle getBounds() {
57 Rectangle r;
58 // comment out to keep compiler happy, eventually may
59 // need this code ? - jfs
60 /*
61 if (peer != null) {
62 r = peer.target.getBounds();
63 r.setLocation(0, 0);
64 } else {
65 r = new Rectangle(0, 0, imgrep.width, imgrep.height);
66 }
67 return r;
68 */
69 return (r = new Rectangle(0, 0, imgrep.width, imgrep.height));
70 }
71
72 // implementation of getSurface from sun.awt.DrawingSurfaceInfo interface
73 public PhysicalDrawingSurface getSurface() {
74 return this;
75 }
76
77 // implementation of getClip from sun.awt.DrawingSurfaceInfo interface
78 public Shape getClip() {
79 return getBounds();
80 }
81
82 public ColorModel getColorModel() {
83 return iToolkit.getStaticColorModel();
84 }
85
86 /**
87 * Returns a an Object pointer to the rendered $Draw->Image
88 * represented by this object.
89 */
90 final native Object getDrawable();
91
92 /**
93 * Return the depth (log2 of pixel width) of the
94 * $Draw->Image represented by this object.
95 */
96 final native int getDepth();
97
98 /*
99 for future reference:
100 X11DrawingSurfaceInfo implements X11DrawingSurface:
101 public native int getDisplay();
102 public native int getDrawable();
103 public native int getDepth();
104 public native int getVisualID();
105 public native int getColormapID();
106 public ColorModel getColorModel();
107
108 and WDrawingSurfaceInfo implements WDrawingSurface:
109 public native int getHWnd();
110 public native int getHBitmap();
111 public native int getPBits();
112 public native int getHDC();
113 public native int getDepth();
114 public native int getHPalette();
115
116 */
117}