User:Spitzak/sandbox

From Wikipedia, the free encyclopedia
«

fooiMMM

Alpha Compositing[edit]

https://printtechnologies.org/wp-content/uploads/2020/03/pdf-reference-1.6-addendum-blend-modes.pdf

Color C = f(Aa, Bb)ab + YA(1 - b) + ZB(1 - a)

Alpha c = Xab + Ya(1 - b) + Zb(1 - a)

X is almost always equal to f(1,1), the only exceptions here are the PDF definition of Difference and Exclusion.

Y and Z are either 0 or 1, depending on whether you get transparent or the other image when one image is transparent. Some compositing libraries have options to force one or the other to 1 or 0 in all cases.

In non-premultiplied colors, the function is as follows:

Color C = f(A, B)ab + YA(a - ab) + ZB(b - ab)/ Xab + Ya(1 - b) + Zb(1 - a)

Color C = (f(A, B) - YA - ZB)ab + YAa + ZBb/ (X - Y - Z)ab + Ya + Zb

f X Y Z C c alternative names, notes
Porter-Duff paper
Clear 0 0 0 0 0 0
Src A 1 1 0 A a Copy
Dst B 1 0 1 B b No-op, None
SrcOver A 1 1 1 A + B(1 - a) a + b - ab Over
DstOver B 1 1 1 B + A(1 - b) a + b - ab Under
SrcIn A 1 0 0 Ab ab
DstIn B 1 0 0 Ba ab
SrcOut 0 0 1 0 A(1 - b) a(1 - b)
DstOut 0 0 0 1 B(1 - a) b(1 - a) Erase
SrcAtop A 1 0 1 Ab + B(1 - a) b In, Above
DstAtop B 1 1 0 Ba + A(1 - b) a Below
Xor 0 0 1 1 A(1 - b) + B(1 - a) a + b - 2ab
Plus A + B 2 1 1 A + B a + b Add, Lighter
OpenGL
Saturate mix of A + B and B 2 1 1 A min (1, 1 - b/a) + B a + b
PDF, SVG
Screen A + B - AB 1 1 1 A + B - AB a + b - ab Scrn
Multiply AB 1 1 1 AB + A(1 - b) + B(1 - a) a + b - ab PDF spec
1 0 0 AB ab Vector Multiply
Overlay B < ½ ? 2AB : 2(A + B - AB) - 1 1 1 1 A + B + (2B < b ? 2AB - Ab - Ba : Ab + Ba - 2AB - ab) a + b - ab reverse HardLight
Lighten max (A, B) 1 1 1 A + B - min (Ab, Ba)[a] a + b - ab
Darken min (A, B) 1 1 1 A + B - max (Ab, Ba)[a] a + b - ab PDF spec
1 0 0 min (Ab, Ba)[a] ab closer to min(A,B)
ColorDodge B/1 - A 1 1 1 Ba2/a - A + A(1 - b) + B(1 - a) a + b - ab
ColorBurn 1 - 1 - B/A 1 1 1 ab - b - B/Aa2 + A(1 - b) + B(1 - a) a + b - ab
HardLight A < ½ ? 2AB : 2(A + B - AB) - 1 1 1 1 A + B + (2A < a ? 2AB - Ab - Ba : Ab + Ba - 2AB - ab) a + b - ab reverse Overlay
SoftLight B + (2A - 1)(A < ½ ? B - B2 :
B < ¼ ? 16B3 - 12B2 + 3B :
B - B)
1 1 1 B + (2A - a)(2A < a ? B - B2b :
4B < b ? 16B3b2 - 12B2b + 3B :
Bb - B) + A(1 - b)
a + b - ab
Difference |A - B| 1 1 1 A + B - 2 min (Ab, Ba) a + b - ab PDF spec
0 1 1 a + b - 2ab X = f(1,1) = 0
Exclusion A + B - 2AB 1 1 1 A + B - 2AB a + b - ab PDF spec
0 1 1 a + b - 2ab X = f(1,1) = 0
Hue Hue of A, Sat + Lum of B 1 1 1 (not shown) a + b - ab
Saturation Sat of A, Hue + Lum of B 1 1 1
Color Hue + Sat of A, Lum of B 1 1 1
Luminosity Lum of A, Hue + Sat of B 1 1 1
  1. ^ a b c max(A,B) and min(A,B) are not correct for premultiplied colors.

Character set[edit]

ISO-8859-1
0 1 2 3 4 5 6 7 8 9 A B C D E F
0x NUL
0000
SOH STX
1AFE
ETX EOT ENQ ACK BEL  BS   HT   LF   VT   FF   CR   SO   SI 
1x DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN  EM  SUB ESC  FS   GS   RS   US 
2x  SP  ! " # $ % & ' ( ) * + , - . /
3x 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4x @ A
1AFE
B C D
0044
E F G H I J K L M N O
5x P Q R S T U V W X Y Z [ \ ] ^ _
6x ` a b c d e f g h i j k l m n o
7x p q r s t u v w x y z { | } ~ DEL
8x PAD HOP BPH NBH  IND NEL SSA ESA HTS HTJ VTS PLD PLU  RI   SS2 SS3
9x DCS PU1 PU2 STS CCH MW SPA EPA SOS SGC SCI  CSI   ST  OSC  PM  APC
Ax NBSP ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ SHY ® ¯
Bx ° ± ² ³ ´ µ · ¸ ¹ º » ¼ ½ ¾ ¿
Cx À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï
Dx Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß
Ex à á â ã ä å æ ç è é ê ë ì í î ï
Fx ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý[a] þ ÿ
  Lead byte
  Changed or added in 1963 version
  Changed in both 1963 version and 1965 draft
  Another legend
  unused
  1. ^ y with acute

examples[edit]

  • samp: M M
  • lang: M
  • var: M
  • Unichar: U+004D M LATIN CAPITAL LETTER M
  • kbd: M M
  • code: M M
  • char (current): M
  • char (box): M
  • char (serif): M
  • xt: M
  • bxt: M
  • mxt: M
  • xtd: M
  • xtn: M
  • strongbad: M