Porter-Duff Composition

from Wikipedia, the free encyclopedia

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 PorterDuff A.png PorterDuff A tr50.png PorterDuff A 2.png
B. only pixels from image B are displayed PorterDuff B.png PorterDuff B tr50.png PorterDuff B 2.png
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. PorterDuff AoverB.png PorterDuff AoverB tr50.png PorterDuff AoverB 2.png
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. PorterDuff BoverA.png PorterDuff BoverA tr50.png PorterDuff BoverA 2.png
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. PorterDuff AinB.png PorterDuff AinB tr50.png PorterDuff AinB 2.png
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. PorterDuff BinA.png PorterDuff BinA tr50.png PorterDuff BinA 2.png
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. PorterDuff AoutB.png PorterDuff AoutB tr50.png PorterDuff AoutB 2.png
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. PorterDuff BoutA.png PorterDuff BoutA tr50.png PorterDuff BoutA 2.png
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). PorterDuff AatopB.png PorterDuff AatopB tr50.png PorterDuff AatopB 2.png
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). PorterDuff BatopA.png PorterDuff BatopA tr50.png PorterDuff BatopA 2.png
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)). PorterDuff AxorB.png PorterDuff AxorB tr50.png PorterDuff AxorB 2.png
clear neither pixels from image A nor pixels from image B are displayed. PorterDuff Clear.png PorterDuff Clear.png PorterDuff Clear.png

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

  1. T. Porter and T. Duff - Compositing Digital Images (PDF; 750 kB) SIGGRAPH 84 (Computer Graphics Volume 18, Number 3 July 1984) pp 253-259
  2. Mike Paquette "Pixar's Porter-Duff Composition used in Quartz"
  3. API documentation of the Java Development Kit 8 of the class java.awt.AlphaComposite

Web links