0N/A/*
4552N/A * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
0N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
1472N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1472N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0N/A * or visit www.oracle.com if you need additional information or have any
0N/A * questions.
0N/A */
1879N/A
1879N/Apackage sun.awt;
1879N/A
1879N/Aimport java.awt.image.ComponentColorModel;
1879N/Aimport java.awt.image.PixelInterleavedSampleModel;
1879N/Aimport java.awt.image.WritableRaster;
1879N/Aimport java.awt.image.Raster;
1879N/Aimport java.awt.image.DataBuffer;
1879N/Aimport java.awt.image.SampleModel;
1879N/Aimport java.awt.color.ColorSpace;
1879N/Aimport java.awt.Transparency;
1879N/A
1879N/A/**
1879N/A * This class creates a standard ComponentColorModel with the slight
1879N/A * difference that it creates its Raster objects with the components
1879N/A * in the reverse order from the base ComponentColorModel to match
1879N/A * the ordering on a Windows 24-bit display.
1879N/A */
1879N/Apublic class Win32ColorModel24 extends ComponentColorModel {
1879N/A public Win32ColorModel24() {
1879N/A super(ColorSpace.getInstance(ColorSpace.CS_sRGB),
1879N/A new int[] {8, 8, 8}, false, false,
1879N/A Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
3863N/A }
1879N/A
1879N/A /**
1879N/A * Creates a WritableRaster with the specified width and height, that
1879N/A * has a data layout (SampleModel) compatible with this ColorModel.
1879N/A * @see WritableRaster
1879N/A * @see SampleModel
1879N/A */
1879N/A public WritableRaster createCompatibleWritableRaster (int w, int h) {
1879N/A int[] bOffs = {2, 1, 0};
1879N/A return Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
1879N/A w, h, w*3, 3,
1879N/A bOffs, null);
1879N/A }
1879N/A
1879N/A /**
2796N/A * Creates a SampleModel with the specified width and height, that
2796N/A * has a data layout compatible with this ColorModel.
2796N/A * @see SampleModel
2796N/A */
0N/A public SampleModel createCompatibleSampleModel(int w, int h) {
0N/A int[] bOffs = {2, 1, 0};
0N/A return new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
0N/A w, h, 3, w*3, bOffs);
0N/A }
0N/A}
0N/A