From 5bcddad4eb90ce0070db1714ccacb6d4c72e631b Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Sun, 18 Aug 2019 15:28:52 +0200 Subject: [PATCH] docs: update alpha docs --- docs/Glossary-static.html | 11 ++++------- ...a-static.html => UnifiedAlpha-static.html} | 19 ++++++++++++++++--- docs/index-static.html.in | 2 +- docs/meson.build | 7 +++---- docs/toc | 2 +- 5 files changed, 25 insertions(+), 16 deletions(-) rename docs/{SymmetricAlpha-static.html => UnifiedAlpha-static.html} (84%) diff --git a/docs/Glossary-static.html b/docs/Glossary-static.html index 7d7364d..7f91b77 100644 --- a/docs/Glossary-static.html +++ b/docs/Glossary-static.html @@ -39,7 +39,7 @@ keep the vocabulary small.

own associated alpha. This representation is useful for avoiding color from empty pixels bleeding into surroundings. It is also able to represent emittance in addition to opacity. -Babl uses Symmetric alpha transformations between separate alpha and associated alpha. +Babl uses Unified alpha transformations between separate alpha and associated alpha.
BablFish
@@ -72,16 +72,13 @@ relevant spaces - the ICC profile for the space.
Luminance
The photometric measure of luminious intensity of per unit area of light. The luminance in babl is proportional to luminance - though it doesn't use the SI unit of candela per square meter.
-
Non-associated alpha
-
deprecated term, see separate alpha
-
Premultiplied alpha
deprecated term, see associated alpha
-
Separate alpha
-
This representation of pixels has alpha as a fully separate component, +
Straight alpha
+
Straight or separate alpha has alpha as a fully separate component, that can be adjusted without affecting the color. -Babl uses Symmetric alpha transformations between separate and associated alpha.
+Babl uses symetric alpha transformations between straight and associated alpha.
TRC
diff --git a/docs/SymmetricAlpha-static.html b/docs/UnifiedAlpha-static.html similarity index 84% rename from docs/SymmetricAlpha-static.html rename to docs/UnifiedAlpha-static.html index 959f0db..9b94806 100644 --- a/docs/SymmetricAlpha-static.html +++ b/docs/UnifiedAlpha-static.html @@ -6,7 +6,7 @@ --> - Symmetric Alpha - babl + Unified Alpha - babl @@ -68,14 +68,27 @@ associated_to_separate_rgba (const float *associated_rgba, float *separate_rgba) { float alpha = associated_rgba[3]; - float clamped_alpha = babl_epsilon_for_zero_float (alpha); - float reciprocal_alpha = 1.0f / clamped_alpha; + float reciprocal_alpha = 1.0f / babl_epsilon_for_zero_float (alpha); separate_rgba[0] = associated_rgba[0] * reciprocal_alpha; separate_rgba[1] = associated_rgba[1] * reciprocal_alpha; separate_rgba[2] = associated_rgba[2] * reciprocal_alpha; separate_rgba[3] = alpha; } + + +static inline void +separate_to_associated_rgba (const float *separate_rgba, + float *associated_rgba) +{ + float alpha = associated_rgba[3]; + float limited_alpha = babl_epsilon_for_zero_float (alpha); + + associated_rgba[0] = separate_rgba[0] * limited_alpha; + associated_rgba[1] = separate_rgba[1] * limited_alpha; + associated_rgba[2] = separate_rgba[2] * limited_alpha; + associated_rgba[3] = alpha; +} diff --git a/docs/index-static.html.in b/docs/index-static.html.in index df131f1..92a9c9b 100644 --- a/docs/index-static.html.in +++ b/docs/index-static.html.in @@ -55,7 +55,7 @@
  • Runtime profiling/validating and code-path optimizing with persistence of profiling data across runs, with caching of results.
  • Can load Color Spaces from ICC v2 and v4 profiles containing RGB matrix + TRC and with lcms2 dependency also CMYK profiles.
  • -
  • Uses Symmetric Alpha conversions for conversions between separate and associate alpha, avoiding loss of color fidelity due to asymptotic behavior near alpha 0.0 in floating point.
  • +
  • Uses Unified Alpha conversions for conversions between separate and associate alpha, avoiding loss of color fidelity due to asymptotic behavior when dividing by 0.0 in floating point.
  • Portable self contained C code working on win32, linux, bsds and mac on 32bit and 64bit systems.
  • Stable, small API, with singleton objects returned.
  • diff --git a/docs/meson.build b/docs/meson.build index d085b80..01b6c30 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -130,12 +130,12 @@ ColorManagement_html = custom_target('ColorManagement.html', build_by_default: true, ) -SymmetricAlpha_html = custom_target('SymmetricAlpha.html', +UnifiedAlpha_html = custom_target('UnifiedAlpha.html', input : [ - 'SymmetricAlpha-static.html', + 'UnifiedAlpha-static.html', 'toc', ], - output: [ 'SymmetricAlpha.html', ], + output: [ 'UnifiedAlpha.html', ], command: [ env_bin, 'cp', '@INPUT0@', '@OUTPUT@', @@ -144,7 +144,6 @@ SymmetricAlpha_html = custom_target('SymmetricAlpha.html', build_by_default: true, ) - run_target('push_web', command: [ 'scp', index_html, index_static_html, babl_css, scptarget, diff --git a/docs/toc b/docs/toc index ec3685a..ffbf61d 100644 --- a/docs/toc +++ b/docs/toc @@ -8,7 +8,7 @@
  •   Reference
  •   Glossary
  •   Color Management
  • -
  •   Symmetric-Alpha
  • +
  •   Unified-Alpha
  •   CMYK
  •   Usage
  • -- 2.30.2