Porter-Duff Composition
Porter-Duff Composition is a method of overlaying digital images. It was developed in 1984 by Thomas Porter and Tom Duff as part of the Computer Graphics Project of Lucasfilm Ltd. described.
When overlaying digital images, it must be defined what influence the overlay will have on the individual pixel. In addition to the three color channels (red, green, blue), the transparency ( alpha channel ) must also be taken into account, whereby it can be defined for each pixel how it should be displayed when it is overlaid with a pixel below or how strong the color of the pixel below shows through on the overlying pixel.
Idea and mode of operation
The method distinguishes between 12 different methods for the superposition of two pixels (A and B). In Examples 1 and 3, a transparency of 0% and an opacity of 100% are defined, i.e. H. the pixels are not transparent. In example 2, both pixel A and pixel B have a transparency of 50%.
method | description | example 1 | Example 2
(Transparency: 50%) |
Example 3 |
---|---|---|---|---|
A. | only pixels from image A are displayed |
![]() |
![]() |
![]() |
B. | only pixels from image B are displayed |
![]() |
![]() |
![]() |
A over B | Pixels from image A cover pixels from image B. If there are no pixels from image A, pixels from image B are displayed. |
![]() |
![]() |
![]() |
B over A | Pixels from image B cover pixels from image A. If there are no pixels from image B, pixels from image A are displayed. |
![]() |
![]() |
![]() |
A in B | Pixel from image A is only displayed if a pixel from image B is present. If only pixels from image A or only pixels from image B are present, then nothing (default color) is displayed. |
![]() |
![]() |
![]() |
B in A | Pixel from image B is only displayed if a pixel from image A is present. If only pixels from image A or only pixels from image B are present, then nothing (default color) is displayed. |
![]() |
![]() |
![]() |
A out B | a pixel from image A is only displayed if no pixel from image B is present. Where a pixel from image B is present, neither the pixel from image B nor the pixel from image A is displayed. |
![]() |
![]() |
![]() |
B out A | a pixel from image B is only displayed if no pixel from image A is present. Where a pixel from image A is present, neither the pixel from image A nor the pixel from image B is displayed. |
![]() |
![]() |
![]() |
A atop B | Only one pixel of image B is displayed. If there are both pixels from image A and pixels from image B, the pixel from image A overlays the pixel from image B. Where there is only one pixel from image A, nothing is displayed (default color). |
![]() |
![]() |
![]() |
B atop A | Only pixels from image A are displayed. If there are both pixels from image A and pixels from image B, the pixel from image B overlays the pixel from image A. Where there is only one pixel from image B, nothing is displayed (default color). |
![]() |
![]() |
![]() |
A xor B | XOR from pixels from image A and pixels from image B, that is, only one pixel is displayed if either a pixel from image A or a pixel from image B is present. (If there is only one pixel from image A, the pixel from image A is displayed. If only one pixel from image B is present, the pixel from image B is displayed. If both pixels are present, nothing is displayed (default color)). |
![]() |
![]() |
![]() |
clear | neither pixels from image A nor pixels from image B are displayed. |
![]() |
![]() |
![]() |
support
All modern graphics systems support the Porter-Duff method. So z. B. in Quartz , the graphics layer of the Mac OS X operating system .
The Java programming language also supports these procedures as standard.
proof
- ↑ T. Porter and T. Duff - Compositing Digital Images (PDF; 750 kB) SIGGRAPH 84 (Computer Graphics Volume 18, Number 3 July 1984) pp 253-259
- ↑ Mike Paquette "Pixar's Porter-Duff Composition used in Quartz"
- ↑ API documentation of the Java Development Kit 8 of the class java.awt.AlphaComposite
Web links
- Original work PDF, 7 pages. (732 kB)