1 /*
2
3    Licensed to the Apache Software Foundation (ASF) under one or more
4    contributor license agreements.  See the NOTICE file distributed with
5    this work for additional information regarding copyright ownership.
6    The ASF licenses this file to You under the Apache License, Version 2.0
7    (the "License"); you may not use this file except in compliance with
8    the License.  You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17
18  */

19 package org.apache.batik.ext.awt;
20
21 import java.awt.RenderingHints;
22
23 /**
24  * TranscodingHint as to what the destination of the drawing is.
25  *
26  * @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
27  * @version $Id: ColorSpaceHintKey.java 1733416 2016-03-03 07:07:13Z gadams $
28  */

29 public final class ColorSpaceHintKey extends RenderingHints.Key {
30
31     /**
32      * Notice to source that we prefer an Alpha RGB Image.
33      */

34     public static Object VALUE_COLORSPACE_ARGB  = new Object();
35
36     /**
37      * Notice to source that we will not use Alpha Channel but
38      * we still want RGB data.
39      */

40     public static Object VALUE_COLORSPACE_RGB   = new Object();
41
42     /**
43      * Notice to source that we only want Greyscale data (no Alpha).
44      */

45     public static Object VALUE_COLORSPACE_GREY  = new Object();
46
47     /**
48      * Notice to source that we only want Greyscale data with
49      * an alpha channel.
50      */

51     public static Object VALUE_COLORSPACE_AGREY = new Object();
52
53     /**
54      * Notice to source that we only want an alpha channel.
55      * The source should simply render alpha (no conversion)
56      */

57     public static Object VALUE_COLORSPACE_ALPHA = new Object();
58
59     /**
60      * Notice to source that we only want an alpha channel.
61      * The source should follow the SVG spec for how to
62      * convert ARGB, RGB, Grey and AGrey to just an Alpha channel.
63      */

64     public static Object VALUE_COLORSPACE_ALPHA_CONVERT = new Object();
65
66     public static final String PROPERTY_COLORSPACE =
67         "org.apache.batik.gvt.filter.Colorspace";
68
69     /** 
70      * Note that this is package private.
71      */

72     ColorSpaceHintKey(int number) { super(number); }
73
74     public boolean isCompatibleValue(Object val) {
75         if (val == VALUE_COLORSPACE_ARGB)          return true;
76         if (val == VALUE_COLORSPACE_RGB)           return true;
77         if (val == VALUE_COLORSPACE_GREY)          return true;
78         if (val == VALUE_COLORSPACE_AGREY)         return true;
79         if (val == VALUE_COLORSPACE_ALPHA)         return true;
80         if (val == VALUE_COLORSPACE_ALPHA_CONVERT) return true;
81         return false;
82     }
83 }
84
85