Kaydet (Commit) 477d2ba6 authored tarafından Noel Grandin's avatar Noel Grandin

delete colordata.hxx

move what we still need into color.hxx

Change-Id: Ied7e31eb16468aa334c666b1499a6262f16a6350
Reviewed-on: https://gerrit.libreoffice.org/50561Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 82d42fa2
......@@ -83,7 +83,6 @@
#include <com/sun/star/awt/XView.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <osl/mutex.hxx>
#include <tools/colordata.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/component.hxx>
#include <rtl/ref.hxx>
......
......@@ -355,7 +355,6 @@
#include <toolkit/helper/convert.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/debug.hxx>
#include <tools/fldunit.hxx>
......
......@@ -546,7 +546,6 @@
#include <toolkit/dllapi.h>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
......@@ -526,7 +526,6 @@
#include <svx/xtextit0.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
......@@ -180,7 +180,6 @@
#include <o3tl/strong_int.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/fontenum.hxx>
#include <tools/gen.hxx>
......
......@@ -423,7 +423,6 @@
#include <svx/xpool.hxx>
#include <svx/xtable.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
......@@ -266,7 +266,6 @@
#include <svtools/svtdllapi.h>
#include <svtools/svtresid.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <tools/fontenum.hxx>
......
......@@ -200,7 +200,6 @@
#include <o3tl/strong_int.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/fontenum.hxx>
#include <tools/gen.hxx>
......
......@@ -156,7 +156,6 @@
#include <svtools/treelistentry.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <tools/gen.hxx>
......
......@@ -250,7 +250,6 @@
#include <svtools/svtdllapi.h>
#include <svtools/svtresid.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/fldunit.hxx>
#include <tools/fontenum.hxx>
......
......@@ -296,7 +296,6 @@
#include <svl/svldllapi.h>
#include <svtools/svtdllapi.h>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
#include <tools/debug.hxx>
......
......@@ -221,7 +221,6 @@
#include <o3tl/strong_int.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/fldunit.hxx>
#include <tools/fontenum.hxx>
......
......@@ -131,7 +131,6 @@
#include <o3tl/strong_int.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/fontenum.hxx>
#include <tools/gen.hxx>
......
......@@ -311,7 +311,6 @@
#include <toolkit/helper/mutexhelper.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/fontenum.hxx>
#include <tools/gen.hxx>
......
......@@ -329,7 +329,6 @@
#include <toolkit/helper/macros.hxx>
#include <toolkit/helper/mutexhelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/debug.hxx>
#include <tools/fldunit.hxx>
......
......@@ -39,7 +39,6 @@
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <svx/msdffdef.hxx>
#include <tools/colordata.hxx>
#include <vcl/errcode.hxx>
#include <tools/gen.hxx>
#include <tools/ref.hxx>
......
......@@ -19,39 +19,46 @@
#ifndef INCLUDED_TOOLS_COLOR_HXX
#define INCLUDED_TOOLS_COLOR_HXX
#include <sal/types.h>
#include <tools/toolsdllapi.h>
#include <tools/colordata.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <basegfx/color/bcolor.hxx>
class SvStream;
constexpr sal_uInt8 COLORDATA_RED( sal_uInt32 n ) { return static_cast<sal_uInt8>(n>>16); }
constexpr sal_uInt8 COLORDATA_GREEN( sal_uInt32 n ) { return static_cast<sal_uInt8>(static_cast<sal_uInt16>(n) >> 8); }
constexpr sal_uInt8 COLORDATA_BLUE( sal_uInt32 n ) { return static_cast<sal_uInt8>(n); }
constexpr sal_uInt8 COLORDATA_TRANSPARENCY( sal_uInt32 n ) { return static_cast<sal_uInt8>(n>>24); }
constexpr sal_uInt32 COLORDATA_RGB( sal_uInt32 n ) { return static_cast<sal_uInt32>(n & 0x00FFFFFF); }
// Color
class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Color final
{
ColorData mnColor;
sal_uInt32 mnColor;
public:
constexpr Color()
: mnColor(0) // black
{}
constexpr Color(ColorData nColor)
constexpr Color(sal_uInt32 nColor)
: mnColor(nColor)
{}
constexpr Color(sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
: mnColor(RGB_COLORDATA(nRed, nGreen, nBlue))
{}
constexpr Color(sal_uInt8 nTransparency, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
: mnColor(TRGB_COLORDATA(nTransparency, nRed, nGreen, nBlue))
: mnColor( sal_uInt32(nBlue) | (sal_uInt32(nGreen) << 8) | (sal_uInt32(nRed) << 16)
| (sal_uInt32(nTransparency) << 24) )
{}
constexpr Color(sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
: Color(0, nRed, nGreen, nBlue)
{}
// constructor to create a tools-Color from ::basegfx::BColor
explicit Color(const basegfx::BColor& rBColor)
: mnColor(RGB_COLORDATA(sal_uInt8((rBColor.getRed() * 255.0) + 0.5),
sal_uInt8((rBColor.getGreen() * 255.0) + 0.5),
sal_uInt8((rBColor.getBlue() * 255.0) + 0.5)))
: Color(0,
sal_uInt8((rBColor.getRed() * 255.0) + 0.5),
sal_uInt8((rBColor.getGreen() * 255.0) + 0.5),
sal_uInt8((rBColor.getBlue() * 255.0) + 0.5))
{}
/** Primarily used when passing Color objects to UNO API */
......@@ -91,7 +98,7 @@ public:
return COLORDATA_TRANSPARENCY(mnColor);
}
ColorData GetColor() const
sal_uInt32 GetColor() const
{
return mnColor;
}
......@@ -198,6 +205,11 @@ inline sal_uInt8 Color::GetLuminance() const
COLORDATA_RED(mnColor) * 76UL) >> 8);
}
constexpr sal_uInt8 ColorChannelMerge(sal_uInt8 nDst, sal_uInt8 nSrc, sal_uInt8 nSrcTrans)
{
return static_cast<sal_uInt8>(((static_cast<sal_Int32>(nDst)-nSrc)*nSrcTrans+((nSrc<<8)|nDst))>>8);
};
inline void Color::Merge( const Color& rMergeColor, sal_uInt8 cTransparency )
{
SetRed(ColorChannelMerge(COLORDATA_RED(mnColor), COLORDATA_RED(rMergeColor.mnColor), cTransparency));
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_TOOLS_COLORDATA_HXX
#define INCLUDED_TOOLS_COLORDATA_HXX
#include <sal/types.h>
// Color types
typedef sal_uInt32 ColorData;
constexpr ColorData TRGB_COLORDATA(
sal_uInt8 TRANSPARENCE, sal_uInt8 RED, sal_uInt8 GREEN, sal_uInt8 BLUE)
{
return sal_uInt32(BLUE) | (sal_uInt32(GREEN) << 8) | (sal_uInt32(RED) << 16)
| (sal_uInt32(TRANSPARENCE) << 24);
}
constexpr ColorData RGB_COLORDATA(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b) {
return sal_uInt32(b) | (sal_uInt32(g) << 8) | (sal_uInt32(r) << 16);
}
#define COLORDATA_RED( n ) (static_cast<sal_uInt8>((n)>>16))
#define COLORDATA_GREEN( n ) (static_cast<sal_uInt8>((static_cast<sal_uInt16>(n)) >> 8))
#define COLORDATA_BLUE( n ) (static_cast<sal_uInt8>(n))
#define COLORDATA_TRANSPARENCY( n ) (static_cast<sal_uInt8>((n)>>24))
#define COLORDATA_RGB( n ) (static_cast<ColorData>((n) & 0x00FFFFFF))
constexpr sal_uInt8 ColorChannelMerge(sal_uInt8 nDst, sal_uInt8 nSrc, sal_uInt8 nSrcTrans)
{
return static_cast<sal_uInt8>(((static_cast<sal_Int32>(nDst)-nSrc)*nSrcTrans+((nSrc<<8)|nDst))>>8);
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -1680,7 +1680,7 @@ static const GdkRGBA& getDarkColor(int nViewId, LOKDocViewPrivate& priv)
}
else
{
// Based on tools/colordata.hxx, COL_AUTHOR1_DARK..COL_AUTHOR9_DARK.
// Based on tools/color.hxx, COL_AUTHOR1_DARK..COL_AUTHOR9_DARK.
static std::vector<GdkRGBA> aColors =
{
{(double(198))/255, (double(146))/255, (double(0))/255, 0},
......
......@@ -192,7 +192,6 @@
#include <svx/msdffdef.hxx>
#include <svx/svxdllapi.h>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/gen.hxx>
#include <tools/lineend.hxx>
......
......@@ -321,7 +321,6 @@
#include <svx/xpoly.hxx>
#include <svx/xtable.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
......@@ -540,7 +540,6 @@
#include <toolkit/helper/convert.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
......@@ -384,7 +384,7 @@ namespace rptui
aArgs[1].Value <<= VCLUnoHelper::GetInterface(this);
aArgs[2].Name = PROPERTY_FONTCOLOR;
aArgs[2].Value <<= static_cast<sal_uInt32>(rColor.GetColor());
aArgs[2].Value <<= rColor;
// we use this way to create undo actions
m_rController.executeUnChecked(_nCommandId,aArgs);
......
......@@ -580,7 +580,6 @@
#include <tokenstringcontext.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
......@@ -302,7 +302,6 @@
#include <tokenarray.hxx>
#include <tokenuno.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
#include <tools/debug.hxx>
......
......@@ -51,7 +51,6 @@
#include <comphelper/processfactory.hxx>
#include <i18nlangtag/lang.h>
#include <vcl/outdev.hxx>
#include <tools/colordata.hxx>
#include <tools/fontenum.hxx>
#include <stylesbuffer.hxx>
......
......@@ -523,7 +523,6 @@
#include <textapi.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
......
......@@ -544,7 +544,6 @@
#include <svx/xtable.hxx>
#include <svx/xtextit0.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
......@@ -249,7 +249,6 @@
#include <o3tl/strong_int.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <tools/fldunit.hxx>
......
......@@ -7767,7 +7767,6 @@ include/toolkit/helper/vclunohelper.hxx
include/tools/b3dtrans.hxx
include/tools/bigint.hxx
include/tools/color.hxx
include/tools/colordata.hxx
include/tools/config.hxx
include/tools/contnr.hxx
include/tools/cpuid.hxx
......
......@@ -125,7 +125,6 @@
#include <svx/svxdllapi.h>
#include <symbol.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/gen.hxx>
#include <tools/link.hxx>
......
......@@ -397,7 +397,6 @@
#include <toolkit/helper/convert.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
#include <tools/debug.hxx>
......
......@@ -441,7 +441,6 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/bigint.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
#include <tools/debug.hxx>
......
......@@ -657,7 +657,6 @@
#include <swtypes.hxx>
#include <tblsel.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
......@@ -531,7 +531,6 @@
#include <tgrditem.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
#include <tools/datetimeutils.hxx>
......
......@@ -638,7 +638,6 @@
#include <tblenum.hxx>
#include <tblsel.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
......@@ -433,7 +433,6 @@
#include <tblenum.hxx>
#include <tblsel.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
......
......@@ -2009,7 +2009,7 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat,
const sal_uInt16 nCstScale = 635; // unit scale between AOO and MS Word
const sal_uInt32 nShadowType = 131074; // shadow type of ms word. need to set the default value.
sal_uInt32 nColor = static_cast<sal_uInt32>(pSI->GetColor().GetColor()) ;
sal_uInt32 nColor = sal_uInt32(pSI->GetColor());
sal_Int32 nOffX = pSI->GetWidth() * nCstScale;
sal_Int32 nOffY = pSI->GetWidth() * nCstScale;
......
......@@ -232,7 +232,6 @@
#include <svtools/svtdllapi.h>
#include <svtools/svtresid.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/debug.hxx>
#include <tools/fontenum.hxx>
#include <tools/gen.hxx>
......
......@@ -278,7 +278,6 @@
#include <svl/svldllapi.h>
#include <test/outputdevice.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/date.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
......
......@@ -96,7 +96,6 @@
#include <ooxml/resourceids.hxx>
#include <sfx2/dllapi.h>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/gen.hxx>
#include <tools/solar.h>
#include <tools/toolsdllapi.h>
......
......@@ -15,7 +15,6 @@
#include <i18nlangtag/languagetag.hxx>
#include <osl/thread.h>
#include <rtl/tencinfo.h>
#include <tools/colordata.hxx>
#include <tools/mapunit.hxx>
#include <ooxml/resourceids.hxx>
......
......@@ -314,7 +314,6 @@
#include <svtools/treelistentries.hxx>
#include <svtools/viewdataentry.hxx>
#include <tools/color.hxx>
#include <tools/colordata.hxx>
#include <tools/contnr.hxx>
#include <tools/date.hxx>
#include <tools/datetime.hxx>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment