History log of /haiku/headers/os/interface/GraphicsDefs.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>


# bb187c91 15-Sep-2021 Jérôme Duval <jerome.duval@gmail.com>

interface: add colorspaces support for RGB48 and RGBA64

these colorspaces are packed as RGB or RGBA, not BGR or BGRA.
RGB48_BIG and RGBA64 only differ in the endianess of the channel the 2-byte value.

this is a big difference with RGB24_BIG and RGBA32_BIG, in which case _BIG
means the order is RGB (BGR) and not BGR (BGRA).
BGR48, BGRA64 could indeed be added, if needed.

I chose 0x11 and 0x12 arbitrarily, but given the order of channels 0x1011
and 0x1012 might make more sense. This would mean using another bit for "real"
bigendian colorspaces.

Only the color conversion to 32-bits is implemented.

Tested with the RAWTranslator modified to output 16bpp with success.

Found some references in enum AVPixelFormat in libavutil/pixfmt.h.

Change-Id: I4b023dec85d01f1e63e1b053139e5bb5d263a0e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4468
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 97bd6fe8 19-Jun-2020 Kacper Kasper <kacperkasper@gmail.com>

app_server: Implement more composition modes

* Use agg::comp_op classes to blend pixels.
* Subpixel path not implemented.
* Needed by WebKit.
* Implements #10274.

Change-Id: I07b0002196fd0a05fc100bd9f6d703c33cadc85b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2932
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 764c402a 02-Dec-2017 Augustin Cavalier <waddlesplash@gmail.com>

GraphicsDefs: Revert back to casting structs to integers to compare them.

This reverts commit d3abf525c5f0ba0260a11649eb439a4e4730d39d.
Clang's warning was a little overzealous; this is not a problem on x86.


# d3abf525 01-Dec-2017 Augustin Cavalier <waddlesplash@gmail.com>

GraphicsDefs: Do not cast structs to integers to compare them.

That requires more padding (1 byte vs 4 or 8 depending on integer size),
so just use regular loops and chained ==s.

Caught by Clang. No functional change intended.


# 7f9368ca 09-Dec-2015 looncraz <looncraz@looncraz.net>

Set*UIColor, etc.

The inseparable changes necessary to support live color updating across the
system in a sane, safe, and performant manner.

BView gains:

HasSystemColors()
HasDefaultColors()
AdoptSystemColors()
AdoptParentColors()
AdoptViewColor(BView*)
SetViewUIColor(color_which, float tint)
SetHighUIColor(...
SetLowUIColor(...
ViewUIColor(float* tint)
HighUIColor(...
LowUIColor(...
DelayedInvalidate()

BWindow gains a simple helper method:
IsOffscreenWindow()

BMessage gains:

AddColor()
FindColor()
GetColor()
HasColor() * allegedly this API is deprecated, but I implemented it anyway
ReplaceColor()
SetColor()

Previous private ColorTools methods are made public and moved into GraphicsDefs:

mix_color, blend_color, disable_color

These are fully compatible with BeOS dan0 R5.1 methods and are just code cleanup
of BeOS example code under the OpenTracker license.

In addition, four new colors are created:
B_LINK_TEXT_COLOR
B_LINK_HOVER_COLOR
B_LINK_ACTIVE_COLOR
B_LINK_VISITED_COLOR

These changes are documented in their proper user documentation files.

In addition, due to a history rewrite, B_FOLLOW_LEFT_TOP has been defined and
used in lieu of B_FOLLOW_TOP | B_FOLLOW_LEFT and is included in this commit.

On the app_server side, the following has changed:

Add DelayedMessage - a system by which messages can be sent at a scheduled time,
and can also be merged according to set rules. A single thread is used to service the
message queue and multiple recipients can be set for each message.
Desktop gains the ability to add message ports to a DelayedMessage so that
said messages can target either all applications or all windows, as needed.

Desktop maintains a BMessage which is used to queue up all pending color changes
and the delayed messaging system is used to enact these changes after a short
period of time has passed. This prevents abuse and allows the system to merge
repeated set_ui_color events into one event for client applications, improving
performance drastically.

In addition, B_COLORS_UPDATED is sent to the BApplication, which forwards the message
to each BWindow. This is done to improve performance over having the app_server
independently informing each window.

Decorator changes are live now, which required some reworking.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# e94bd481 02-Sep-2014 Adrien Destugues <pulkomandy@gmail.com>

Fix "strict aliasing rules" warnings

Treated as errors when trying to build the test_app_server for x86_64.


# 69001466 12-Jan-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

interface: Clean up public headers; No functional change.

* Whitespace / Tab cleanup
* Better document color space
* Let me know if anything looks wrong


# 75a6d1db 26-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Optimized includes. For example, BeBuild.h is almost always already included
via SupportDefs.h.


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


# 89208c77 27-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Finished unifying the Interface Kit headers:
* Fixed copyrights (puncuation and capitalization, removed authors from
headers)
* Updated indentation style
* Unified pointer/reference style
* Re-ordered some methods for better grouping where it could be done
(abd adopted source accordingly)
* Small coding style fixes here and there

No functional change intended.

+alphabranch


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


# f81fb0e5 26-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

80 chars/line

+ alphabranch


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


# 6cd1b6f7 03-Jun-2008 Rene Gollent <anevilyak@gmail.com>

Fix GCC4 build.



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


# 6ec21b4a 03-Jun-2008 Axel Dörfler <axeld@pinc-software.de>

* Implemented retrieving additional bitmap support flags by the app_server.
* Added B_BITMAPS_SUPPORT_OVERLAY flag to indicate overlay support for the
color space.
* Rewrote GraphicsDefs.h - the previous one was obvious a copy of the Be header,
including typos and strange white space. I was a bit lazy with respect to
the color space details, and mostly trusted the information provided by the
Be header else.


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


# f6d52cb7 29-Feb-2008 Rene Gollent <anevilyak@gmail.com>

- Added operator = implementation to rgb_color for convenience.
- Major cleanup of Appearance prefs - colors are now dynamically
read from the app_server, and updating them also works, but
triggers a bug: the state of the current window somehow gets
confused, i.e. if I update the panel background color, for some
reason the color of the BButtons in the appearance pref change color
and also the textviews begin misbehaving. Have not yet tracked down
the cause of this, but newly created windows after making the change
do show up with the updated color and behave properly. Also vastly
simplified the pref and cleaned up some obsolete definitions.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24185 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


# cd0ea6ff 17-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Added some of the rgb_color methods from Dano/Zeta.
* The private general_info structure is now setup - that fixes a part of bug #502;
NetPositive's bar remains black, though.


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


# 758b1d0e 12-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
Otherwise the an inner class with that name is considered as friend.
gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



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


# 09852109 29-Mar-2005 Stephan Aßmus <superstippi@gmx.de>

added this very useful compare function

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


# 9551dd1c 14-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Added rgb_color == and != operators - inline only.


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


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


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


# e94bd4810ebb840710f01074399cc79113f9bc7a 02-Sep-2014 Adrien Destugues <pulkomandy@gmail.com>

Fix "strict aliasing rules" warnings

Treated as errors when trying to build the test_app_server for x86_64.


# 69001466e234f527d0cd7f27a80c9fcf1931cab3 12-Jan-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

interface: Clean up public headers; No functional change.

* Whitespace / Tab cleanup
* Better document color space
* Let me know if anything looks wrong


# 75a6d1db99fe8ea432c7ff8d80cfc095710d02f5 26-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Optimized includes. For example, BeBuild.h is almost always already included
via SupportDefs.h.


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


# 89208c77f10235d43fda0c7b3fd6751db02cc12c 27-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

Finished unifying the Interface Kit headers:
* Fixed copyrights (puncuation and capitalization, removed authors from
headers)
* Updated indentation style
* Unified pointer/reference style
* Re-ordered some methods for better grouping where it could be done
(abd adopted source accordingly)
* Small coding style fixes here and there

No functional change intended.

+alphabranch


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


# f81fb0e5f649a485d6fb51a4c6a329c9b371455f 26-Aug-2009 Stephan Aßmus <superstippi@gmx.de>

80 chars/line

+ alphabranch


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


# 6cd1b6f737f15591770e08e8bf50ae817dca8b5e 03-Jun-2008 Rene Gollent <anevilyak@gmail.com>

Fix GCC4 build.



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


# 6ec21b4ad380a417f21835299ebb928b8f39a806 03-Jun-2008 Axel Dörfler <axeld@pinc-software.de>

* Implemented retrieving additional bitmap support flags by the app_server.
* Added B_BITMAPS_SUPPORT_OVERLAY flag to indicate overlay support for the
color space.
* Rewrote GraphicsDefs.h - the previous one was obvious a copy of the Be header,
including typos and strange white space. I was a bit lazy with respect to
the color space details, and mostly trusted the information provided by the
Be header else.


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


# f6d52cb737f40a71b861fbb95d43e5fa04cf4fbc 29-Feb-2008 Rene Gollent <anevilyak@gmail.com>

- Added operator = implementation to rgb_color for convenience.
- Major cleanup of Appearance prefs - colors are now dynamically
read from the app_server, and updating them also works, but
triggers a bug: the state of the current window somehow gets
confused, i.e. if I update the panel background color, for some
reason the color of the BButtons in the appearance pref change color
and also the textviews begin misbehaving. Have not yet tracked down
the cause of this, but newly created windows after making the change
do show up with the updated color and behave properly. Also vastly
simplified the pref and cleaned up some obsolete definitions.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24185 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


# cd0ea6ff0fe476f59da696583d5a0daaa7c42596 17-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

* Added some of the rgb_color methods from Dano/Zeta.
* The private general_info structure is now setup - that fixes a part of bug #502;
NetPositive's bar remains black, though.


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


# 758b1d0e05fe1042cce6e00d194a147802d4f9be 12-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
Otherwise the an inner class with that name is considered as friend.
gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



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


# 098521096905e8bb8c5ef0f88ed147f5a199b660 29-Mar-2005 Stephan Aßmus <superstippi@gmx.de>

added this very useful compare function

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


# 9551dd1cd357138c4972800091e083055208d383 14-Jan-2005 Axel Dörfler <axeld@pinc-software.de>

Added rgb_color == and != operators - inline only.


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


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


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