1/*
2 *  Licensed to the Apache Software Foundation (ASF) under one or more
3 *  contributor license agreements.  See the NOTICE file distributed with
4 *  this work for additional information regarding copyright ownership.
5 *  The ASF licenses this file to You under the Apache License, Version 2.0
6 *  (the "License"); you may not use this file except in compliance with
7 *  the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 */
17/**
18 * @author Igor V. Stolyarov
19 * @version $Revision$
20 * Created on 23.11.2005
21 *
22 */
23
24
25package org.apache.harmony.awt.gl;
26
27import java.awt.Image;
28import java.awt.image.DataBuffer;
29import java.awt.image.IndexColorModel;
30import java.awt.image.DataBufferInt;
31
32import org.apache.harmony.awt.gl.image.DataBufferListener;
33
34/**
35 * This class give an opportunity to get access to private data of
36 * some java.awt.image classes
37 * Implementation of this class placed in java.awt.image package
38 */
39
40public abstract class AwtImageBackdoorAccessor {
41
42    static protected AwtImageBackdoorAccessor inst;
43
44    public static AwtImageBackdoorAccessor getInstance(){
45        // First we need to run the static initializer in the DataBuffer class to resolve inst.
46        new DataBufferInt(0);
47        return inst;
48    }
49
50    public abstract Surface getImageSurface(Image image);
51    public abstract boolean isGrayPallete(IndexColorModel icm);
52
53    public abstract Object getData(DataBuffer db);
54    public abstract int[] getDataInt(DataBuffer db);
55    public abstract byte[] getDataByte(DataBuffer db);
56    public abstract short[] getDataShort(DataBuffer db);
57    public abstract short[] getDataUShort(DataBuffer db);
58    public abstract double[] getDataDouble(DataBuffer db);
59    public abstract float[] getDataFloat(DataBuffer db);
60    public abstract void releaseData(DataBuffer db);
61
62    public abstract void addDataBufferListener(DataBuffer db, DataBufferListener listener);
63    public abstract void removeDataBufferListener(DataBuffer db);
64    public abstract void validate(DataBuffer db);
65}
66