History log of /haiku/headers/private/interface/ColorConversion.h
Revision Date Author Comments
# 9931e8ee 09-Feb-2024 nep <nep-git@packageloss.eu>

rgb_color: Add new APIs: Contrast(), IsLight(), IsDark()

- Remove perceptual_brightness
- Change implementation of rgb_color::Brightness() to the previous BPrivate::perceptual_brightness()
- Introduce convenience methods Contrast(rgb_color), IsLight() and IsDark()

Change-Id: Id677d4a32ce43d73bffecf9baf8cffaafb01a16d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7399
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 8a72ba1b 19-Dec-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Tracker: improve algorithm to decide desktop text color

Fixes #16673


# 59d0c2e4 30-Apr-2010 Stephan Aßmus <superstippi@gmx.de>

* Introduced PaletteConverter::IndexForRGBA32() which checks if the alpha
component of a 32 bit color is below 128 and returns the special CMAP8 index
for indicating transparency.
* Changed the WriteCMAP() color conversion function to expext a 32bit RGBA
value and use IndexForRGBA32().
* Adapted B_CMAP8 target color space case of ConvertBits() to the new
semantics.

This allows transparency in bitmaps when converting B_RGBA32 bitmaps to
B_CMAP8, tested only for this case and working as expected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36549 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 015943d7 30-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Use pthread_once() to guard the initialization of sPaletteConverter. This
changes the semantics slightly: Previously after a failed initialization
another invocation of InitializeDefault() could theoretically initialize the
converter. Since the only error conditions are out of memory and broken app
server connection, this shouldn't really matter, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34383 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f6e4cbb9 15-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* Rewrote BeBuild.h which had "a few" consequences (got rid of all those class
definitions).
* Minor cleanup here and there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22577 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 65e63b98 11-Oct-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

PaletteConverter now exports a static InitializeDefault() method, which
can be used (and is, by _init_interface_kit()) to initialize the ...
er... default instance of
PaletteConverter using the system color map, thus avoid building the
list of colors, which takes some time. Fixes bug #505.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22508 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bdc6f9e7 05-Mar-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed a swapping bug for 16 bit colorspaces
* Added some comments
* Added some checking to avoid noop shifts
* Added buffer length checks
* Implemented (as Stephan suggested) a version of ConvertBits() that takes offsets.
This new version allows to move a region of the source into a region (possibly not at the same point) on the dest while converting colorspaces on the fly.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16592 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b09e53fa 04-Mar-2006 Michael Lotz <mmlr@mlotz.ch>

Wrote a new color conversion engine. It's 2-5 times faster than the old one (depending on colorspaces) and about half in size.
I've put it into ColorConversion.cpp and moved PaletteConverter there too, cleaning up Bitmap.cpp.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16580 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 59d0c2e45e612140ff9a9b82ed56e02499eefe66 30-Apr-2010 Stephan Aßmus <superstippi@gmx.de>

* Introduced PaletteConverter::IndexForRGBA32() which checks if the alpha
component of a 32 bit color is below 128 and returns the special CMAP8 index
for indicating transparency.
* Changed the WriteCMAP() color conversion function to expext a 32bit RGBA
value and use IndexForRGBA32().
* Adapted B_CMAP8 target color space case of ConvertBits() to the new
semantics.

This allows transparency in bitmaps when converting B_RGBA32 bitmaps to
B_CMAP8, tested only for this case and working as expected.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36549 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 015943d78f29e326cf9d120ea52b3badab627775 30-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Use pthread_once() to guard the initialization of sPaletteConverter. This
changes the semantics slightly: Previously after a failed initialization
another invocation of InitializeDefault() could theoretically initialize the
converter. Since the only error conditions are out of memory and broken app
server connection, this shouldn't really matter, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34383 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f6e4cbb95290a74b33d012600438b84742b0e572 15-Oct-2007 Axel Dörfler <axeld@pinc-software.de>

* Rewrote BeBuild.h which had "a few" consequences (got rid of all those class
definitions).
* Minor cleanup here and there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22577 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 65e63b987dda42a7492b7f8eb68b4f71bd8134cc 11-Oct-2007 Stefano Ceccherini <stefano.ceccherini@gmail.com>

PaletteConverter now exports a static InitializeDefault() method, which
can be used (and is, by _init_interface_kit()) to initialize the ...
er... default instance of
PaletteConverter using the system color map, thus avoid building the
list of colors, which takes some time. Fixes bug #505.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22508 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bdc6f9e7ef0a4ef9c8f729c2979af0c0207fd007 05-Mar-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed a swapping bug for 16 bit colorspaces
* Added some comments
* Added some checking to avoid noop shifts
* Added buffer length checks
* Implemented (as Stephan suggested) a version of ConvertBits() that takes offsets.
This new version allows to move a region of the source into a region (possibly not at the same point) on the dest while converting colorspaces on the fly.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16592 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b09e53fae0c50ed31994c3f03d477ae2af8ab951 04-Mar-2006 Michael Lotz <mmlr@mlotz.ch>

Wrote a new color conversion engine. It's 2-5 times faster than the old one (depending on colorspaces) and about half in size.
I've put it into ColorConversion.cpp and moved PaletteConverter there too, cleaning up Bitmap.cpp.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16580 a95241bf-73f2-0310-859d-f6bbb57e9c96