summaryrefslogtreecommitdiffstats
path: root/include/tools/color.hxx
Commit message (Collapse)AuthorAgeFilesLines
* Switch everyone to stricter GetColorErrorJan-Marek Glogowski2019-05-141-1/+9
| | | | | | | | | | | This replaces the variant in Color with the stricter one of BitmapColor. I couldn't find any reasoning for the lazy variant used in Color. Change-Id: I6dab3ab94a7f24ef5e80299d64267e3be8df888c Reviewed-on: https://gerrit.libreoffice.org/72234 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
* Make BitmapColor inherit from / merge into ColorJan-Marek Glogowski2019-05-131-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BitmapColor itself is kept to distingish the Color usage as part of a color palette, which continues to store the offset in the blue value. The original special mbIndex handling is long gone since commit 1fefdd6f3b41 ("Alpha channel in BitmapColor - change bIndex to alpha"), so there is no data difference. This also results in the following changes: * now has a basic_ostream<charT, traits>& operator<< (that was my actual starting point... for an other bug fix) * there is a minimal difference for GetLiminance BGR(29,151,76) => BGR(28,151,77) * no more return values for Merge and Invert (previously returning *this) * replaces all GetBlueOrIndex with GetIndex This leaves one "problematic" part: the GetColorError handling. At first glance it should probably be virtual. The Color variant is less strict then the BitmapColor one - for whatever reason. BitmapColor is always used to search for the best match in a Palette. Currently I'm simply leaving both variants. Would be nice to have an explict for functions here. Change-Id: I251ba3024a1d60f2a9d9fde9cd0a60f08e8322a7 Reviewed-on: https://gerrit.libreoffice.org/72181 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
* Decouple reading/writing of Color into GenericTypeSerializerTomaž Vajngerl2019-04-271-6/+0
| | | | | | | | | | | | | | | | This adds GenericTypeSerializer, which is now responsible of serializing the Color into a stream (other types will follow), but only for the older version of the binary format. The new version we just write the sal_UInt32 mValue directly. This is a start of decoupling the serialization of generic types in tools and vcl module from the actual type, so we can in the future replace those with basegfx variant. Change-Id: I92738e7c178cac5cbca882dcbe45c80cc8269466 Reviewed-on: https://gerrit.libreoffice.org/71404 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
* cleanup and rename COLORDATA_RGB to color::extractRGBTomaž Vajngerl2019-04-221-5/+13
| | | | | | | Change-Id: I8d53c7010b4fea2a74e48f0649e944a498c211c7 Reviewed-on: https://gerrit.libreoffice.org/71003 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
* Replace compile time test with a static_assertTomaž Vajngerl2019-04-221-0/+5
| | | | | | | | | | | | | | | | | | | | | | There is no need to check this in a test when we can do it directly in the header. static_assert will complain when compiling something that uses the header file instead of waiting that it finds a piece of code, where it is actually needed. The purpose of the test was the same (fail early). The main problem was that Color can be created and converted to sal_uInt32 string completely in compile time, so it can be used for "case" in a "switch" statement, which requires that in "case" it uses a constant. Normally this isn't possible unless we resolve and convert a Color to sal_uInt32 in compile time. This use-case is used somewhere in the code, but it takes a lot of (re)compiling to get to that piece of code, where it would eventually fail. Change-Id: I1f1f9b77c19a0e61f78ce703b380d98a569da833 Reviewed-on: https://gerrit.libreoffice.org/71060 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
* rework Color to have R,G,B,A public variablesTomaž Vajngerl2019-04-211-38/+47
| | | | | | | | | | | | | | | | | Color is a wrapper around a sal_uInt32 variable. With a union, separate channels R, G, B, A sal_uInt8 variables can be added that occupy the same memory. This makes it much easier to access each color component separately, which is used quite a lot by various algorithms. This also adds the variables to public so everyone can enjoy the benefits. Tests have been extended to make sure this doesn't break the existing algroithms. Change-Id: I2e78e12df68e8c7f0f49420eef5e659b335ee397 Reviewed-on: https://gerrit.libreoffice.org/71002 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
* tdf#108751 Show currently selected color name in color button tooltipJim Raykowski2018-10-271-2/+0
| | | | | | | | | | | Based on Heiko Tietze's work in I26f0500527d2b86049948ca64e636e1ff566f262 Change-Id: I20541dd6ad155a39c0f87361088b44923406064f Reviewed-on: https://gerrit.libreoffice.org/61815 Tested-by: Jenkins Reviewed-by: Heiko Tietze <tietze.heiko@gmail.com> Tested-by: Heiko Tietze <tietze.heiko@gmail.com>
* drop getColor() method of ColorNoel Grandin2018-03-091-5/+1
| | | | | | | | | no longer necessary Change-Id: I9e0fcea1134e8c5e27f9effbb5eb79fe5446e33d Reviewed-on: https://gerrit.libreoffice.org/50925 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* delete colordata.hxxNoel Grandin2018-03-021-11/+23
| | | | | | | | | move what we still need into color.hxx Change-Id: Ied7e31eb16468aa334c666b1499a6262f16a6350 Reviewed-on: https://gerrit.libreoffice.org/50561 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* make Color::GetRGBColor return Color instead of ColorDataNoel Grandin2018-03-011-1/+1
| | | | | | | Change-Id: I532959a7103c3857510f26ecce2f942d676a233b Reviewed-on: https://gerrit.libreoffice.org/50487 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* convert COL_ constants to be of type ColorNoel Grandin2018-02-281-1/+54
| | | | | | | Change-Id: I0e25c8950ac26b851ff42f71e1471fcbe4770d48 Reviewed-on: https://gerrit.libreoffice.org/50373 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
* use less RGB_COLORDATANoel Grandin2018-02-261-1/+1
| | | | | | | | | part of removing ColorData Change-Id: If31b5b88545529863377e9a178f45f4516bf6cbb Reviewed-on: https://gerrit.libreoffice.org/50345 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
* ColorData->Color in scNoel Grandin2018-02-221-1/+1
| | | | | | | | | | and fix the sal_Int32() conversion operator in Color, which was always returning 0 Change-Id: I0aefaedc34ee0a8bccd43238ccfe8196d2dd5c5c Reviewed-on: https://gerrit.libreoffice.org/50051 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* create uno::Any overrides for ColorNoel Grandin2018-02-201-5/+38
| | | | | | | | | | | And use less ColorData in writerfilter and xmloff. part of removing ColorData. Change-Id: Ia1c57bf837ae814e7642cf1c7de2eb7ada7a1500 Reviewed-on: https://gerrit.libreoffice.org/50028 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
* drop Color::SetColor(ColorData) in favour of operator=Noel Grandin2018-02-201-4/+0
| | | | | | | | | first stage of getting rid of ColorData Change-Id: I5e4e95eb958722814c43c8d1ebfef17ad18c29ec Reviewed-on: https://gerrit.libreoffice.org/49997 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
* More loplugin:cstylecast: toolsStephan Bergmann2018-01-121-3/+3
| | | | | | | | auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Ifb9ebc9623c8df14ea0d4c907001bd16c5b9ae59
* convert COLOR_CHANNEL_MERGE to constexpr functionNoel Grandin2018-01-091-3/+3
| | | | | | | Change-Id: Ie46e0a47b433517b0bae0deabb447ff5c1000f22 Reviewed-on: https://gerrit.libreoffice.org/47595 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* loplugin:finalclasses in toolkit,toolsNoel Grandin2017-10-201-2/+1
| | | | | | | Change-Id: I365d9a5057b35bf0441ac8fbfef4447a25652760 Reviewed-on: https://gerrit.libreoffice.org/43601 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* remove UL/L suffixes from shift-by-constant expressionsNoel Grandin2017-08-171-1/+1
| | | | | | | Change-Id: Ia470f643e3eefeccc14183133603db260460bd53 Reviewed-on: https://gerrit.libreoffice.org/41212 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
* drop loading Colors from src filesCaolán McNamara2016-10-061-3/+0
| | | | Change-Id: I43f2fda133371a1284a53beeeb774552210c7e3f
* tools: split out color macros into own headerChris Sherlock2016-03-181-62/+1
| | | | Change-Id: Ib983601d60a3dae1e738bb385dfbb36094bdb064
* loplugin:unuseddefaultparam in toolsNoel Grandin2016-03-011-2/+2
| | | | Change-Id: I2a974ba76566700c2037fcb38de3ecfea9d2651d
* tdf#87933 - Easier visibility of automatic page breaks.akki952016-01-251-0/+2
| | | | | | | | | | | Defined additional named colors COL_GRAY3 and COL_gray7 in color.hxx Fixed the color scheme as required. Change-Id: Ia86acb2465d0978d08518f0a146df5574cc8fafc Reviewed-on: https://gerrit.libreoffice.org/21742 Reviewed-by: jan iversen <jani@documentfoundation.org> Tested-by: jan iversen <jani@documentfoundation.org>
* Fix order of SAL_WARN_UNUSED and DLLPUBLIC for clang-clStephan Bergmann2015-12-101-1/+1
| | | | | | | | | | | | ...which, somewhat arbitrarily, expects GNU extension __attribute__((...)) to come before MSVC extension __declspec(...) with MaybeParseGNUAttributes(attrs); MaybeParseMicrosoftDeclSpecs(attrs); in Parser::ParseClassSpecifier (lib/Parse/ParseDeclCXX.cpp). Change-Id: I5936558c8fc08b278575b6c678cde6eccd4647fb
* this farcical staroffice 5.0 related junk can at least be constCaolán McNamara2015-08-271-1/+1
| | | | Change-Id: I096d98f6e0cb61cacd9cd82a623f832b88ded1e6
* Again add ability to change tint/shade of a color + unit testTomaž Vajngerl2015-08-271-0/+10
| | | | Change-Id: I4c06290f09e5bfecd2c1de896e19cb5036a3a0e9
* callcatcher: update unused codeCaolán McNamara2015-05-251-10/+0
| | | | Change-Id: I735264eb32ebdd165d23a4717f0329f666b8b140
* Add ability to change tint/shade of a color.Tomaž Vajngerl2015-05-071-0/+10
| | | | Change-Id: I6933393732d23fe9386cb8b768676887c026bd39
* cleanup tools/color.hxxTomaž Vajngerl2015-04-211-69/+101
| | | | Change-Id: I7d8f263f9ccb1ea4f230d7a2df4d88c408b3a5da
* related tdf#89004 move to std:set instead of std::vectorUrsache Vladimir2015-02-141-0/+5
| | | | | | | | Conflicts: sc/source/core/data/document10.cxx sw/source/core/doc/docfmt.cxx Change-Id: I1312f476607ea3a78b162a7e59323b0a142f6629
* Mark Color::AsRGBHexString() as constMiklos Vajna2014-11-191-1/+1
| | | | Change-Id: Idf00e228c480afe2bbbb64682ed01f2c778b6d9d
* tools: add AsRGBHexString to Color + unit testTomaž Vajngerl2014-05-151-0/+4
| | | | | | | AsRGBHexString returns the Color as a RGB hex string. For example "00ff00" for green color. Change-Id: Ia95c7f9eb6d9aefc3ca989046fa8d76b7b7f9e8f
* consistent percent sign in commentsThomas Arnhold2014-05-061-2/+2
| | | | Change-Id: I9906b4e58fd8672e51f6aa2e56ec68bb28772500
* fdo#63154 Remove unused solar.h ref. in toolsAlexandre Vicenzi2014-02-201-1/+0
| | | | | | | Change-Id: Iedcf030178c4bf875db01ba6b1f5202dae18bca2 Reviewed-on: https://gerrit.libreoffice.org/8134 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
* convert specialised SvStream::operator>> methods to ReadXXX methodsNoel Grandin2014-02-041-1/+1
| | | | | | | | | | as preparation for converting the SvStream::operator>> methods on primitive types Change-Id: I62f134bced15c687d6e0d46924f56e8d1c3d95b9 Reviewed-on: https://gerrit.libreoffice.org/7798 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
* convert SvStream::operator<< overloads to more explicit methodsNoel Grandin2014-01-161-1/+1
| | | | | | | | | This is in preparation for more conversion of SvStream::operator<< calls to use more explicit method names. This converts the subclasses that have their own convenience overloads of operator<< to use normal methods. Change-Id: I5efd5d9a24c264cb86d2471303dd5849bf91ba80
* fdo#65108 inter-module includes <> include/toolsNorbert Thiebaud2013-11-091-1/+1
| | | | Change-Id: I5f44f041e465230d10d562e8bd6f141848465e07
* fixincludeguards.sh: include/{toolkit,tools}Thomas Arnhold2013-10-231-2/+2
| | | | Change-Id: I5572c320431222be2405f8c2dc8adeafe4f3828b
* Clean String and sal_Bool in toolsNorbert Thiebaud2013-06-301-10/+10
| | | | | | | Change-Id: I6a92196f33d7a5278c7dcc426112e9c56d582655 Reviewed-on: https://gerrit.libreoffice.org/4627 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
* execute move of global headersBjoern Michaelsen2013-04-231-0/+215
see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a