diff options
author | Sven Gothel <[email protected]> | 2000-11-18 06:43:49 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2000-11-18 06:43:49 +0000 |
commit | 880653d31a8f1ff8384fdbc75b84934bceecfdb8 (patch) | |
tree | bdafb71416f176d2a4b73bf716c9dc3f13685a8b /gl4java/jau/awt/windows |
Initial revision
Diffstat (limited to 'gl4java/jau/awt/windows')
-rw-r--r-- | gl4java/jau/awt/windows/MSWin32HandleAccess.java | 60 | ||||
-rw-r--r-- | gl4java/jau/awt/windows/Win32HandleAccess.java | 84 |
2 files changed, 144 insertions, 0 deletions
diff --git a/gl4java/jau/awt/windows/MSWin32HandleAccess.java b/gl4java/jau/awt/windows/MSWin32HandleAccess.java new file mode 100644 index 0000000..1dd4d93 --- /dev/null +++ b/gl4java/jau/awt/windows/MSWin32HandleAccess.java @@ -0,0 +1,60 @@ +/*
+ * @(#) MSWin32HandleAccess.java
+ */
+
+package gl4java.jau.awt.windows;
+
+import java.awt.Component;
+import com.ms.awt.GraphicsX;
+
+/**
+ * The ms-windows implementation for accessing the native window handle
+ *
+ * This class has no user servicable parts inside. It is
+ * used internally by GLFrame and by our package spoofed
+ * sun.awt classes that give us internal access to window
+ * variables that we need to set up the OpenGL drawing
+ * ontext
+ *
+ * @see WinHandleAccess
+ * @version 0.1, 3. JULY 1999
+ * @author Ron Cemer
+ *
+ */
+public class MSWin32HandleAccess
+ implements gl4java.jau.awt.WinHandleAccess
+{
+ protected int window, depth;
+
+ /**
+ * @dll.import("USER32",auto)
+ */
+ private static native int WindowFromDC(int hdc);
+
+ protected void achieveData(java.awt.Component c, java.awt.Graphics g)
+ {
+ window = WindowFromDC(((GraphicsX)g).gdc.pGetDC());
+ depth = c.getColorModel().getPixelSize();
+ }
+
+ /**
+ *
+ * get the window handle
+ */
+ public int getWinHandle(java.awt.Component c, java.awt.Graphics g)
+ {
+ achieveData(c, g);
+ return window;
+ }
+
+ /**
+ *
+ * get the color depth
+ */
+ public int getWinDepth(java.awt.Component c, java.awt.Graphics g)
+ {
+ achieveData(c, g);
+ return depth;
+ }
+}
+
diff --git a/gl4java/jau/awt/windows/Win32HandleAccess.java b/gl4java/jau/awt/windows/Win32HandleAccess.java new file mode 100644 index 0000000..38b5c93 --- /dev/null +++ b/gl4java/jau/awt/windows/Win32HandleAccess.java @@ -0,0 +1,84 @@ +/*
+ * @(#) Win32HandleAccess.java
+ */
+
+package gl4java.jau.awt.windows;
+
+import sun.awt.DrawingSurface;
+import sun.awt.Win32DrawingSurface;
+import sun.awt.DrawingSurfaceInfo;
+
+/**
+ * The ms-windows implementation for accessing the native window handle
+ *
+ * This class has no user servicable parts inside. It is
+ * used internally by GLFrame and by our package spoofed
+ * sun.awt classes that give us internal access to window
+ * variables that we need to set up the OpenGL drawing
+ * ontext
+ *
+ * @see WinHandleAccess
+ * @version 0.1, 7. JULY 1998
+ * @author Sven Goethel
+ *
+ */
+public class Win32HandleAccess
+ implements gl4java.jau.awt.WinHandleAccess
+{
+
+ protected DrawingSurfaceInfo dsi;
+ protected Win32DrawingSurface wds;
+ protected int window, depth;
+
+ protected void achieveData(java.awt.Component c, java.awt.Graphics g)
+ {
+ /* outta java3d */
+ dsi=null;
+ wds=null;
+ window=0; depth=0;
+
+ dsi = ((DrawingSurface)(c.getPeer())).getDrawingSurfaceInfo();
+ if(dsi!=null)
+ {
+ dsi.lock();
+ wds = (Win32DrawingSurface)dsi.getSurface();
+ dsi.unlock();
+ }
+ if(wds!=null)
+ {
+ dsi.lock();
+ window = wds.getHDC();
+ depth = wds.getDepth();
+ /*
+ System.out.println("wds ="+wds);
+ System.out.println("wds.Depth ="+wds.getDepth());
+ System.out.println("wds.HDC ="+wds.getHDC());
+ System.out.println("wds.HWnd ="+wds.getHWnd());
+ */
+ dsi.unlock();
+ }
+ if(wds==null)
+ System.out.println("Win32HandleAccess.getWinHandle failed, because the given Component is NOT a Window-Component\n");
+ }
+
+/**
+ *
+ * gets some structure for windows, and drawable on Win32
+ */
+ public int getWinHandle(java.awt.Component c, java.awt.Graphics g)
+ {
+ achieveData(c, g);
+ return window;
+ }
+
+/**
+ *
+ * gets some structure for windows, and drawable on Win32
+ */
+ public int getWinDepth(java.awt.Component c, java.awt.Graphics g)
+ {
+ achieveData(c, g);
+ return depth;
+ }
+}
+
|