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 RGBImageHolder extends AbstractImageHolder |
23 | { |
24 | public RGBImageHolder() |
25 | { |
26 | super(ImageDef.BYTES_PER_PIXEL, RGB_BAND_OFFSET); |
27 | } |
28 | |
29 | @Override protected ColorModel getColorModel() |
30 | { |
31 | return RGB_MODEL; |
32 | } |
33 | |
34 | static final private int[] RGB_BAND_OFFSET = new int[] {0, 1, 2}; |
35 | static final private ColorModel RGB_MODEL = new ComponentColorModel( |
36 | ColorSpace.getInstance( |
37 | ColorSpace.CS_LINEAR_RGB), |
38 | false, |
39 | false, |
40 | ComponentColorModel.OPAQUE, |
41 | DataBuffer.TYPE_BYTE); |
42 | } |