97bd6fe8d4
* 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>
315 lines
6.0 KiB
Plaintext
315 lines
6.0 KiB
Plaintext
/*
|
|
* Copyright 2013 Haiku, Inc. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Authors:
|
|
* John Scipione, jscipione@gmail.com
|
|
*
|
|
* Corresponds to:
|
|
* headers/os/interface/GraphicsDefs.h hrev45737
|
|
* src/kits/interface/GraphicsDefs.cpp hrev45737
|
|
*/
|
|
|
|
|
|
/*!
|
|
\file GraphicsDefs.h
|
|
\ingroup interface
|
|
\ingroup libbe
|
|
\brief Graphics-related functions and variables used by the Interface Kit.
|
|
*/
|
|
|
|
|
|
/*!
|
|
\struct pattern
|
|
\ingroup interface
|
|
\ingroup libbe
|
|
\brief A pattern to use when drawing.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var B_SOLID_HIGH
|
|
|
|
Draw using the view's high color.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var B_MIXED_COLORS
|
|
|
|
Draw a pattern of the view's high and low colors.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var B_SOLID_LOW
|
|
|
|
Draw using the view's low color.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\enum source_alpha
|
|
\ingroup interface
|
|
|
|
Blending alpha mode constants.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var source_alpha B_PIXEL_ALPHA
|
|
|
|
Use the alpha value of each pixel when drawing a bitmap.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var source_alpha B_CONSTANT_ALPHA
|
|
|
|
Use the alpha channel of the view's high color.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\enum alpha_function
|
|
\ingroup interface
|
|
|
|
Blending alpha function constants.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_OVERLAY
|
|
|
|
Used for drawing a image with transparency over an opaque background.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE
|
|
|
|
Used to composite two or more transparent images together offscreen to
|
|
produce a new image drawn using \c B_ALPHA_OVERLAY mode.
|
|
|
|
\since BeOS R3
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_SOURCE_OVER
|
|
|
|
Draws source over destination preserving transparency. Same as
|
|
\c B_ALPHA_COMPOSITE.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE_OVER.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_SOURCE_IN
|
|
|
|
Draws source only where destination is not transparent.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE_IN.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_SOURCE_OUT
|
|
|
|
Draws source only where destination is transparent.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE_OUT.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_SOURCE_ATOP
|
|
|
|
Draws source only where destination is not transparent. Colors from both
|
|
are used in the result.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE_ATOP.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_DESTINATION_OVER
|
|
|
|
Draws source where destination is transparent, making it appear as if it
|
|
is drawn behind.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION_OVER.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_DESTINATION_IN
|
|
|
|
Blends source alpha channel with destination.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION_IN.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_DESTINATION_OUT
|
|
|
|
Blends inverse of source alpha channel with destination. Result appears as
|
|
if source was cut out of destination.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION_OUT.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_DESTINATION_ATOP
|
|
|
|
Draws source only where it is not transparent. Destination is blended on
|
|
top of it. Colors from both are used in the result.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION_ATOP.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_XOR
|
|
|
|
Result is transparent only where both source and destination are transparent
|
|
or opaque.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_XOR.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_CLEAR
|
|
|
|
Erases destination to full transparency, regardless of source alpha value.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_CLEAR.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_DIFFERENCE
|
|
|
|
Subtracts both inputs in a way that always yields positive result.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_DIFFERENCE.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_LIGHTEN
|
|
|
|
Retains lighter pixels of both inputs.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_LIGHTEN.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|
|
|
|
|
|
/*!
|
|
\var alpha_function B_ALPHA_COMPOSITE_DARKEN
|
|
|
|
Retains darker pixels of both inputs.
|
|
|
|
\image{inline} html B_ALPHA_COMPOSITE_SOURCE.png "Source"
|
|
->
|
|
\image{inline} html B_ALPHA_COMPOSITE_DESTINATION.png "Destination"
|
|
=
|
|
\image{inline} html B_ALPHA_COMPOSITE_DARKEN.png "Result"
|
|
|
|
\since Haiku R1
|
|
*/
|