Frames | No Frames |
1: /* QtImageDirectGraphics.java -- 2: Copyright (C) 2005 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.GraphicsConfiguration; 42: import java.awt.Graphics; 43: import java.awt.Graphics2D; 44: import java.awt.Image; 45: import java.awt.Paint; 46: import java.awt.Rectangle; 47: import java.util.Stack; 48: import java.awt.Shape; 49: import java.awt.Stroke; 50: import java.awt.font.FontRenderContext; 51: import java.awt.font.GlyphVector; 52: import java.awt.geom.AffineTransform; 53: import java.awt.geom.PathIterator; 54: import java.awt.geom.Arc2D; 55: import java.awt.geom.Ellipse2D; 56: import java.awt.geom.Line2D; 57: import java.awt.geom.Rectangle2D; 58: import java.awt.geom.RoundRectangle2D; 59: import java.awt.image.BufferedImage; 60: import java.awt.image.BufferedImageOp; 61: import java.awt.image.ImageObserver; 62: import java.awt.image.RenderedImage; 63: import java.awt.image.renderable.RenderableImage; 64: 65: /** 66: * A QtImagePainter that does an update after every drawing op. 67: */ 68: public class QtImageDirectGraphics extends QtImageGraphics 69: { 70: private QtComponentPeer peer; 71: private boolean modified; 72: 73: public QtImageDirectGraphics(QtImage image, QtComponentPeer peer) 74: { 75: super( image ); 76: this.peer = peer; 77: modified = false; 78: } 79: 80: public QtImageDirectGraphics(QtImageGraphics g) 81: { 82: super( g ); 83: } 84: 85: private void scheduleUpdate() 86: { 87: } 88: 89: public void dispose() 90: { 91: super.dispose(); 92: peer.toolkit.sync(); 93: peer.QtUpdate(); 94: } 95: 96: public void draw(Shape s) 97: { 98: super.draw(s); 99: scheduleUpdate(); 100: } 101: 102: public void fill(Shape s) 103: { 104: super.fill(s); 105: scheduleUpdate(); 106: } 107: 108: public void drawString(String string, int x, int y) 109: { 110: super.drawString( string, x, y ); 111: scheduleUpdate(); 112: } 113: 114: public void drawString(String string, float x, float y) 115: { 116: super.drawString( string, x, y ); 117: scheduleUpdate(); 118: } 119: 120: public void drawLine(int x1, int y1, int x2, int y2) 121: { 122: super.drawLine(x1, y1, x2, y2); 123: scheduleUpdate(); 124: } 125: 126: public boolean drawImage(Image image, 127: AffineTransform Tx, 128: ImageObserver obs) 129: { 130: boolean r = super.drawImage(image, Tx, obs); 131: scheduleUpdate(); 132: return r; 133: } 134: 135: public boolean drawImage(Image image, int x, int y, Color bgcolor, 136: ImageObserver observer) 137: { 138: boolean r = super.drawImage(image, x, y, bgcolor, observer); 139: scheduleUpdate(); 140: return r; 141: } 142: 143: public boolean drawImage(Image image, 144: int dx1, int dy1, int dx2, int dy2, 145: int sx1, int sy1, int sx2, int sy2, 146: Color bgcolor, ImageObserver observer) 147: { 148: boolean r = super.drawImage( image, dx1, dy1, dx2, dy2, 149: sx1, sy1, sx2, sy2, 150: bgcolor, observer); 151: scheduleUpdate(); 152: return r; 153: } 154: 155: public boolean drawImage(Image image, int x, int y, 156: int width, int height, Color bgcolor, 157: ImageObserver observer) 158: { 159: boolean r = super.drawImage(image, x, y, width, height, bgcolor, 160: observer); 161: scheduleUpdate(); 162: return r; 163: } 164: } 165: