Changeset View
Changeset View
Standalone View
Standalone View
io_curve_svg/import_svg.py
| Show First 20 Lines • Show All 878 Lines • ▼ Show 20 Lines | def parse(self): | ||||
| while not self._data.eof(): | while not self._data.eof(): | ||||
| code = self._data.next() | code = self._data.next() | ||||
| cmd = self._commands.get(code) | cmd = self._commands.get(code) | ||||
| if cmd is None: | if cmd is None: | ||||
| raise Exception('Unknown path command: {0}' . format(code)) | raise Exception('Unknown path command: {0}' . format(code)) | ||||
| if cmd in {'Z', 'z'}: | if code in {'Z', 'z'}: | ||||
| closed = True | closed = True | ||||
| else: | else: | ||||
| closed = False | closed = False | ||||
| if code in {'M', 'm'} and self._use_fill and not closed: | |||||
| self._pathClose('z') # Ensure closed before MoveTo path command | |||||
| cmd(code) | cmd(code) | ||||
| if self._use_fill and not closed: | if self._use_fill and not closed: | ||||
| self._pathClose('z') | self._pathClose('z') # Ensure closed at the end of parsing | ||||
| def getSplines(self): | def getSplines(self): | ||||
| """ | """ | ||||
| Get splines definitions | Get splines definitions | ||||
| """ | """ | ||||
| return self._splines | return self._splines | ||||
| ▲ Show 20 Lines • Show All 984 Lines • Show Last 20 Lines | |||||