430N/A/*
2362N/A * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
430N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
430N/A *
430N/A * This code is free software; you can redistribute it and/or modify it
430N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
430N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
430N/A *
430N/A * This code is distributed in the hope that it will be useful, but WITHOUT
430N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
430N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
430N/A * version 2 for more details (a copy is included in the LICENSE file that
430N/A * accompanied this code).
430N/A *
430N/A * You should have received a copy of the GNU General Public License version
430N/A * 2 along with this work; if not, write to the Free Software Foundation,
430N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
430N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
430N/A */
430N/A
430N/Apackage sun.java2d.pipe.hw;
430N/A
430N/Aimport java.awt.Graphics;
430N/Aimport java.awt.Graphics2D;
430N/Aimport java.awt.GraphicsConfiguration;
430N/Aimport sun.awt.image.SunVolatileImage;
430N/Aimport static sun.java2d.pipe.hw.AccelSurface.*;
430N/A
430N/A/**
430N/A * This is an image with forced type of the accelerated surface.
430N/A */
430N/Apublic class AccelTypedVolatileImage extends SunVolatileImage {
430N/A
430N/A /**
430N/A * Creates a volatile image with specified type of accelerated surface.
430N/A *
430N/A * @param graphicsConfig a GraphicsConfiguration for which this image should
430N/A * be created.
430N/A * @param width width
430N/A * @param height width
430N/A * @param transparency type of {@link java.awt.Transparency transparency}
430N/A * requested for the image
430N/A * @param accType type of the desired accelerated surface as defined in
430N/A * AccelSurface interface
430N/A * @see sun.java2d.pipe.hw.AccelSurface
430N/A */
430N/A public AccelTypedVolatileImage(GraphicsConfiguration graphicsConfig,
430N/A int width, int height, int transparency,
430N/A int accType)
430N/A {
430N/A super(null, graphicsConfig, width, height, null, transparency,
430N/A null, accType);
430N/A }
430N/A
430N/A /**
430N/A * {@inheritDoc}
430N/A *
430N/A * This method will throw {@code UnsupportedOperationException} if it this
430N/A * image's destination surface can not be rendered to.
430N/A */
430N/A @Override
430N/A public Graphics2D createGraphics() {
430N/A if (getForcedAccelSurfaceType() == TEXTURE) {
430N/A throw new UnsupportedOperationException("Can't render " +
430N/A "to a non-RT Texture");
430N/A }
430N/A return super.createGraphics();
430N/A }
430N/A}