/[classpath]/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
ViewVC logotype

Diff of /classpath/gnu/java/awt/peer/gtk/GdkGraphics.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.31 by mkoch, Fri Oct 8 21:41:41 2004 UTC revision 1.32 by mkoch, Fri Oct 8 22:16:09 2004 UTC
# Line 90  public class GdkGraphics extends Graphic Line 90  public class GdkGraphics extends Graphic
90    GdkGraphics (GtkComponentPeer component)    GdkGraphics (GtkComponentPeer component)
91    {    {
92      this.component = component;      this.component = component;
93        font = component.awtComponent.getFont ();
94    
95        if (component.isRealized ())
96          initComponentGraphics ();
97        else
98          connectSignals (component);
99      }
100    
101      void initComponentGraphics ()
102      {
103      initState (component);      initState (component);
104      color = component.awtComponent.getForeground ();      color = component.awtComponent.getForeground ();
     font = component.awtComponent.getFont ();  
105      Dimension d = component.awtComponent.getSize ();      Dimension d = component.awtComponent.getSize ();
106      clip = new Rectangle (0, 0, d.width, d.height);      clip = new Rectangle (0, 0, d.width, d.height);
107    }    }
108    
109      native void connectSignals (GtkComponentPeer component);
110    
111    public native void clearRect (int x, int y, int width, int height);    public native void clearRect (int x, int y, int width, int height);
112    
113    public void clipRect (int x, int y, int width, int height)    public void clipRect (int x, int y, int width, int height)
114    {    {
115        if (component != null && ! component.isRealized ())
116          return;
117    
118      clip = clip.intersection (new Rectangle (x, y, width, height));      clip = clip.intersection (new Rectangle (x, y, width, height));
119      setClipRectangle (clip.x, clip.y, clip.width, clip.height);      setClipRectangle (clip.x, clip.y, clip.width, clip.height);
120    }    }
# Line 133  public class GdkGraphics extends Graphic Line 147  public class GdkGraphics extends Graphic
147    public boolean drawImage (Image img, int x, int y,    public boolean drawImage (Image img, int x, int y,
148                              Color bgcolor, ImageObserver observer)                              Color bgcolor, ImageObserver observer)
149    {    {
150        if (component != null && ! component.isRealized ())
151          return false;
152    
153      if (img instanceof GtkOffScreenImage)      if (img instanceof GtkOffScreenImage)
154        {        {
155          copyPixmap (img.getGraphics (),          copyPixmap (img.getGraphics (),
# Line 147  public class GdkGraphics extends Graphic Line 164  public class GdkGraphics extends Graphic
164    
165    public boolean drawImage (Image img, int x, int y, ImageObserver observer)    public boolean drawImage (Image img, int x, int y, ImageObserver observer)
166    {    {
167        if (component != null && ! component.isRealized ())
168          return false;
169    
170      if (img instanceof GtkOffScreenImage)      if (img instanceof GtkOffScreenImage)
171        {        {
172          copyPixmap (img.getGraphics (),          copyPixmap (img.getGraphics (),
# Line 163  public class GdkGraphics extends Graphic Line 183  public class GdkGraphics extends Graphic
183    public boolean drawImage (Image img, int x, int y, int width, int height,    public boolean drawImage (Image img, int x, int y, int width, int height,
184                              Color bgcolor, ImageObserver observer)                              Color bgcolor, ImageObserver observer)
185    {    {
186        if (component != null && ! component.isRealized ())
187          return false;
188    
189      if (img instanceof GtkOffScreenImage)      if (img instanceof GtkOffScreenImage)
190        {        {
191          copyAndScalePixmap (img.getGraphics (), false, false,          copyAndScalePixmap (img.getGraphics (), false, false,
# Line 179  public class GdkGraphics extends Graphic Line 202  public class GdkGraphics extends Graphic
202    public boolean drawImage (Image img, int x, int y, int width, int height,    public boolean drawImage (Image img, int x, int y, int width, int height,
203                              ImageObserver observer)                              ImageObserver observer)
204    {    {
205        if (component != null && ! component.isRealized ())
206          return false;
207    
208      if (component != null)      if (component != null)
209        return drawImage (img, x, y, width, height, component.getBackground (),        return drawImage (img, x, y, width, height, component.getBackground (),
210                          observer);                          observer);
# Line 191  public class GdkGraphics extends Graphic Line 217  public class GdkGraphics extends Graphic
217                              int sx1, int sy1, int sx2, int sy2,                              int sx1, int sy1, int sx2, int sy2,
218                              Color bgcolor, ImageObserver observer)                              Color bgcolor, ImageObserver observer)
219    {    {
220        if (component != null && ! component.isRealized ())
221          return false;
222    
223      if (img instanceof GtkOffScreenImage)      if (img instanceof GtkOffScreenImage)
224        {        {
225          int dx_start, dy_start, d_width, d_height;          int dx_start, dy_start, d_width, d_height;
# Line 259  public class GdkGraphics extends Graphic Line 288  public class GdkGraphics extends Graphic
288                              int sx1, int sy1, int sx2, int sy2,                              int sx1, int sy1, int sx2, int sy2,
289                              ImageObserver observer)                              ImageObserver observer)
290    {    {
291        if (component != null && ! component.isRealized ())
292          return false;
293    
294      if (component != null)      if (component != null)
295        return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2,        return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2,
296                          component.getBackground (), observer);                          component.getBackground (), observer);
# Line 377  public class GdkGraphics extends Graphic Line 409  public class GdkGraphics extends Graphic
409    
410    public void setClip (int x, int y, int width, int height)    public void setClip (int x, int y, int width, int height)
411    {    {
412        if (component != null && ! component.isRealized ())
413          return;
414    
415      clip.x = x;      clip.x = x;
416      clip.y = y;      clip.y = y;
417      clip.width = width;      clip.width = width;
# Line 441  public class GdkGraphics extends Graphic Line 476  public class GdkGraphics extends Graphic
476    
477    public void translate (int x, int y)    public void translate (int x, int y)
478    {    {
479        if (component != null && ! component.isRealized ())
480          return;
481    
482      clip.x -= x;      clip.x -= x;
483      clip.y -= y;      clip.y -= y;
484    

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26