Create a new composite transform that is the result of applying transform a then transform b. Shortcut versions of the blended transform are provided for the case where both child transforms are affine, or one or the other is the identity transform. Composite transforms ma
(a, b)
| 2556 | |
| 2557 | |
| 2558 | def composite_transform_factory(a, b): |
| 2559 | """ |
| 2560 | Create a new composite transform that is the result of applying |
| 2561 | transform a then transform b. |
| 2562 | |
| 2563 | Shortcut versions of the blended transform are provided for the |
| 2564 | case where both child transforms are affine, or one or the other |
| 2565 | is the identity transform. |
| 2566 | |
| 2567 | Composite transforms may also be created using the '+' operator, |
| 2568 | e.g.:: |
| 2569 | |
| 2570 | c = a + b |
| 2571 | """ |
| 2572 | # check to see if any of a or b are IdentityTransforms. We use |
| 2573 | # isinstance here to guarantee that the transforms will *always* |
| 2574 | # be IdentityTransforms. Since TransformWrappers are mutable, |
| 2575 | # use of equality here would be wrong. |
| 2576 | if isinstance(a, IdentityTransform): |
| 2577 | return b |
| 2578 | elif isinstance(b, IdentityTransform): |
| 2579 | return a |
| 2580 | elif isinstance(a, Affine2D) and isinstance(b, Affine2D): |
| 2581 | return CompositeAffine2D(a, b) |
| 2582 | return CompositeGenericTransform(a, b) |
| 2583 | |
| 2584 | |
| 2585 | class BboxTransform(Affine2DBase): |
no test coverage detected
searching dependent graphs…