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 <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Kacper Kasper
2020-06-29 14:07:42 +00:00
committed by waddlesplash
parent cc30c791bd
commit 97bd6fe8d4
23 changed files with 563 additions and 15 deletions
+201
View File
@@ -111,3 +111,204 @@
\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
*/
+4 -2
View File
@@ -2124,9 +2124,11 @@ SetViewColor(Parent()->ViewColor());
\param alphaFunc Set to one of the following:
- \c B_ALPHA_OVERLAY Used for drawing a image with transparency over an opaque
background.
- \c B_ALPHA_COMPOSITE Used to composite two or more transparent images
- \c 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.
\c B_ALPHA_OVERLAY mode.
\note Modes other than \c B_ALPHA_OVERLAY and \c B_ALPHA_COMPOSITE work
only with \c B_PIXEL_ALPHA.
\since BeOS R5
*/
Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B