MCPcopy Index your code
hub / github.com/clips/pattern / get_colorspace

Method get_colorspace

pattern/web/pdf/pdfinterp.py:319–329  ·  view source on GitHub ↗
(spec)

Source from the content-addressed store, hash-verified

317 self.csmap = PREDEFINED_COLORSPACE.copy()
318 if not resources: return
319 def get_colorspace(spec):
320 if isinstance(spec, list):
321 name = literal_name(spec[0])
322 else:
323 name = literal_name(spec)
324 if name == 'ICCBased' and isinstance(spec, list) and 2 <= len(spec):
325 return PDFColorSpace(name, stream_value(spec[1])['N'])
326 elif name == 'DeviceN' and isinstance(spec, list) and 2 <= len(spec):
327 return PDFColorSpace(name, len(list_value(spec[1])))
328 else:
329 return PREDEFINED_COLORSPACE[name]
330 for (k,v) in dict_value(resources).iteritems():
331 if 2 <= self.debug:
332 print >>sys.stderr, 'Resource: %r: %r' % (k,v)

Callers

nothing calls this directly

Calls 5

literal_nameFunction · 0.90
PDFColorSpaceClass · 0.90
stream_valueFunction · 0.90
list_valueFunction · 0.90
lenFunction · 0.85

Tested by

no test coverage detected