001: /*
002:
003: Licensed to the Apache Software Foundation (ASF) under one or more
004: contributor license agreements. See the NOTICE file distributed with
005: this work for additional information regarding copyright ownership.
006: The ASF licenses this file to You under the Apache License, Version 2.0
007: (the "License"); you may not use this file except in compliance with
008: the License. You may obtain a copy of the License at
009:
010: http://www.apache.org/licenses/LICENSE-2.0
011:
012: Unless required by applicable law or agreed to in writing, software
013: distributed under the License is distributed on an "AS IS" BASIS,
014: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: See the License for the specific language governing permissions and
016: limitations under the License.
017:
018: */
019: package org.apache.batik.bridge;
020:
021: import java.awt.image.BufferedImage;
022: import java.util.EventObject;
023: import java.util.List;
024:
025: /**
026: * This class represents an event which indicate an event originated
027: * from a UpdateManager instance.
028: *
029: * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
030: * @version $Id: UpdateManagerEvent.java 475477 2006-11-15 22:44:28Z cam $
031: */
032: public class UpdateManagerEvent extends EventObject {
033:
034: /**
035: * The buffered image.
036: */
037: protected BufferedImage image;
038:
039: /**
040: * The dirty areas, as a List of Rectangles.
041: */
042: protected List dirtyAreas;
043:
044: /**
045: * True if before painting this update the canvas's painting
046: * transform needs to be cleared.
047: */
048: protected boolean clearPaintingTransform;
049:
050: /**
051: * Creates a new UpdateManagerEvent.
052: * @param source the object that originated the event, ie. the
053: * UpdateManager.
054: * @param bi the image to paint.
055: * @param das List of dirty areas.
056: */
057: public UpdateManagerEvent(Object source, BufferedImage bi, List das) {
058: super (source);
059: this .image = bi;
060: this .dirtyAreas = das;
061: this .clearPaintingTransform = false;
062: }
063:
064: /**
065: * Creates a new UpdateManagerEvent.
066: * @param source the object that originated the event, ie. the
067: * UpdateManager.
068: * @param bi the image to paint.
069: * @param das List of dirty areas.
070: * @param cpt Indicates if the painting transform should be
071: * cleared as a result of this event.
072: */
073: public UpdateManagerEvent(Object source, BufferedImage bi,
074: List das, boolean cpt) {
075: super (source);
076: this .image = bi;
077: this .dirtyAreas = das;
078: this .clearPaintingTransform = cpt;
079: }
080:
081: /**
082: * Returns the image to display, or null if the rendering failed.
083: */
084: public BufferedImage getImage() {
085: return image;
086: }
087:
088: /**
089: * Returns the dirty areas (list of rectangles)
090: */
091: public List getDirtyAreas() {
092: return dirtyAreas;
093: }
094:
095: /**
096: * returns true if the component should clear it's painting transform
097: * before painting the associated BufferedImage.
098: */
099: public boolean getClearPaintingTransform() {
100: return clearPaintingTransform;
101: }
102: }
|