Function ts_from_line_to_line

Source
fn ts_from_line_to_line(
    src1: Point,
    src2: Point,
    dst1: Point,
    dst2: Point,
) -> Affine
Expand description

Calculates the transform necessary to map the line spanned by points src1, src2 to the line spanned by dst1, dst2.

This creates a transformation that maps any line segment to any other line segment. For gradients, we use this to transform the gradient line to a standard form (0,0) → (1,0).

Copied from https://github.com/linebender/tiny-skia/blob/68b198a7210a6bbf752b43d6bc4db62445730313/src/shaders/radial_gradient.rs#L182