1d1766043SAndrew Rist/************************************************************** 2d1766043SAndrew Rist * 3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4d1766043SAndrew Rist * or more contributor license agreements. See the NOTICE file 5d1766043SAndrew Rist * distributed with this work for additional information 6d1766043SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the 8d1766043SAndrew Rist * "License"); you may not use this file except in compliance 9d1766043SAndrew Rist * with the License. You may obtain a copy of the License at 10d1766043SAndrew Rist * 11d1766043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12d1766043SAndrew Rist * 13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing, 14d1766043SAndrew Rist * software distributed under the License is distributed on an 15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16d1766043SAndrew Rist * KIND, either express or implied. See the License for the 17d1766043SAndrew Rist * specific language governing permissions and limitations 18d1766043SAndrew Rist * under the License. 19d1766043SAndrew Rist * 20d1766043SAndrew Rist *************************************************************/ 21d1766043SAndrew Rist 22d1766043SAndrew Rist 23cdf0e10cSrcweir#ifndef __com_sun_star_rendering_XColorSpace_idl__ 24cdf0e10cSrcweir#define __com_sun_star_rendering_XColorSpace_idl__ 25cdf0e10cSrcweir 26cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__ 27cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl> 28cdf0e10cSrcweir#endif 29cdf0e10cSrcweir#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ 30cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl> 31cdf0e10cSrcweir#endif 32cdf0e10cSrcweir#ifndef __com_sun_star_beans_PropertyValue_idl__ 33cdf0e10cSrcweir#include <com/sun/star/beans/PropertyValue.idl> 34cdf0e10cSrcweir#endif 35cdf0e10cSrcweir#ifndef __com_sun_star_rendering_ColorProfile_idl__ 36cdf0e10cSrcweir#include <com/sun/star/rendering/ColorProfile.idl> 37cdf0e10cSrcweir#endif 38*b63233d8Sdamjan#ifndef __com_sun_star_rendering_ColorComponent_idl__ 39*b63233d8Sdamjan#include <com/sun/star/rendering/ColorComponent.idl> 40*b63233d8Sdamjan#endif 41*b63233d8Sdamjan#ifndef __com_sun_star_rendering_RGBColor_idl__ 42*b63233d8Sdamjan#include <com/sun/star/rendering/RGBColor.idl> 43*b63233d8Sdamjan#endif 44*b63233d8Sdamjan#ifndef __com_sun_star_rendering_ARGBColor_idl__ 45*b63233d8Sdamjan#include <com/sun/star/rendering/ARGBColor.idl> 46*b63233d8Sdamjan#endif 47cdf0e10cSrcweir 48cdf0e10cSrcweirmodule com { module sun { module star { module rendering { 49cdf0e10cSrcweir 50cdf0e10cSrcweir/** Information how to interpret certain color data.<p> 51cdf0e10cSrcweir 52cdf0e10cSrcweir This interface encapsulates all information that is necessary to 53cdf0e10cSrcweir interpret color data, by defining a describing color space, like 54cdf0e10cSrcweir for example CMYK or sRGB. You can either convert between this and 55cdf0e10cSrcweir an arbitrary other colorspace, or into the standard RGB or ARGB 56cdf0e10cSrcweir formats (because those are so overwhelmingly common in computer 57cdf0e10cSrcweir graphics).<p> 58cdf0e10cSrcweir 59cdf0e10cSrcweir All canvas interfaces standardize to sequences of IEEE doubles for 60cdf0e10cSrcweir color representation. As this is overly verbose when used for 61cdf0e10cSrcweir bitmap data, derived interfaces exist, 62cdf0e10cSrcweir e.g. <type>XIntegerBitmapColorSpace</type>, which use sequences of 63cdf0e10cSrcweir integers for color representation.<p> 64cdf0e10cSrcweir */ 65cdf0e10cSrcweirpublished interface XColorSpace 66cdf0e10cSrcweir{ 67cdf0e10cSrcweir /** Query type of this color space.<p> 68cdf0e10cSrcweir 69cdf0e10cSrcweir @return a value from the <type>ColorSpaceType</type> constant 70cdf0e10cSrcweir group. 71cdf0e10cSrcweir */ 72cdf0e10cSrcweir byte getType(); 73cdf0e10cSrcweir 74cdf0e10cSrcweir /** Query the kind for each color component.<p> 75cdf0e10cSrcweir 76cdf0e10cSrcweir Color space components tend to correspond to physical 77cdf0e10cSrcweir attributes like the amount of one specific colorant contained 78cdf0e10cSrcweir in the final output color. This method returns a sequence of 79cdf0e10cSrcweir tags, specifying for each component of a color value, to what 80cdf0e10cSrcweir color attribute (if any) it corresponds. The values must be 81cdf0e10cSrcweir one of the <type>ColorComponentTag</type> constants.<p> 82cdf0e10cSrcweir 83cdf0e10cSrcweir At the same time, the number of elements in this sequence 84cdf0e10cSrcweir corresponds to the number of color channels for this color 85cdf0e10cSrcweir space.<p> 86cdf0e10cSrcweir 87cdf0e10cSrcweir @example For the standard RGB color space, ComponentTags 88cdf0e10cSrcweir consists of three elements, containing RGB_RED, RGB_GREEN and 89cdf0e10cSrcweir RGB_BLUE tags, respectively 90cdf0e10cSrcweir */ 91cdf0e10cSrcweir sequence<byte> getComponentTags(); 92cdf0e10cSrcweir 93cdf0e10cSrcweir /** Query rendering intent of this color space.<p> 94cdf0e10cSrcweir 95cdf0e10cSrcweir @return a value from the <type>RenderingIntent</type> constant 96cdf0e10cSrcweir group. 97cdf0e10cSrcweir */ 98cdf0e10cSrcweir byte getRenderingIntent(); 99cdf0e10cSrcweir 100cdf0e10cSrcweir /** Query various optional properties from the color space.<p> 101cdf0e10cSrcweir 102cdf0e10cSrcweir If this color space has an ICC color profile, the sequence 103cdf0e10cSrcweir contains an element named ICCProfile. Some color spaces also 104cdf0e10cSrcweir have properties Gamma, Whitepoint and Blackpoint. Background 105cdf0e10cSrcweir information for these is available <a 106cdf0e10cSrcweir href="http://en.wikipedia.org/wiki/Color_temperature">here</a>. 107cdf0e10cSrcweir */ 108cdf0e10cSrcweir sequence< ::com::sun::star::beans::PropertyValue > getProperties(); 109cdf0e10cSrcweir 110cdf0e10cSrcweir 111cdf0e10cSrcweir //============================================================================= 112cdf0e10cSrcweir 113cdf0e10cSrcweir /** Convert to color of another color space.<p> 114cdf0e10cSrcweir 115cdf0e10cSrcweir @param deviceColor Sequence of device color components. Is 116cdf0e10cSrcweir permitted to contain more than one device color element, 117cdf0e10cSrcweir therefore, batch conversion of multiple color values is 118cdf0e10cSrcweir possible. 119cdf0e10cSrcweir 120cdf0e10cSrcweir @return the corresponding sequence of device colors in the 121cdf0e10cSrcweir target color space (e.g. <type>sequence<double></type> or 122cdf0e10cSrcweir <type>sequence<byte></type>). 123cdf0e10cSrcweir 124cdf0e10cSrcweir @throws a 125cdf0e10cSrcweir <type>com::sun::star::lang::IllegalArgumentException</type>, 126cdf0e10cSrcweir if the input sequence does not match the device color format 127cdf0e10cSrcweir (e.g. if the number of components is wrong) 128cdf0e10cSrcweir */ 129cdf0e10cSrcweir sequence<ColorComponent> convertColorSpace( [in] sequence<ColorComponent> deviceColor, [in] XColorSpace targetColorSpace ) 130cdf0e10cSrcweir raises (com::sun::star::lang::IllegalArgumentException); 131cdf0e10cSrcweir 132cdf0e10cSrcweir /** Convert color value in this color space to sRGB color values.<p> 133cdf0e10cSrcweir 134cdf0e10cSrcweir Any information not representable in the <type>RGBColor</type> 135cdf0e10cSrcweir struct is discarded during the conversion. This includes alpha 136cdf0e10cSrcweir information. 137cdf0e10cSrcweir 138cdf0e10cSrcweir @param deviceColor Sequence of device color components. Is 139cdf0e10cSrcweir permitted to contain more than one device color element, 140cdf0e10cSrcweir therefore, batch conversion of multiple color values is 141cdf0e10cSrcweir possible. 142cdf0e10cSrcweir 143cdf0e10cSrcweir @return the corresponding sequence of colors in the sRGB color 144cdf0e10cSrcweir space. 145cdf0e10cSrcweir 146cdf0e10cSrcweir @throws a 147cdf0e10cSrcweir <type>com::sun::star::lang::IllegalArgumentException</type>, 148cdf0e10cSrcweir if the input sequence does not match the device color format. 149cdf0e10cSrcweir 150cdf0e10cSrcweir @see <member>convertToARGB</member> 151cdf0e10cSrcweir */ 152cdf0e10cSrcweir sequence<RGBColor> convertToRGB( [in] sequence<ColorComponent> deviceColor ) 153cdf0e10cSrcweir raises (com::sun::star::lang::IllegalArgumentException); 154cdf0e10cSrcweir 155cdf0e10cSrcweir /** Convert color value in this color space to sRGB color values, with linear alpha.<p> 156cdf0e10cSrcweir 157cdf0e10cSrcweir If the given input color does not carry alpha information, an 158cdf0e10cSrcweir alpha value of 1.0 (fully opaque) is assumed. 159cdf0e10cSrcweir 160cdf0e10cSrcweir @param deviceColor Sequence of device color components. Is 161cdf0e10cSrcweir permitted to contain more than one device color element, 162cdf0e10cSrcweir therefore, batch conversion of multiple color values is 163cdf0e10cSrcweir possible. 164cdf0e10cSrcweir 165cdf0e10cSrcweir @return the corresponding sequence of colors in the sRGB color 166cdf0e10cSrcweir space. 167cdf0e10cSrcweir 168cdf0e10cSrcweir @throws a 169cdf0e10cSrcweir <type>com::sun::star::lang::IllegalArgumentException</type>, 170cdf0e10cSrcweir if the input sequence does not match the device color format. 171cdf0e10cSrcweir */ 172cdf0e10cSrcweir sequence<ARGBColor> convertToARGB( [in] sequence<ColorComponent> deviceColor ) 173cdf0e10cSrcweir raises (com::sun::star::lang::IllegalArgumentException); 174cdf0e10cSrcweir 175cdf0e10cSrcweir /** Convert color value in this color space to premultiplied sRGB 176cdf0e10cSrcweir color values, with linear alpha.<p> 177cdf0e10cSrcweir 178cdf0e10cSrcweir If the given input color does not carry alpha information, an 179cdf0e10cSrcweir alpha value of 1.0 (fully opaque) is assumed. The resulting 180cdf0e10cSrcweir individual RGB color values are premultiplied by the alpha 181cdf0e10cSrcweir value (e.g. if alpha is 0.5, each color value has only half of 182cdf0e10cSrcweir the original intensity).<p> 183cdf0e10cSrcweir 184cdf0e10cSrcweir @param deviceColor Sequence of device color components. Is 185cdf0e10cSrcweir permitted to contain more than one device color element, 186cdf0e10cSrcweir therefore, batch conversion of multiple color values is 187cdf0e10cSrcweir possible. 188cdf0e10cSrcweir 189cdf0e10cSrcweir @return the corresponding sequence of colors in the sRGB color 190cdf0e10cSrcweir space. 191cdf0e10cSrcweir 192cdf0e10cSrcweir @throws a 193cdf0e10cSrcweir <type>com::sun::star::lang::IllegalArgumentException</type>, 194cdf0e10cSrcweir if the input sequence does not match the device color format. 195cdf0e10cSrcweir */ 196cdf0e10cSrcweir sequence<ARGBColor> convertToPARGB( [in] sequence<ColorComponent> deviceColor ) 197cdf0e10cSrcweir raises (com::sun::star::lang::IllegalArgumentException); 198cdf0e10cSrcweir 199cdf0e10cSrcweir /** Convert sRGB color to a representation in this color space.<p> 200cdf0e10cSrcweir 201cdf0e10cSrcweir If this color space conveys alpha information, it is assumed 202cdf0e10cSrcweir be fully opaque for the given rgb color value. 203cdf0e10cSrcweir 204cdf0e10cSrcweir @param deviceColor Sequence of sRGB color components. Is 205cdf0e10cSrcweir permitted to contain more than one color element, therefore, 206cdf0e10cSrcweir batch conversion of multiple color values is possible. 207cdf0e10cSrcweir 208cdf0e10cSrcweir @return the corresponding sequence of device colors. 209cdf0e10cSrcweir 210cdf0e10cSrcweir @throws a 211cdf0e10cSrcweir <type>com::sun::star::lang::IllegalArgumentException</type>, 212cdf0e10cSrcweir if the input sequence does not match the device color format. 213cdf0e10cSrcweir */ 214cdf0e10cSrcweir sequence<ColorComponent> convertFromRGB( [in] sequence<RGBColor> rgbColor ) 215cdf0e10cSrcweir raises (com::sun::star::lang::IllegalArgumentException); 216cdf0e10cSrcweir 217cdf0e10cSrcweir /** Convert sRGB color with linear alpha into this color space.<p> 218cdf0e10cSrcweir 219cdf0e10cSrcweir If this color space does not convey alpha information, the 220cdf0e10cSrcweir specified alpha value is silently ignored. 221cdf0e10cSrcweir 222cdf0e10cSrcweir @param rgbColor Sequence of sRGB color components. Is 223cdf0e10cSrcweir permitted to contain more than one color element, therefore, 224cdf0e10cSrcweir batch conversion of multiple color values is possible. 225cdf0e10cSrcweir 226cdf0e10cSrcweir @return the corresponding sequence of device colors. 227cdf0e10cSrcweir 228cdf0e10cSrcweir @throws a 229cdf0e10cSrcweir <type>com::sun::star::lang::IllegalArgumentException</type>, 230cdf0e10cSrcweir if the input sequence does not match the device color format. 231cdf0e10cSrcweir */ 232cdf0e10cSrcweir sequence<ColorComponent> convertFromARGB( [in] sequence<ARGBColor> rgbColor ) 233cdf0e10cSrcweir raises (com::sun::star::lang::IllegalArgumentException); 234cdf0e10cSrcweir 235cdf0e10cSrcweir /** Convert premultiplied sRGB color with linear alpha into this 236cdf0e10cSrcweir color space.<p> 237cdf0e10cSrcweir 238cdf0e10cSrcweir If this color space does not convey alpha information, the 239cdf0e10cSrcweir specified alpha value is silently ignored. 240cdf0e10cSrcweir 241cdf0e10cSrcweir @param rgbColor Sequence of sRGB color components. Is 242cdf0e10cSrcweir permitted to contain more than one color element, therefore, 243cdf0e10cSrcweir batch conversion of multiple color values is possible. The 244cdf0e10cSrcweir individual color values are assumed to be premultiplied by the 245cdf0e10cSrcweir alpha value. 246cdf0e10cSrcweir 247cdf0e10cSrcweir @return the corresponding sequence of device colors. 248cdf0e10cSrcweir 249cdf0e10cSrcweir @throws a 250cdf0e10cSrcweir <type>com::sun::star::lang::IllegalArgumentException</type>, 251cdf0e10cSrcweir if the input sequence does not match the device color format. 252cdf0e10cSrcweir */ 253cdf0e10cSrcweir sequence<ColorComponent> convertFromPARGB( [in] sequence<ARGBColor> rgbColor ) 254cdf0e10cSrcweir raises (com::sun::star::lang::IllegalArgumentException); 255cdf0e10cSrcweir}; 256cdf0e10cSrcweir 257cdf0e10cSrcweir}; }; }; }; 258cdf0e10cSrcweir 259cdf0e10cSrcweir#endif 260