add unbuildPaintSweepGradient

This commit is contained in:
Cosimo Lupo 2021-02-04 12:16:29 +00:00
parent 22d290b06e
commit e20ccfcf9f
No known key found for this signature in database
GPG Key ID: 179A8F0895A02F4F
2 changed files with 31 additions and 1 deletions

View File

@ -113,6 +113,18 @@ class LayerV1ListUnbuilder:
"r1": r1, "r1": r1,
} }
def unbuildPaintSweepGradient(self, paint):
return {
"format": int(ot.Paint.Format.PaintSweepGradient),
"colorLine": unbuildColorLine(
paint.ColorLine, ignoreVarIdx=self.ignoreVarIdx
),
"centerX": self.unbuildVariableValue(paint.centerX),
"centerY": self.unbuildVariableValue(paint.centerY),
"startAngle": self.unbuildVariableValue(paint.startAngle),
"endAngle": self.unbuildVariableValue(paint.endAngle),
}
def unbuildPaintGlyph(self, paint): def unbuildPaintGlyph(self, paint):
return { return {
"format": int(ot.Paint.Format.PaintGlyph), "format": int(ot.Paint.Format.PaintGlyph),

View File

@ -103,7 +103,25 @@ TEST_COLOR_GLYPHS = {
}, },
}, },
}, },
"glyph00015": [ "glyph00015": {
"format": int(ot.Paint.Format.PaintGlyph),
"glyph": "glyph00011",
"paint": {
"format": int(ot.Paint.Format.PaintSweepGradient),
"colorLine": {
"stops": [
{"offset": 0.0, "paletteIndex": 3, "alpha": 1.0},
{"offset": 1.0, "paletteIndex": 5, "alpha": 1.0},
],
"extend": "pad",
},
"centerX": 259,
"centerY": 300,
"startAngle": 45.0,
"endAngle": 135.0,
},
},
"glyph00016": [
{ {
"format": int(ot.Paint.Format.PaintGlyph), "format": int(ot.Paint.Format.PaintGlyph),
"glyph": "glyph00011", "glyph": "glyph00011",