Path: blob/master/src/java.desktop/share/classes/sun/java2d/pipe/hw/AccelSurface.java
41161 views
/*1* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.java2d.pipe.hw;2627import java.awt.Rectangle;28import sun.java2d.Surface;2930import java.lang.annotation.Native;3132/**33* Abstraction for a hardware accelerated surface.34*/35public interface AccelSurface extends BufferedContextProvider, Surface {36/**37* Undefined38*/39@Native public static final int UNDEFINED = 0;40/**41* Window (or window substitute) surface42*/43@Native public static final int WINDOW = 1;44/**45* Render-To Plain surface (Render Target surface for Direct3D)46*/47@Native public static final int RT_PLAIN = 2;48/**49* Texture surface50*/51@Native public static final int TEXTURE = 3;52/**53* A back-buffer surface (SwapChain surface for Direct3D, backbuffer for54* OpenGL)55*/56@Native public static final int FLIP_BACKBUFFER = 4;57/**58* Render-To Texture surface (fbobject for OpenGL, texture with render-to59* attribute for Direct3D)60*/61@Native public static final int RT_TEXTURE = 5;6263/**64* Returns {@code int} representing surface's type as defined by constants65* in this interface.66*67* @return an integer representing this surface's type68* @see AccelSurface#UNDEFINED69* @see AccelSurface#WINDOW70* @see AccelSurface#RT_PLAIN71* @see AccelSurface#TEXTURE72* @see AccelSurface#FLIP_BACKBUFFER73* @see AccelSurface#RT_TEXTURE74*/75public int getType();7677/**78* Returns a pointer to the native surface data associated with this79* surface.80* Note: this pointer is only valid on the rendering thread.81*82* @return pointer to the native surface's data83*/84public long getNativeOps();8586/**87* Returns a pointer to the real native resource88* of the specified type associated with this AccelSurface.89* Note: this pointer is only valid on the rendering thread.90*91* @param resType the type of the requested resource92* @return a long containing a pointer to the native resource of the93* specified type or 0L if such resource doesn't exist for this surface94*/95public long getNativeResource(int resType);9697/**98* Marks this surface dirty.99*/100public void markDirty();101102/**103* Returns whether the pipeline considers this surface valid. A surface104* may become invalid if it is disposed of, or resized.105*106* @return true if valid, false otherwise107*/108public boolean isValid();109110/**111* Returns whether this surface is lost. The return value is only valid112* on the render thread, meaning that even if this method returns113* {@code true} it could be lost in the next moment unless it is called114* on the rendering thread.115*116* @return true if the surface is known to be lost, false otherwise117*/118public boolean isSurfaceLost();119120/**121* Returns the requested bounds of the destination surface. The real bounds122* of the native accelerated surface may differ. Use123* {@link #getNativeBounds} to get the bounds of the native surface.124*125* @return Rectangle representing java surface's bounds126*/127public Rectangle getBounds();128129/**130* Returns real bounds of the native surface, which may differ from those131* returned by {@link #getBounds}.132*133* @return Rectangle representing native surface's bounds134*/135public Rectangle getNativeBounds();136}137138139