| 1 | //  Copyright 2004-2007 Jean-Francois Poilpret | 
| 2 | // | 
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
| 4 | // you may not use this file except in compliance with the License. | 
| 5 | // You may obtain a copy of the License at | 
| 6 | // | 
| 7 | //     http://www.apache.org/licenses/LICENSE-2.0 | 
| 8 | // | 
| 9 | // Unless required by applicable law or agreed to in writing, software | 
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| 12 | // See the License for the specific language governing permissions and | 
| 13 | // limitations under the License. | 
| 14 |   | 
| 15 | package net.sourceforge.hiveboard.util; | 
| 16 |   | 
| 17 | import java.awt.color.ColorSpace; | 
| 18 | import java.awt.image.ColorModel; | 
| 19 | import java.awt.image.ComponentColorModel; | 
| 20 | import java.awt.image.DataBuffer; | 
| 21 |   | 
| 22 | public class RGBAImageHolder extends AbstractImageHolder | 
| 23 | { | 
| 24 |         public RGBAImageHolder() | 
| 25 |         { | 
| 26 |                 super(RGBA_BYTES_PER_PIXEL, RGBA_BAND_OFFSET); | 
| 27 |         } | 
| 28 |          | 
| 29 |         @Override protected ColorModel        getColorModel() | 
| 30 |         { | 
| 31 |                 return RGBA_MODEL; | 
| 32 |         } | 
| 33 |   | 
| 34 |         static final private int                RGBA_BYTES_PER_PIXEL = 4; | 
| 35 |         static final private int[]                RGBA_BAND_OFFSET = new int[] {3, 2, 1, 0}; | 
| 36 |         static final private ColorModel        RGBA_MODEL = new ComponentColorModel( | 
| 37 |                                                                                                                 ColorSpace.getInstance( | 
| 38 |                                                                                                                                 ColorSpace.CS_LINEAR_RGB), | 
| 39 |                                                                                                                 true,  | 
| 40 |                                                                                                                 false,  | 
| 41 |                                                                                                                 ComponentColorModel.TRANSLUCENT, | 
| 42 |                                                                                                                 DataBuffer.TYPE_BYTE); | 
| 43 | } |