xref: /trunk/main/cppcanvas/source/wrapper/implcolor.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*25b11142SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*25b11142SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*25b11142SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*25b11142SAndrew Rist  * distributed with this work for additional information
6*25b11142SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*25b11142SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*25b11142SAndrew Rist  * "License"); you may not use this file except in compliance
9*25b11142SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*25b11142SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*25b11142SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*25b11142SAndrew Rist  * software distributed under the License is distributed on an
15*25b11142SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*25b11142SAndrew Rist  * KIND, either express or implied.  See the License for the
17*25b11142SAndrew Rist  * specific language governing permissions and limitations
18*25b11142SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*25b11142SAndrew Rist  *************************************************************/
21*25b11142SAndrew Rist 
22*25b11142SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cppcanvas.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <implcolor.hxx>
28cdf0e10cSrcweir #include <tools.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir using namespace ::com::sun::star;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace cppcanvas
33cdf0e10cSrcweir {
34cdf0e10cSrcweir     namespace internal
35cdf0e10cSrcweir     {
36cdf0e10cSrcweir 
ImplColor(const uno::Reference<rendering::XGraphicDevice> & rDevice)37cdf0e10cSrcweir         ImplColor::ImplColor( const uno::Reference< rendering::XGraphicDevice >& rDevice ) :
38cdf0e10cSrcweir             mxDevice( rDevice )
39cdf0e10cSrcweir         {
40cdf0e10cSrcweir             OSL_ENSURE( mxDevice.is(), "ImplColor::ImplColor(): Invalid graphic device" );
41cdf0e10cSrcweir         }
42cdf0e10cSrcweir 
~ImplColor()43cdf0e10cSrcweir         ImplColor::~ImplColor()
44cdf0e10cSrcweir         {
45cdf0e10cSrcweir         }
46cdf0e10cSrcweir 
getIntSRGBA(uno::Sequence<double> & rDeviceColor) const47cdf0e10cSrcweir         Color::IntSRGBA ImplColor::getIntSRGBA( uno::Sequence< double >& rDeviceColor ) const
48cdf0e10cSrcweir         {
49cdf0e10cSrcweir             OSL_ENSURE( mxDevice.is(), "ImplColor::getIntSRGBA(): Invalid graphic device" );
50cdf0e10cSrcweir 
51cdf0e10cSrcweir             // TODO(F1): Color space handling
52cdf0e10cSrcweir             return tools::doubleSequenceToIntSRGBA( mxDevice, rDeviceColor );
53cdf0e10cSrcweir         }
54cdf0e10cSrcweir 
getDeviceColor(Color::IntSRGBA aSRGBA) const55cdf0e10cSrcweir         uno::Sequence< double > ImplColor::getDeviceColor( Color::IntSRGBA aSRGBA ) const
56cdf0e10cSrcweir         {
57cdf0e10cSrcweir             OSL_ENSURE( mxDevice.is(), "ImplColor::getDeviceColor(): Invalid graphic device" );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir             // TODO(F1): Color space handling
60cdf0e10cSrcweir             return tools::intSRGBAToDoubleSequence( mxDevice, aSRGBA );
61cdf0e10cSrcweir         }
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     }
64cdf0e10cSrcweir }
65