001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Alexey A. Petrenko
019: * @version $Revision$
020: */package java.awt;
021:
022: import java.awt.geom.AffineTransform;
023: import java.awt.image.BufferedImage;
024: import java.awt.image.ColorModel;
025: import java.awt.image.VolatileImage;
026:
027: import org.apache.harmony.awt.internal.nls.Messages;
028:
029: public abstract class GraphicsConfiguration {
030: /***************************************************************************
031: *
032: * Constructors
033: *
034: ***************************************************************************/
035:
036: protected GraphicsConfiguration() {
037: }
038:
039: /***************************************************************************
040: *
041: * Abstract methods
042: *
043: ***************************************************************************/
044:
045: public abstract BufferedImage createCompatibleImage(int width,
046: int height);
047:
048: public abstract BufferedImage createCompatibleImage(int width,
049: int height, int transparency);
050:
051: public abstract VolatileImage createCompatibleVolatileImage(
052: int width, int height);
053:
054: public abstract VolatileImage createCompatibleVolatileImage(
055: int width, int height, int transparency);
056:
057: public abstract Rectangle getBounds();
058:
059: public abstract ColorModel getColorModel();
060:
061: public abstract ColorModel getColorModel(int transparency);
062:
063: public abstract AffineTransform getDefaultTransform();
064:
065: public abstract GraphicsDevice getDevice();
066:
067: public abstract AffineTransform getNormalizingTransform();
068:
069: /***************************************************************************
070: *
071: * Public methods
072: *
073: ***************************************************************************/
074:
075: public VolatileImage createCompatibleVolatileImage(int width,
076: int height, ImageCapabilities caps) throws AWTException {
077: VolatileImage res = createCompatibleVolatileImage(width, height);
078: if (!res.getCapabilities().equals(caps)) {
079: // awt.14A=Can not create VolatileImage with specified capabilities
080: throw new AWTException(Messages.getString("awt.14A")); //$NON-NLS-1$
081: }
082: return res;
083: }
084:
085: public VolatileImage createCompatibleVolatileImage(int width,
086: int height, ImageCapabilities caps, int transparency)
087: throws AWTException {
088: VolatileImage res = createCompatibleVolatileImage(width,
089: height, transparency);
090: if (!res.getCapabilities().equals(caps)) {
091: // awt.14A=Can not create VolatileImage with specified capabilities
092: throw new AWTException(Messages.getString("awt.14A")); //$NON-NLS-1$
093: }
094: return res;
095: }
096:
097: public BufferCapabilities getBufferCapabilities() {
098: return new BufferCapabilities(new ImageCapabilities(false),
099: new ImageCapabilities(false),
100: BufferCapabilities.FlipContents.UNDEFINED);
101: }
102:
103: public ImageCapabilities getImageCapabilities() {
104: return new ImageCapabilities(false);
105: }
106: }
|