Skia samples four points, and derives the weights for each sample by evaluating the cubic at four uniformly spaced points (based on the sub-pixel offset of the sample location). Another way of looking at this is as four cubic functions over [0,1], where each one is a disjoint section of the overall function, shifted to cover the [0,1] range:
8
Weight Functions (Range Shifted Form)
9
We can see that these four functions always sum to 1, which ensures our filter weights remain normalized:
14
15
By expanding the exponentiation of the terms passed to k0 and k1 above, and recombining the resulting expressions involving B and C over each power of x, we can derive closed form expressions for the four range-shifted cubics. k_ij below is the coefficient applied to x^j from w_i:
16
Weight Function Coefficients (Direct Form)
17
To cross-check, here are the four weight functions, in terms of the direct-form coefficients:
34
Weight Functions (Direct Form)
35
40
powered by
powered by
New Blank Graph
Examples