67 return peer.isOpaque(); 68 } 69 70 /* 71 * All coordinates passed to the method should be based on the origin being in the bottom-left corner (standard 72 * Cocoa coordinates). 73 */ 74 public void setBounds(int x, int y, int width, int height) { 75 CWrapper.NSView.setFrame(ptr, x, y, width, height); 76 } 77 78 // REMIND: CGLSurfaceData expects top-level's size 79 public Rectangle getBounds() { 80 return peer.getBounds(); 81 } 82 83 public Object getDestination() { 84 return peer; 85 } 86 87 public void enterFullScreenMode(final long nsWindowPtr) { 88 CWrapper.NSView.enterFullScreenMode(ptr); 89 90 // REMIND: CGLSurfaceData expects top-level's size 91 // and therefore we need to account insets before 92 // recreating the surface data 93 Insets insets = peer.getInsets(); 94 95 Rectangle screenBounds; 96 final long screenPtr = CWrapper.NSWindow.screen(nsWindowPtr); 97 try { 98 screenBounds = CWrapper.NSScreen.frame(screenPtr).getBounds(); 99 } finally { 100 CWrapper.NSObject.release(screenPtr); 101 } 102 103 // the move/size notification from the underlying system comes 104 // but it contains a bounds smaller than the whole screen 105 // and therefore we need to create the synthetic notifications 106 peer.notifyReshape(screenBounds.x - insets.left, 107 screenBounds.y - insets.bottom, 108 screenBounds.width + insets.left + insets.right, 109 screenBounds.height + insets.top + insets.bottom); 110 } 111 112 public void exitFullScreenMode() { 113 CWrapper.NSView.exitFullScreenMode(ptr); 114 } 115 116 // ---------------------------------------------------------------------- 117 // PAINTING METHODS 118 // ---------------------------------------------------------------------- 119 120 public void drawImageOnPeer(VolatileImage xBackBuffer, int x1, int y1, int x2, int y2) { 121 Graphics g = peer.getGraphics(); 122 try { 123 g.drawImage(xBackBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); 124 } finally { 125 g.dispose(); 126 } 127 } 128 129 public Image createBackBuffer() { 130 Rectangle r = peer.getBounds(); 131 Image im = null; 132 if (!r.isEmpty()) { 133 int transparency = (isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT); 134 im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency); 135 } | 67 return peer.isOpaque(); 68 } 69 70 /* 71 * All coordinates passed to the method should be based on the origin being in the bottom-left corner (standard 72 * Cocoa coordinates). 73 */ 74 public void setBounds(int x, int y, int width, int height) { 75 CWrapper.NSView.setFrame(ptr, x, y, width, height); 76 } 77 78 // REMIND: CGLSurfaceData expects top-level's size 79 public Rectangle getBounds() { 80 return peer.getBounds(); 81 } 82 83 public Object getDestination() { 84 return peer; 85 } 86 87 // ---------------------------------------------------------------------- 88 // PAINTING METHODS 89 // ---------------------------------------------------------------------- 90 91 public void drawImageOnPeer(VolatileImage xBackBuffer, int x1, int y1, int x2, int y2) { 92 Graphics g = peer.getGraphics(); 93 try { 94 g.drawImage(xBackBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null); 95 } finally { 96 g.dispose(); 97 } 98 } 99 100 public Image createBackBuffer() { 101 Rectangle r = peer.getBounds(); 102 Image im = null; 103 if (!r.isEmpty()) { 104 int transparency = (isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT); 105 im = peer.getGraphicsConfiguration().createCompatibleImage(r.width, r.height, transparency); 106 } |