Lines Matching full:args

79 			# replace the blend op args on the stack with a single list
80 # containing all the blend op args.
101 # lenBlendStack has the number of args represented by the last blend
102 # arg and all the preceding args. We need to now add the number of
103 # args following the last blend arg.
124 def _flattenBlendArgs(args): argument
126 for arg in args:
138 for op,args in commands:
139 if any(isinstance(arg, list) for arg in args):
140 args = _flattenBlendArgs(args)
141 program.extend(args)
157 def rmoveto(args): argument
158 if len(args) != 2: raise ValueError(args)
159 yield ('rmoveto', args)
161 def hmoveto(args): argument
162 if len(args) != 1: raise ValueError(args)
163 yield ('rmoveto', [args[0], 0])
165 def vmoveto(args): argument
166 if len(args) != 1: raise ValueError(args)
167 yield ('rmoveto', [0, args[0]])
170 def rlineto(args): argument
171 if not args: raise ValueError(args)
172 for args in _everyN(args, 2):
173 yield ('rlineto', args)
175 def hlineto(args): argument
176 if not args: raise ValueError(args)
177 it = iter(args)
185 def vlineto(args): argument
186 if not args: raise ValueError(args)
187 it = iter(args)
195 def rrcurveto(args): argument
196 if not args: raise ValueError(args)
197 for args in _everyN(args, 6):
198 yield ('rrcurveto', args)
200 def hhcurveto(args): argument
201 if len(args) < 4 or len(args) % 4 > 1: raise ValueError(args)
202 if len(args) % 2 == 1:
203 yield ('rrcurveto', [args[1], args[0], args[2], args[3], args[4], 0])
204 args = args[5:]
205 for args in _everyN(args, 4):
206 yield ('rrcurveto', [args[0], 0, args[1], args[2], args[3], 0])
208 def vvcurveto(args): argument
209 if len(args) < 4 or len(args) % 4 > 1: raise ValueError(args)
210 if len(args) % 2 == 1:
211 yield ('rrcurveto', [args[0], args[1], args[2], args[3], 0, args[4]])
212 args = args[5:]
213 for args in _everyN(args, 4):
214 yield ('rrcurveto', [0, args[0], args[1], args[2], 0, args[3]])
216 def hvcurveto(args): argument
217 if len(args) < 4 or len(args) % 8 not in {0,1,4,5}: raise ValueError(args)
219 if len(args) % 2 == 1:
220 lastStraight = len(args) % 8 == 5
221 args, last_args = args[:-5], args[-5:]
222 it = _everyN(args, 4)
225 args = next(it)
226 yield ('rrcurveto', [args[0], 0, args[1], args[2], 0, args[3]])
227 args = next(it)
228 yield ('rrcurveto', [0, args[0], args[1], args[2], args[3], 0])
232 args = last_args
234 yield ('rrcurveto', [args[0], 0, args[1], args[2], args[4], args[3]])
236 yield ('rrcurveto', [0, args[0], args[1], args[2], args[3], args[4]])
238 def vhcurveto(args): argument
239 if len(args) < 4 or len(args) % 8 not in {0,1,4,5}: raise ValueError(args)
241 if len(args) % 2 == 1:
242 lastStraight = len(args) % 8 == 5
243 args, last_args = args[:-5], args[-5:]
244 it = _everyN(args, 4)
247 args = next(it)
248 yield ('rrcurveto', [0, args[0], args[1], args[2], args[3], 0])
249 args = next(it)
250 yield ('rrcurveto', [args[0], 0, args[1], args[2], 0, args[3]])
254 args = last_args
256 yield ('rrcurveto', [0, args[0], args[1], args[2], args[3], args[4]])
258 yield ('rrcurveto', [args[0], 0, args[1], args[2], args[4], args[3]])
261 def rcurveline(args): argument
262 if len(args) < 8 or len(args) % 6 != 2: raise ValueError(args)
263 args, last_args = args[:-2], args[-2:]
264 for args in _everyN(args, 6):
265 yield ('rrcurveto', args)
268 def rlinecurve(args): argument
269 if len(args) < 8 or len(args) % 2 != 0: raise ValueError(args)
270 args, last_args = args[:-6], args[-6:]
271 for args in _everyN(args, 2):
272 yield ('rlineto', args)
276 # args is list of blend op args. Since we are supporting
277 # recursive blend op calls, some of these args may also
278 # be a list of blend op args, and need to be converted before
281 args = [i for e in blendList for i in
284 args = blendList
287 # some of the args are lists that each contain a blend op argument list.
294 numBlends = args[-1]
295 # Can't use args.pop() when the args are being used in a nested list
297 args = args[:-1]
299 numRegions = len(args)//numBlends - 1
300 if not (numBlends*(numRegions + 1) == len(args)):
303 defaultArgs = [[arg] for arg in args[:numBlends]]
304 deltaArgs = args[numBlends:]
313 for op, args in commands:
314 # First, generalize any blend args in the arg list.
315 if any([isinstance(arg, list) for arg in args]):
317args = [n for arg in args for n in (_convertBlendOpToArgs(arg) if isinstance(arg, list) else [arg]…
322 result.append(('', args))
329 result.append((op,args))
332 for command in func(args):
338 result.append(('', args))
386 def _convertToBlendCmds(args): argument
388 # the remaining non-blended args, if any.
389 num_args = len(args)
394 arg = args[i]
409 while (i < num_args) and isinstance(args[i], list):
410 blendlist.append(args[i])
486 # 7. For any args which are blend lists, convert them to a blend command.
549 op,args = commands[i]
552 c, args = _categorizeVector(args)
553 commands[i] = c+op[1:], args
557 c1, args1 = _categorizeVector(args[:2])
558 c2, args2 = _categorizeVector(args[-2:])
559 commands[i] = c1+c2+'curveto', args1+args[2:4]+args2
586 op, args = commands[i]
590 assert len(args) == 4
591 c, args = _categorizeVector(args[1:3])
593 commands[i] = op, args
608 assert len(args) == 1 and len(other_args) == 1
610 new_args = [_addArgs(args[0], other_args[0])]
620 op,args = commands[i]
624 assert len(args) == 1
625 args = [0, args[0]] if op[0] == 'v' else [args[0], 0]
626 commands[i] = ('rlineto', args)
629 if op[2:] == 'curveto' and len(args) == 5 and prv == nxt == 'rrcurveto':
639 # Insert, while maintaining the type of args (can be tuple or list).
640 args = args[:pos] + type(args)((0,)) + args[pos:]
641 commands[i] = ('rrcurveto', args)
696 op,args = commands[i]
699 commands[i] = 'h'+op[1:], args
705 assert len(args) % 2 == 1
712 if len(args) % 2:
714 if (op0 == 'h') ^ (len(args) % 8 == 1):
715 # Swap last two args order
716 args = args[:-2]+args[-1:]+args[-2:-1]
719 # Swap first two args order
720 args = args[1:2]+args[:1]+args[2:]
722 commands[i] = op0+op1+'curveto', args
725 # 7. For any series of args which are blend lists, convert the series to a single blend arg.
727 op, args = commands[i]
728 if any(isinstance(arg, list) for arg in args):
729 commands[i] = op, _convertToBlendCmds(args)