Much better
This commit is contained in:
parent
e18688495f
commit
12606cbdd7
1 changed files with 45 additions and 40 deletions
|
@ -32,7 +32,6 @@ class Path():
|
|||
def draw(self, cr: cairo.Context):
|
||||
for item in self.commands:
|
||||
command, args = item
|
||||
fn = fns[command]
|
||||
|
||||
if command == 'M':
|
||||
for arg in args:
|
||||
|
@ -58,48 +57,54 @@ class Path():
|
|||
elif command == 'v':
|
||||
for arg in args:
|
||||
self.rel_vert_to(cr, arg)
|
||||
elif command == 'Z':
|
||||
elif command == 'C':
|
||||
for arg in args:
|
||||
cr.curve_to(*arg)
|
||||
elif command == 'c':
|
||||
for arg in args:
|
||||
cr.rel_curve_to(*arg)
|
||||
elif command == 'Z' or command == 'z':
|
||||
cr.close_path()
|
||||
|
||||
class HexagonPattern():
|
||||
class HexagonPattern(Path):
|
||||
COMMANDS = (
|
||||
('M', ((23.246093, 0), (0, 13.382812))),
|
||||
('V', (44.689453,)),
|
||||
('L', ((0.0839844, 44.640625),
|
||||
(24.033203, 58.505859),
|
||||
(24.001953, 86.332031),
|
||||
(22.841796, 87))),
|
||||
('h', (4.478516,)),
|
||||
('L', ((26.068359, 86.275391),
|
||||
(26.099609, 58.449219),
|
||||
(50.083984, 44.640625),
|
||||
(74.033203, 58.505859),
|
||||
(74.001953, 86.332031),
|
||||
(72.841796, 87))),
|
||||
('h', (4.478516,)),
|
||||
('L', (( 76.068359, 86.275391),
|
||||
( 76.099609, 58.449219),
|
||||
(100, 44.689453))),
|
||||
('V', (13.365234,)),
|
||||
('L', ((76.919921, 0))),
|
||||
('H', (73.246093,)),
|
||||
('L', ((50.015625, 13.373047),
|
||||
(26.919921, 0))),
|
||||
('Z', ()),
|
||||
('M', ((25.083984, 1.25),
|
||||
(49.033203, 15.115234),
|
||||
(49.001953, 42.941406),
|
||||
(25.017578, 56.75),
|
||||
(1.0019531, 42.845703))),
|
||||
('l', ((0.033203, -27.75))),
|
||||
('z'),
|
||||
('m', ((50,0),
|
||||
(24.017576, 13.904297),
|
||||
(-0.0352, 27.75))),
|
||||
('L', ((75.017578, 56.75),
|
||||
(51.068359, 42.884766),
|
||||
(51.099609, 15.058594))),
|
||||
('Z', ())
|
||||
['M', [[23.246093, 0], [0, 13.382812]]],
|
||||
['V', [44.689453,]],
|
||||
['L', [[0.0839844, 44.640625],
|
||||
[24.033203, 58.505859],
|
||||
[24.001953, 86.332031],
|
||||
[22.841796, 87]]],
|
||||
['h', [4.478516,]],
|
||||
['L', [[26.068359, 86.275391],
|
||||
[26.099609, 58.449219],
|
||||
[50.083984, 44.640625],
|
||||
[74.033203, 58.505859],
|
||||
[74.001953, 86.332031],
|
||||
[72.841796, 87]]],
|
||||
['h', [4.478516,]],
|
||||
['L', [[ 76.068359, 86.275391],
|
||||
[ 76.099609, 58.449219],
|
||||
[100, 44.689453]]],
|
||||
['V', [13.365234,]],
|
||||
['L', [[76.919921, 0]]],
|
||||
['H', [73.246093,]],
|
||||
['L', [[50.015625, 13.373047],
|
||||
[26.919921, 0]]],
|
||||
['Z', []],
|
||||
['M', [[25.083984, 1.25],
|
||||
[49.033203, 15.115234],
|
||||
[49.001953, 42.941406],
|
||||
[25.017578, 56.75],
|
||||
[1.0019531, 42.845703]]],
|
||||
['l', [[0.033203, -27.75]]],
|
||||
['z', []],
|
||||
['m', [[50,0],
|
||||
[24.017576, 13.904297],
|
||||
[-0.0352, 27.75]]],
|
||||
['L', [[75.017578, 56.75],
|
||||
[51.068359, 42.884766],
|
||||
[51.099609, 15.058594]]],
|
||||
['Z', []]
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue