Class: Pdfrb::Color::ColorSpace
- Inherits:
-
Object
- Object
- Pdfrb::Color::ColorSpace
- Defined in:
- lib/pdfrb/color/color_space.rb
Overview
Color space value objects (ISO 32000-2 ยง8.6). Each color space knows how to serialize to its PDF representation (a name for device spaces, an array for CIE-based and special spaces).
Hierarchy:
Base
Device (DeviceGray, DeviceRGB, DeviceCMYK)
CIEBased (CalGray, CalRGB, Lab, ICCBased)
Special (Indexed, Separation, DeviceN, Pattern)
OCP: new color space = subclass + register_as.
Direct Known Subclasses
CIEBasedColorSpace, DeviceColorSpace, DeviceN, Indexed, Pattern, Separation
Class Method Summary collapse
- .[](name) ⇒ Object
- .names ⇒ Object
-
.pdf_name ⇒ Object
Subclass hook: the PDF name or array-head symbol.
- .register(name, klass) ⇒ Object
-
.register_as(name = pdf_name) ⇒ Object
Register this class under its pdf_name.
- .registry ⇒ Object
Class Method Details
.[](name) ⇒ Object
27 28 29 |
# File 'lib/pdfrb/color/color_space.rb', line 27 def [](name) registry[name.to_sym] end |
.names ⇒ Object
31 32 33 |
# File 'lib/pdfrb/color/color_space.rb', line 31 def names registry.keys end |
.pdf_name ⇒ Object
Subclass hook: the PDF name or array-head symbol.
36 37 38 |
# File 'lib/pdfrb/color/color_space.rb', line 36 def pdf_name raise NotImplementedError end |
.register(name, klass) ⇒ Object
23 24 25 |
# File 'lib/pdfrb/color/color_space.rb', line 23 def register(name, klass) registry[name.to_sym] = klass end |
.register_as(name = pdf_name) ⇒ Object
Register this class under its pdf_name.
41 42 43 44 |
# File 'lib/pdfrb/color/color_space.rb', line 41 def register_as(name = pdf_name) ColorSpace.register(name, self) self end |
.registry ⇒ Object
19 20 21 |
# File 'lib/pdfrb/color/color_space.rb', line 19 def registry @registry ||= {} end |