MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / Colorspace

Class Colorspace

src/__init__.py:2715–2745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2713
2714
2715class Colorspace:
2716
2717 def __init__(self, type_):
2718 """Supported are GRAY, RGB and CMYK."""
2719 if isinstance( type_, mupdf.FzColorspace):
2720 self.this = type_
2721 elif type_ == CS_GRAY:
2722 self.this = mupdf.FzColorspace(mupdf.FzColorspace.Fixed_GRAY)
2723 elif type_ == CS_CMYK:
2724 self.this = mupdf.FzColorspace(mupdf.FzColorspace.Fixed_CMYK)
2725 elif type_ == CS_RGB:
2726 self.this = mupdf.FzColorspace(mupdf.FzColorspace.Fixed_RGB)
2727 else:
2728 self.this = mupdf.FzColorspace(mupdf.FzColorspace.Fixed_RGB)
2729
2730 def __repr__(self):
2731 x = ("", "GRAY", "", "RGB", "CMYK")[self.n]
2732 return f"Colorspace(CS_{x}) - {self.name}"
2733
2734 def _name(self):
2735 return mupdf.fz_colorspace_name(self.this)
2736
2737 @property
2738 def n(self):
2739 """Size of one pixel."""
2740 return mupdf.fz_colorspace_n(self.this)
2741
2742 @property
2743 def name(self):
2744 """Name of the Colorspace."""
2745 return self._name()
2746
2747
2748class DeviceWrapper:

Callers 3

colorspaceMethod · 0.85
__init__.pyFile · 0.85
test_2173Function · 0.85

Calls

no outgoing calls

Tested by 1

test_2173Function · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…