pdfcolor.py 761 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env python
  2. from psparser import LIT
  3. ## PDFColorSpace
  4. ##
  5. LITERAL_DEVICE_GRAY = LIT('DeviceGray')
  6. LITERAL_DEVICE_RGB = LIT('DeviceRGB')
  7. LITERAL_DEVICE_CMYK = LIT('DeviceCMYK')
  8. class PDFColorSpace(object):
  9. def __init__(self, name, ncomponents):
  10. self.name = name
  11. self.ncomponents = ncomponents
  12. return
  13. def __repr__(self):
  14. return '<PDFColorSpace: %s, ncomponents=%d>' % (self.name, self.ncomponents)
  15. PREDEFINED_COLORSPACE = dict(
  16. (name, PDFColorSpace(name, n)) for (name, n) in {
  17. 'CalRGB': 3,
  18. 'CalGray': 1,
  19. 'Lab': 3,
  20. 'DeviceRGB': 3,
  21. 'DeviceCMYK': 4,
  22. 'DeviceGray': 1,
  23. 'Separation': 1,
  24. 'Indexed': 1,
  25. 'Pattern': 1,
  26. }.iteritems())