summaryrefslogtreecommitdiff
path: root/include/tools/color.hxx
AgeCommit message (Collapse)Author
2020-11-21Changes to the color classdante
Before colors could be only converted to string rrggbb. Now also supports RRGGBB. It can also be converted back into a color. Change-Id: Ifb89d554b434c243c4f0956ee680ec23de823339 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106224 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-11Fix typoAndrea Gelmini
Change-Id: Ie75e42e278a32d3a4130ec65a1ed05265fbc6f91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105599 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-11-11Improved starmath colordante
Color.hxx has now documentation ( even if it is quite obvious if you know RGB standar ). Color.hxx has been reordered in more coherent order, but kept format. Some changes on Color.hxx dynamics. Color.hxx starmath colors list Now colors are managed by starmathdatabse. The path is open for simple addition of colors, there are no more infinite switches with color tokens here and there. To add a color, just put it in Color.hxx and register it in starmathdatabse.cxx. Do not forget to change array size in starmathdatabase.hxx. Now mathml supports RGB colors in #RRGGBB format ( import and export ). New colors have been added. Only the HTML Css1 are available via UI. New colors will be added. I intend to finish Css2 and dvipsnames ( latex colors ) on posterior patches. RGBA command has been unlocked for compatibility reasons. However will be displayed as RGB. Added color #RRGGBB. Improved qa color test on mathml to test RGB on mathml. TODO for someone on the UI team: - Add a color picker. - If it is a color with name: - It will add in the code "color " + starmathdatabase::Identify_Color_DVIPSNAMES( colorvalue ).pIdent +" " - If not: - It will add in the code "color " + starmathdatabase::Identify_Color_DVIPSNAMES( colorvalue ).pIdent +" "+ colorvalue.getRed() +" "+ colorvalue.getGreen() +" "+ colorvalue.getBlue() +" " - Note that those will habe eType with value TRGB or TRGBA. Change-Id: I47af37bd191b3099e8e6e08e7a5fb1a8a227bbf2 Change-Id: If971473ddcc34739439818dba9a62ca3494a4473 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-03use more compact namespace syntax in /includeNoel Grandin
excluding the UDK headers of course Change-Id: Iac7ab83d60265f7d362c860776f1de9d5e444ec0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93268 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-22tdf#42949 Simplify use of rtl::math::approxEqual in include/basegfx/Gabor Kelemen
Turns out we can save about 500Mb of preprocessor input if we use rtl_math_approxEqual from rtl/math.h instead of its C++ wrapper rtl::math::approxEqual from rtl/math.hxx and manage the fallout accordingly. Before: bin/includebloat.awk | head sum total bytes included (excluding system headers): 19017296671 After: $ bin/includebloat.awk | head sum total bytes included (excluding system headers): 18535432672 Change-Id: I1691171f3a309405a7099882ad9989d147f59118 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92508 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-02-24workaround GCC 9.2.1 -Og -Werror=maybe-uninitializedMichael Stahl
vcl/unx/generic/gdi/salbmp.cxx:727:32: error: ‘pixmapHandle’ may be used uninitialized in this function [-Werror=maybe-uninitialized] vcl/unx/gtk3/gtk3gtkinst.cxx:7336:16: error: ‘eRet’ may be used uninitialized in this function [-Werror=maybe-uninitialized] etc. One looks like it might occur in practice. Change-Id: I09af7d36b134b31cb7bd8047b5c73f4a49c9d9b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89351 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2019-11-17cid#1455745 Not restoring ostream formatCaolán McNamara
Change-Id: Ie5b73bca282a279a0318e42499d44f19822b1554 Reviewed-on: https://gerrit.libreoffice.org/83017 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-05-14Switch everyone to stricter GetColorErrorJan-Marek Glogowski
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>
2019-05-13Make BitmapColor inherit from / merge into ColorJan-Marek Glogowski
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>
2019-04-27Decouple reading/writing of Color into GenericTypeSerializerTomaž Vajngerl
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>
2019-04-22cleanup and rename COLORDATA_RGB to color::extractRGBTomaž Vajngerl
Change-Id: I8d53c7010b4fea2a74e48f0649e944a498c211c7 Reviewed-on: https://gerrit.libreoffice.org/71003 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-22Replace compile time test with a static_assertTomaž Vajngerl
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>
2019-04-21rework Color to have R,G,B,A public variablesTomaž Vajngerl
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>
2018-10-27tdf#108751 Show currently selected color name in color button tooltipJim Raykowski
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>
2018-03-09drop getColor() method of ColorNoel Grandin
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>
2018-03-02delete colordata.hxxNoel Grandin
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>
2018-03-01make Color::GetRGBColor return Color instead of ColorDataNoel Grandin
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>
2018-02-28convert COL_ constants to be of type ColorNoel Grandin
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>
2018-02-26use less RGB_COLORDATANoel Grandin
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>
2018-02-22ColorData->Color in scNoel Grandin
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>
2018-02-20create uno::Any overrides for ColorNoel Grandin
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>
2018-02-20drop Color::SetColor(ColorData) in favour of operator=Noel Grandin
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>
2018-01-12More loplugin:cstylecast: toolsStephan Bergmann
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
2018-01-09convert COLOR_CHANNEL_MERGE to constexpr functionNoel Grandin
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>
2017-10-20loplugin:finalclasses in toolkit,toolsNoel Grandin
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>
2017-08-17remove UL/L suffixes from shift-by-constant expressionsNoel Grandin
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>
2016-10-06drop loading Colors from src filesCaolán McNamara
Change-Id: I43f2fda133371a1284a53beeeb774552210c7e3f
2016-03-18tools: split out color macros into own headerChris Sherlock
Change-Id: Ib983601d60a3dae1e738bb385dfbb36094bdb064
2016-03-01loplugin:unuseddefaultparam in toolsNoel Grandin
Change-Id: I2a974ba76566700c2037fcb38de3ecfea9d2651d
2016-01-25tdf#87933 - Easier visibility of automatic page breaks.akki95
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>
2015-12-10Fix order of SAL_WARN_UNUSED and DLLPUBLIC for clang-clStephan Bergmann
...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
2015-08-27this farcical staroffice 5.0 related junk can at least be constCaolán McNamara
Change-Id: I096d98f6e0cb61cacd9cd82a623f832b88ded1e6
2015-08-27Again add ability to change tint/shade of a color + unit testTomaž Vajngerl
Change-Id: I4c06290f09e5bfecd2c1de896e19cb5036a3a0e9
2015-05-25callcatcher: update unused codeCaolán McNamara
Change-Id: I735264eb32ebdd165d23a4717f0329f666b8b140
2015-05-07Add ability to change tint/shade of a color.Tomaž Vajngerl
Change-Id: I6933393732d23fe9386cb8b768676887c026bd39
2015-04-21cleanup tools/color.hxxTomaž Vajngerl
Change-Id: I7d8f263f9ccb1ea4f230d7a2df4d88c408b3a5da
2015-02-14related tdf#89004 move to std:set instead of std::vectorUrsache Vladimir
Conflicts: sc/source/core/data/document10.cxx sw/source/core/doc/docfmt.cxx Change-Id: I1312f476607ea3a78b162a7e59323b0a142f6629
2014-11-19Mark Color::AsRGBHexString() as constMiklos Vajna
Change-Id: Idf00e228c480afe2bbbb64682ed01f2c778b6d9d
2014-05-15tools: add AsRGBHexString to Color + unit testTomaž Vajngerl
AsRGBHexString returns the Color as a RGB hex string. For example "00ff00" for green color. Change-Id: Ia95c7f9eb6d9aefc3ca989046fa8d76b7b7f9e8f
2014-05-06consistent percent sign in commentsThomas Arnhold
Change-Id: I9906b4e58fd8672e51f6aa2e56ec68bb28772500
2014-02-20fdo#63154 Remove unused solar.h ref. in toolsAlexandre Vicenzi
Change-Id: Iedcf030178c4bf875db01ba6b1f5202dae18bca2 Reviewed-on: https://gerrit.libreoffice.org/8134 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2014-02-04convert specialised SvStream::operator>> methods to ReadXXX methodsNoel Grandin
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>
2014-01-16convert SvStream::operator<< overloads to more explicit methodsNoel Grandin
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
2013-11-09fdo#65108 inter-module includes <> include/toolsNorbert Thiebaud
Change-Id: I5f44f041e465230d10d562e8bd6f141848465e07
2013-10-23fixincludeguards.sh: include/{toolkit,tools}Thomas Arnhold
Change-Id: I5572c320431222be2405f8c2dc8adeafe4f3828b
2013-06-30Clean String and sal_Bool in toolsNorbert Thiebaud
Change-Id: I6a92196f33d7a5278c7dcc426112e9c56d582655 Reviewed-on: https://gerrit.libreoffice.org/4627 Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
2013-04-23execute move of global headersBjoern Michaelsen
see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a