2010-10-14 01:27:31 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-03-18 03:41:15 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 04:17:04 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-03-18 03:41:15 -06:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-03-18 03:41:15 -06:00
|
|
|
*
|
2008-04-11 04:17:04 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-03-18 03:41:15 -06:00
|
|
|
*
|
2008-04-11 04:17:04 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-03-18 03:41:15 -06:00
|
|
|
*
|
2008-04-11 04:17:04 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2004-03-18 03:41:15 -06:00
|
|
|
*
|
2008-04-11 04:17:04 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2004-03-18 03:41:15 -06:00
|
|
|
*
|
2008-04-11 04:17:04 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2004-03-18 03:41:15 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 06:51:00 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_cppcanvas.hxx"
|
|
|
|
|
2004-11-26 13:58:21 -06:00
|
|
|
#include <tools.hxx>
|
2004-03-18 03:41:15 -06:00
|
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
namespace cppcanvas
|
|
|
|
{
|
|
|
|
namespace tools
|
|
|
|
{
|
2006-10-12 09:00:54 -05:00
|
|
|
uno::Sequence< double > intSRGBAToDoubleSequence( const uno::Reference< rendering::XGraphicDevice >&,
|
|
|
|
Color::IntSRGBA aColor )
|
2004-03-18 03:41:15 -06:00
|
|
|
{
|
|
|
|
uno::Sequence< double > aRes( 4 );
|
|
|
|
|
2004-11-26 13:58:21 -06:00
|
|
|
aRes[0] = getRed(aColor) / 255.0;
|
|
|
|
aRes[1] = getGreen(aColor) / 255.0;
|
|
|
|
aRes[2] = getBlue(aColor) / 255.0;
|
|
|
|
aRes[3] = getAlpha(aColor) / 255.0;
|
2004-03-18 03:41:15 -06:00
|
|
|
|
|
|
|
return aRes;
|
|
|
|
}
|
|
|
|
|
2006-10-12 09:00:54 -05:00
|
|
|
Color::IntSRGBA doubleSequenceToIntSRGBA( const uno::Reference< rendering::XGraphicDevice >&,
|
|
|
|
const uno::Sequence< double >& rColor )
|
2004-03-18 03:41:15 -06:00
|
|
|
{
|
2004-11-26 13:58:21 -06:00
|
|
|
return makeColor( static_cast<sal_uInt8>( 255*rColor[0] + .5 ),
|
|
|
|
static_cast<sal_uInt8>( 255*rColor[1] + .5 ),
|
|
|
|
static_cast<sal_uInt8>( 255*rColor[2] + .5 ),
|
|
|
|
static_cast<sal_uInt8>( 255*rColor[3] + .5 ) );
|
2004-03-18 03:41:15 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-14 01:27:31 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|