rename radial gradient Paint.Affine attribute to Transform

as suggested by Peter Constable in
https://github.com/PeterConstable/OT_Drafts/blob/master/COLR_V1/COLRv1formats_rev3.md#paintformat3-table-conicalradial-gradient
This commit is contained in:
Cosimo Lupo 2020-07-02 12:21:12 +01:00
parent ac0a755d20
commit ff79338607
No known key found for this signature in database
GPG Key ID: 179A8F0895A02F4F
4 changed files with 12 additions and 12 deletions

View File

@ -423,7 +423,7 @@ def buildRadialGradientPaint(
c1: _PointTuple,
r0: _ScalarInput,
r1: _ScalarInput,
affine: Optional[_AffineInput] = None,
transform: Optional[_AffineInput] = None,
) -> ot.Paint:
self = ot.Paint()
@ -435,9 +435,9 @@ def buildRadialGradientPaint(
setattr(self, f"y{i}", _to_variable_int(y))
setattr(self, f"r{i}", _to_variable_int(r))
if affine is not None and not isinstance(affine, ot.Affine2x2):
affine = buildAffine2x2(*affine)
self.Affine = affine
if transform is not None and not isinstance(transform, ot.Affine2x2):
transform = buildAffine2x2(*transform)
self.Transform = transform
return self

View File

@ -1640,6 +1640,6 @@ otData = [
('VarInt16', 'x1', None, None, ''),
('VarInt16', 'y1', None, None, ''),
('VarUInt16', 'r1', None, None, ''),
('LOffsetTo(Affine2x2)', 'Affine', None, None, 'Offset (from beginning of Paint table) to Affine2x2 subtable.'),
('LOffsetTo(Affine2x2)', 'Transform', None, None, 'Offset (from beginning of Paint table) to Affine2x2 subtable.'),
]),
]

View File

@ -337,7 +337,7 @@ def test_buildRadialGradientPaint():
assert (gradient.x1, gradient.y1) == c1
assert gradient.r0 == r0
assert gradient.r1 == r1
assert gradient.Affine is None
assert gradient.Transform is None
gradient = builder.buildRadialGradientPaint({"stops": color_stops}, c0, c1, r0, r1)
assert gradient.ColorLine.Extend == builder.ExtendMode.PAD
@ -345,14 +345,14 @@ def test_buildRadialGradientPaint():
matrix = builder.buildAffine2x2(2.0, 0.0, 0.0, 2.0)
gradient = builder.buildRadialGradientPaint(
color_line, c0, c1, r0, r1, affine=matrix
color_line, c0, c1, r0, r1, transform=matrix
)
assert gradient.Affine == matrix
assert gradient.Transform == matrix
gradient = builder.buildRadialGradientPaint(
color_line, c0, c1, r0, r1, affine=(2.0, 0.0, 0.0, 2.0)
color_line, c0, c1, r0, r1, transform=(2.0, 0.0, 0.0, 2.0)
)
assert gradient.Affine == matrix
assert gradient.Transform == matrix
def test_buildLayerV1Record():

View File

@ -268,12 +268,12 @@ COLR_V1_XML = [
' <x1 value="10"/>',
' <y1 value="11"/>',
' <r1 value="12"/>',
" <Affine>",
" <Transform>",
' <xx value="-13.0"/>',
' <xy value="14.0"/>',
' <yx value="15.0"/>',
' <yy value="-17.0"/>',
" </Affine>",
" </Transform>",
" </Paint>",
" </LayerV1Record>",
" </LayerV1List>",