src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterGraphicsConfig.java
author serb
Mon, 28 Jan 2019 17:19:54 -0800
changeset 53673 e04d39094915
parent 47216 71c04702a3d5
permissions -rw-r--r--
8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration Reviewed-by: aivanov, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     1
/*
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
     2
 * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     4
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    10
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    15
 * accompanied this code).
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    16
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    20
 *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    23
 * questions.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    24
 */
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    25
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    26
package sun.lwawt.macosx;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    27
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    28
import java.awt.Component;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    29
import java.awt.Graphics2D;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    30
import java.awt.GraphicsConfiguration;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    31
import java.awt.GraphicsDevice;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    32
import java.awt.Rectangle;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    33
import java.awt.Transparency;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    34
import java.awt.geom.AffineTransform;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    35
import java.awt.image.BufferedImage;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    36
import java.awt.image.ColorModel;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    37
import java.awt.image.VolatileImage;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    38
import java.awt.print.PageFormat;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    39
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    40
public final class CPrinterGraphicsConfig extends GraphicsConfiguration {
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    41
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    42
    public static CPrinterGraphicsConfig getConfig(PageFormat pf) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    43
        return new CPrinterGraphicsConfig(pf);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    44
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    45
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    46
    private final GraphicsDevice device;
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    47
    private final PageFormat pf;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    48
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    49
    public CPrinterGraphicsConfig(PageFormat pf) {
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    50
        this.device = new CPrinterDevice(this);
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    51
        this.pf = pf;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    52
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    53
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    54
    public PageFormat getPageFormat() {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    55
        return pf;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    56
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    57
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    58
    /**
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    59
     * Returns the {@link GraphicsDevice} associated with this
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    60
     * {@code GraphicsConfiguration}.
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    61
     * @return a {@code GraphicsDevice} object that is
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    62
     * associated with this {@code GraphicsConfiguration}.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    63
     */
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    64
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    65
    public GraphicsDevice getDevice() {
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    66
        return device;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    67
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    68
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    69
    /**
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    70
     * Returns a {@link BufferedImage} with a data layout and color model
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    71
     * compatible with this {@code GraphicsConfiguration}.  This
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    72
     * method has nothing to do with memory-mapping
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    73
     * a device.  The returned {@code BufferedImage} has
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    74
     * a layout and color model that is closest to this native device
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    75
     * configuration and can therefore be optimally blitted to this
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    76
     * device.
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    77
     * @param width the width of the returned {@code BufferedImage}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    78
     * @param height the height of the returned {@code BufferedImage}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    79
     * @return a {@code BufferedImage} whose data layout and color
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    80
     * model is compatible with this {@code GraphicsConfiguration}.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    81
     */
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
    82
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    83
    public BufferedImage createCompatibleImage(int width, int height) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    84
        return createCompatibleImage(width, height, Transparency.OPAQUE);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    85
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    86
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    87
    /**
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    88
     * Returns a {@link VolatileImage} with a data layout and color model
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    89
     * compatible with this {@code GraphicsConfiguration}.
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    90
     * The returned {@code VolatileImage}
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    91
     * may have data that is stored optimally for the underlying graphics
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    92
     * device and may therefore benefit from platform-specific rendering
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    93
     * acceleration.
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    94
     * @param width the width of the returned {@code VolatileImage}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    95
     * @param height the height of the returned {@code VolatileImage}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    96
     * @return a {@code VolatileImage} whose data layout and color
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    97
     * model is compatible with this {@code GraphicsConfiguration}.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    98
     * @see Component#createVolatileImage(int, int)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    99
     */
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
   100
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   101
    public VolatileImage createCompatibleVolatileImage(int width, int height) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   102
        return createCompatibleVolatileImage(width, height, Transparency.OPAQUE);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   103
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   104
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   105
    // empty implementation (this should not be called)
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
   106
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   107
    public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   108
        return null;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   109
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   110
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   111
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   112
     * Returns a {@code BufferedImage} that supports the specified
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   113
     * transparency and has a data layout and color model
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   114
     * compatible with this {@code GraphicsConfiguration}.  This
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   115
     * method has nothing to do with memory-mapping
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   116
     * a device. The returned {@code BufferedImage} has a layout and
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   117
     * color model that can be optimally blitted to a device
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   118
     * with this {@code GraphicsConfiguration}.
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   119
     * @param width the width of the returned {@code BufferedImage}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   120
     * @param height the height of the returned {@code BufferedImage}
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   121
     * @param transparency the specified transparency mode
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   122
     * @return a {@code BufferedImage} whose data layout and color
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   123
     * model is compatible with this {@code GraphicsConfiguration}
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   124
     * and also supports the specified transparency.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   125
     * @see Transparency#OPAQUE
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   126
     * @see Transparency#BITMASK
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   127
     * @see Transparency#TRANSLUCENT
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   128
     */
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
   129
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   130
    public BufferedImage createCompatibleImage(int width, int height, int transparency) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   131
        //+++gdb what to do?
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   132
        return null;
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   133
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   134
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   135
    /**
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   136
     * Returns the {@link ColorModel} associated with this
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   137
     * {@code GraphicsConfiguration}.
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   138
     * @return a {@code ColorModel} object that is associated with
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   139
     * this {@code GraphicsConfiguration}.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   140
     */
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
   141
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   142
    public ColorModel getColorModel() {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   143
        return getColorModel(Transparency.OPAQUE);
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   144
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   145
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   146
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   147
     * Returns the {@code ColorModel} associated with this
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   148
     * {@code GraphicsConfiguration} that supports the specified
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   149
     * transparency.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   150
     * @param transparency the specified transparency mode
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   151
     * @return a {@code ColorModel} object that is associated with
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   152
     * this {@code GraphicsConfiguration} and supports the
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   153
     * specified transparency.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   154
     */
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
   155
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   156
    public ColorModel getColorModel(int transparency) {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   157
        return ColorModel.getRGBdefault();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   158
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   159
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   160
    /**
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   161
     * Returns the default {@link AffineTransform} for this
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   162
     * {@code GraphicsConfiguration}. This
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   163
     * {@code AffineTransform} is typically the Identity transform
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   164
     * for most normal screens.  The default {@code AffineTransform}
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   165
     * maps coordinates onto the device such that 72 user space
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   166
     * coordinate units measure approximately 1 inch in device
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   167
     * space.  The normalizing transform can be used to make
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   168
     * this mapping more exact.  Coordinates in the coordinate space
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   169
     * defined by the default {@code AffineTransform} for screen and
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   170
     * printer devices have the origin in the upper left-hand corner of
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   171
     * the target region of the device, with X coordinates
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   172
     * increasing to the right and Y coordinates increasing downwards.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   173
     * For image buffers not associated with a device, such as those not
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   174
     * created by {@code createCompatibleImage},
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   175
     * this {@code AffineTransform} is the Identity transform.
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   176
     * @return the default {@code AffineTransform} for this
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   177
     * {@code GraphicsConfiguration}.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   178
     */
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
   179
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   180
    public AffineTransform getDefaultTransform() {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   181
        return new AffineTransform();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   182
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   183
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   184
    /**
38986
5b96e2b155eb 8157322: Several typos in javadoc
dmarkov
parents: 35667
diff changeset
   185
     * Returns an {@code AffineTransform} that can be concatenated
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   186
     * with the default {@code AffineTransform}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   187
     * of a {@code GraphicsConfiguration} so that 72 units in user
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   188
     * space equals 1 inch in device space.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   189
     * <p>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   190
     * For a particular {@link Graphics2D}, g, one
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   191
     * can reset the transformation to create
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   192
     * such a mapping by using the following pseudocode:
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   193
     * <pre>
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   194
     *      GraphicsConfiguration gc = g.getGraphicsConfiguration();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   195
     *
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   196
     *      g.setTransform(gc.getDefaultTransform());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   197
     *      g.transform(gc.getNormalizingTransform());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   198
     * </pre>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   199
     * Note that sometimes this {@code AffineTransform} is identity,
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   200
     * such as for printers or metafile output, and that this
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   201
     * {@code AffineTransform} is only as accurate as the information
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   202
     * supplied by the underlying system.  For image buffers not
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   203
     * associated with a device, such as those not created by
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   204
     * {@code createCompatibleImage}, this
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   205
     * {@code AffineTransform} is the Identity transform
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   206
     * since there is no valid distance measurement.
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   207
     * @return an {@code AffineTransform} to concatenate to the
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   208
     * default {@code AffineTransform} so that 72 units in user
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   209
     * space is mapped to 1 inch in device space.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   210
     */
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
   211
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   212
    public AffineTransform getNormalizingTransform() {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   213
        return new AffineTransform();
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   214
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   215
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   216
    /**
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   217
     * Returns the bounds of the {@code GraphicsConfiguration}
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   218
     * in the device coordinates. In a multi-screen environment
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   219
     * with a virtual device, the bounds can have negative X
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   220
     * or Y origins.
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   221
     * @return the bounds of the area covered by this
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   222
     * {@code GraphicsConfiguration}.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   223
     * @since 1.3
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   224
     */
53673
e04d39094915 8214076: Cleanup the code related to GraphicsEnvironment/Device/Configuration
serb
parents: 47216
diff changeset
   225
    @Override
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   226
    public Rectangle getBounds() {
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   227
        return new Rectangle(0, 0, (int)pf.getWidth(), (int)pf.getHeight());
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   228
    }
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   229
}