56 * allow the storage of pixel data in either premultiplied or 57 * non-premultiplied form, all input data must be normalized into 58 * premultiplied form before applying the equations and all results 59 * might need to be adjusted back to the form required by the destination 60 * before the pixel values are stored. 61 * 62 * <p> 63 * Also note that this class defines only the equations 64 * for combining color and alpha values in a purely mathematical 65 * sense. The accurate application of its equations depends 66 * on the way the data is retrieved from its sources and stored 67 * in its destinations. 68 * See <a href="#caveats">Implementation Caveats</a> 69 * for further information. 70 * 71 * <p> 72 * The following factors are used in the description of the blending 73 * equation in the Porter and Duff paper: 74 * 75 * <blockquote> 76 * <table summary="layout"> 77 * <tr><th style="text-align:left">Factor <th style="text-align:left">Definition 78 * <tr><td><em>A<sub>s</sub></em><td>the alpha component of the source pixel 79 * <tr><td><em>C<sub>s</sub></em><td>a color component of the source pixel in premultiplied form 80 * <tr><td><em>A<sub>d</sub></em><td>the alpha component of the destination pixel 81 * <tr><td><em>C<sub>d</sub></em><td>a color component of the destination pixel in premultiplied form 82 * <tr><td><em>F<sub>s</sub></em><td>the fraction of the source pixel that contributes to the output 83 * <tr><td><em>F<sub>d</sub></em><td>the fraction of the destination pixel that contributes 84 * to the output 85 * <tr><td><em>A<sub>r</sub></em><td>the alpha component of the result 86 * <tr><td><em>C<sub>r</sub></em><td>a color component of the result in premultiplied form 87 * </table> 88 * </blockquote> 89 * 90 * <p> 91 * Using these factors, Porter and Duff define 12 ways of choosing 92 * the blending factors <em>F<sub>s</sub></em> and <em>F<sub>d</sub></em> to 93 * produce each of 12 desirable visual effects. 94 * The equations for determining <em>F<sub>s</sub></em> and <em>F<sub>d</sub></em> 95 * are given in the descriptions of the 12 static fields 96 * that specify visual effects. 97 * For example, 98 * the description for 99 * <a href="#SRC_OVER">{@code SRC_OVER}</a> 100 * specifies that <em>F<sub>s</sub></em> = 1 and <em>F<sub>d</sub></em> = (1-<em>A<sub>s</sub></em>). 101 * Once a set of equations for determining the blending factors is 102 * known they can then be applied to each pixel to produce a result 103 * using the following set of equations: 104 * 105 * <pre> 106 * <em>F<sub>s</sub></em> = <em>f</em>(<em>A<sub>d</sub></em>) 107 * <em>F<sub>d</sub></em> = <em>f</em>(<em>A<sub>s</sub></em>) 108 * <em>A<sub>r</sub></em> = <em>A<sub>s</sub></em>*<em>F<sub>s</sub></em> + <em>A<sub>d</sub></em>*<em>F<sub>d</sub></em> 109 * <em>C<sub>r</sub></em> = <em>C<sub>s</sub></em>*<em>F<sub>s</sub></em> + <em>C<sub>d</sub></em>*<em>F<sub>d</sub></em></pre> 110 * 111 * <p> 112 * The following factors will be used to discuss our extensions to 113 * the blending equation in the Porter and Duff paper: 114 * 115 * <blockquote> 116 * <table summary="layout"> 117 * <tr><th style="text-align:left">Factor <th style="text-align:left">Definition 118 * <tr><td><em>C<sub>sr</sub></em> <td>one of the raw color components of the source pixel 119 * <tr><td><em>C<sub>dr</sub></em> <td>one of the raw color components of the destination pixel 120 * <tr><td><em>A<sub>ac</sub></em> <td>the "extra" alpha component from the AlphaComposite instance 121 * <tr><td><em>A<sub>sr</sub></em> <td>the raw alpha component of the source pixel 122 * <tr><td><em>A<sub>dr</sub></em><td>the raw alpha component of the destination pixel 123 * <tr><td><em>A<sub>df</sub></em> <td>the final alpha component stored in the destination 124 * <tr><td><em>C<sub>df</sub></em> <td>the final raw color component stored in the destination 125 * </table> 126 *</blockquote> 127 * 128 * <h3>Preparing Inputs</h3> 129 * 130 * <p> 131 * The {@code AlphaComposite} class defines an additional alpha 132 * value that is applied to the source alpha. 133 * This value is applied as if an implicit SRC_IN rule were first 134 * applied to the source pixel against a pixel with the indicated 135 * alpha by multiplying both the raw source alpha and the raw 136 * source colors by the alpha in the {@code AlphaComposite}. | 56 * allow the storage of pixel data in either premultiplied or 57 * non-premultiplied form, all input data must be normalized into 58 * premultiplied form before applying the equations and all results 59 * might need to be adjusted back to the form required by the destination 60 * before the pixel values are stored. 61 * 62 * <p> 63 * Also note that this class defines only the equations 64 * for combining color and alpha values in a purely mathematical 65 * sense. The accurate application of its equations depends 66 * on the way the data is retrieved from its sources and stored 67 * in its destinations. 68 * See <a href="#caveats">Implementation Caveats</a> 69 * for further information. 70 * 71 * <p> 72 * The following factors are used in the description of the blending 73 * equation in the Porter and Duff paper: 74 * 75 * <blockquote> 76 * <table class="borderless"> 77 * <caption style="display:none">Factors</caption> 78 * <tr><th style="text-align:left">Factor <th style="text-align:left">Definition 79 * <tr><td><em>A<sub>s</sub></em><td>the alpha component of the source pixel 80 * <tr><td><em>C<sub>s</sub></em><td>a color component of the source pixel in premultiplied form 81 * <tr><td><em>A<sub>d</sub></em><td>the alpha component of the destination pixel 82 * <tr><td><em>C<sub>d</sub></em><td>a color component of the destination pixel in premultiplied form 83 * <tr><td><em>F<sub>s</sub></em><td>the fraction of the source pixel that contributes to the output 84 * <tr><td><em>F<sub>d</sub></em><td>the fraction of the destination pixel that contributes 85 * to the output 86 * <tr><td><em>A<sub>r</sub></em><td>the alpha component of the result 87 * <tr><td><em>C<sub>r</sub></em><td>a color component of the result in premultiplied form 88 * </table> 89 * </blockquote> 90 * 91 * <p> 92 * Using these factors, Porter and Duff define 12 ways of choosing 93 * the blending factors <em>F<sub>s</sub></em> and <em>F<sub>d</sub></em> to 94 * produce each of 12 desirable visual effects. 95 * The equations for determining <em>F<sub>s</sub></em> and <em>F<sub>d</sub></em> 96 * are given in the descriptions of the 12 static fields 97 * that specify visual effects. 98 * For example, 99 * the description for 100 * <a href="#SRC_OVER">{@code SRC_OVER}</a> 101 * specifies that <em>F<sub>s</sub></em> = 1 and <em>F<sub>d</sub></em> = (1-<em>A<sub>s</sub></em>). 102 * Once a set of equations for determining the blending factors is 103 * known they can then be applied to each pixel to produce a result 104 * using the following set of equations: 105 * 106 * <pre> 107 * <em>F<sub>s</sub></em> = <em>f</em>(<em>A<sub>d</sub></em>) 108 * <em>F<sub>d</sub></em> = <em>f</em>(<em>A<sub>s</sub></em>) 109 * <em>A<sub>r</sub></em> = <em>A<sub>s</sub></em>*<em>F<sub>s</sub></em> + <em>A<sub>d</sub></em>*<em>F<sub>d</sub></em> 110 * <em>C<sub>r</sub></em> = <em>C<sub>s</sub></em>*<em>F<sub>s</sub></em> + <em>C<sub>d</sub></em>*<em>F<sub>d</sub></em></pre> 111 * 112 * <p> 113 * The following factors will be used to discuss our extensions to 114 * the blending equation in the Porter and Duff paper: 115 * 116 * <blockquote> 117 * <table class="borderless"> 118 * <caption style="display:none">Factors</caption> 119 * <tr><th style="text-align:left">Factor <th style="text-align:left">Definition 120 * <tr><td><em>C<sub>sr</sub></em> <td>one of the raw color components of the source pixel 121 * <tr><td><em>C<sub>dr</sub></em> <td>one of the raw color components of the destination pixel 122 * <tr><td><em>A<sub>ac</sub></em> <td>the "extra" alpha component from the AlphaComposite instance 123 * <tr><td><em>A<sub>sr</sub></em> <td>the raw alpha component of the source pixel 124 * <tr><td><em>A<sub>dr</sub></em><td>the raw alpha component of the destination pixel 125 * <tr><td><em>A<sub>df</sub></em> <td>the final alpha component stored in the destination 126 * <tr><td><em>C<sub>df</sub></em> <td>the final raw color component stored in the destination 127 * </table> 128 *</blockquote> 129 * 130 * <h3>Preparing Inputs</h3> 131 * 132 * <p> 133 * The {@code AlphaComposite} class defines an additional alpha 134 * value that is applied to the source alpha. 135 * This value is applied as if an implicit SRC_IN rule were first 136 * applied to the source pixel against a pixel with the indicated 137 * alpha by multiplying both the raw source alpha and the raw 138 * source colors by the alpha in the {@code AlphaComposite}. |