1 /* QtImageDirectGraphics.java --
2    Copyright (C)  2005, 2006  Free Software Foundation, Inc.
3 
4 This file is part of GNU Classpath.
5 
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20 
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25 
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version. */
37 
38 package gnu.java.awt.peer.qt;
39 
40 import java.awt.Color;
41 import java.awt.Image;
42 import java.awt.Shape;
43 import java.awt.geom.AffineTransform;
44 import java.awt.image.ImageObserver;
45 
46 /**
47  * A QtImagePainter that does an update after every drawing op.
48  */
49 public class QtImageDirectGraphics extends QtImageGraphics
50 {
51   private QtComponentPeer peer;
52   private boolean modified;
53 
QtImageDirectGraphics(QtImage image, QtComponentPeer peer)54   public QtImageDirectGraphics(QtImage image, QtComponentPeer peer)
55   {
56     super( image );
57     this.peer = peer;
58     modified = false;
59   }
60 
QtImageDirectGraphics(QtImageGraphics g)61   public QtImageDirectGraphics(QtImageGraphics g)
62   {
63     super( g );
64   }
65 
scheduleUpdate()66   private void scheduleUpdate()
67   {
68   }
69 
dispose()70   public void dispose()
71   {
72     super.dispose();
73     peer.toolkit.sync();
74     peer.QtUpdate();
75   }
76 
draw(Shape s)77   public void draw(Shape s)
78   {
79     super.draw(s);
80     scheduleUpdate();
81   }
82 
fill(Shape s)83   public void fill(Shape s)
84   {
85     super.fill(s);
86     scheduleUpdate();
87   }
88 
drawString(String string, int x, int y)89   public void drawString(String string, int x, int y)
90   {
91     super.drawString( string, x, y );
92     scheduleUpdate();
93   }
94 
drawString(String string, float x, float y)95   public void drawString(String string, float x, float y)
96   {
97     super.drawString( string, x, y );
98     scheduleUpdate();
99   }
100 
drawLine(int x1, int y1, int x2, int y2)101   public void drawLine(int x1, int y1, int x2, int y2)
102   {
103     super.drawLine(x1, y1, x2, y2);
104     scheduleUpdate();
105   }
106 
drawImage(Image image, AffineTransform Tx, ImageObserver obs)107   public boolean drawImage(Image image,
108                            AffineTransform Tx,
109                            ImageObserver obs)
110   {
111     boolean r = super.drawImage(image, Tx, obs);
112     scheduleUpdate();
113     return r;
114   }
115 
drawImage(Image image, int x, int y, Color bgcolor, ImageObserver observer)116   public boolean drawImage(Image image, int x, int y, Color bgcolor,
117                            ImageObserver observer)
118   {
119     boolean r = super.drawImage(image, x, y, bgcolor, observer);
120     scheduleUpdate();
121     return r;
122   }
123 
drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)124   public boolean drawImage(Image image,
125                            int dx1, int dy1, int dx2, int dy2,
126                            int sx1, int sy1, int sx2, int sy2,
127                            Color bgcolor, ImageObserver observer)
128   {
129     boolean r = super.drawImage( image, dx1,  dy1,  dx2,  dy2,
130                                  sx1,  sy1,  sx2,  sy2,
131                                  bgcolor, observer);
132     scheduleUpdate();
133     return r;
134   }
135 
drawImage(Image image, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)136   public boolean drawImage(Image image, int x, int y,
137                            int width, int height, Color bgcolor,
138                            ImageObserver observer)
139   {
140     boolean r = super.drawImage(image, x, y, width, height, bgcolor,
141                                 observer);
142     scheduleUpdate();
143     return r;
144   }
145 }
146