Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/macosx/classes/sun/awt/CGraphicsConfig.java
38827 views
/*1* Copyright (c) 2011, 2013, 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.awt;2627import java.awt.*;28import java.awt.geom.*;29import java.awt.image.*;3031import sun.java2d.SurfaceData;32import sun.java2d.opengl.CGLLayer;33import sun.lwawt.LWGraphicsConfig;34import sun.lwawt.macosx.CPlatformView;3536public abstract class CGraphicsConfig extends GraphicsConfiguration37implements LWGraphicsConfig {3839private final CGraphicsDevice device;40private ColorModel colorModel;4142protected CGraphicsConfig(CGraphicsDevice device) {43this.device = device;44}4546@Override47public BufferedImage createCompatibleImage(int width, int height) {48throw new UnsupportedOperationException("not implemented");49}5051private static native Rectangle2D nativeGetBounds(int screen);5253@Override54public Rectangle getBounds() {55final Rectangle2D nativeBounds = nativeGetBounds(device.getCGDisplayID());56return nativeBounds.getBounds(); // does integer rounding57}5859@Override60public ColorModel getColorModel() {61if (colorModel == null) {62colorModel = getColorModel(Transparency.OPAQUE);63}64return colorModel;65}6667@Override68public ColorModel getColorModel(int transparency) {69throw new UnsupportedOperationException("not implemented");70}7172@Override73public AffineTransform getDefaultTransform() {74return new AffineTransform();75}7677@Override78public CGraphicsDevice getDevice() {79return device;80}8182@Override83public AffineTransform getNormalizingTransform() {84double xscale = device.getXResolution() / 72.0;85double yscale = device.getYResolution() / 72.0;86return new AffineTransform(xscale, 0.0, 0.0, yscale, 0.0, 0.0);87}8889/**90* Creates a new SurfaceData that will be associated with the given91* LWWindowPeer.92*/93public abstract SurfaceData createSurfaceData(CPlatformView pView);9495/**96* Creates a new SurfaceData that will be associated with the given97* CGLLayer.98*/99public abstract SurfaceData createSurfaceData(CGLLayer layer);100101@Override102public final boolean isTranslucencyCapable() {103//we know for sure we have capable config :)104return true;105}106}107108109