Module: EnfEditor::ColorUtils
- Included in:
- EEBrepEdge, EEBrepFace, EEBrepSurface, EEBrepVertex, EEBrepVolume
- Defined in:
- lib/enfeditor/core_ext/color_utils.rb
Overview
Mixin module to handle color property
Instance Method Summary collapse
-
#has_material_color? ⇒ Boolean
Returns true if element has material color.
-
#has_material_color_rgb? ⇒ Boolean
Returns true if element has material color and color type is not alpha.
-
#material_color ⇒ EEMaterialColor?
(also: #color)
Returns material color instance or nil for no color.
- #material_color=(material_color) ⇒ Object (also: #color=)
Instance Method Details
#has_material_color? ⇒ Boolean
Returns true if element has material color.
57 58 59 60 |
# File 'lib/enfeditor/core_ext/color_utils.rb', line 57 def has_material_color? self.has_property(@@propkey_color) and self._material_color_property(@@propkey_color).color_type != :unknown end |
#has_material_color_rgb? ⇒ Boolean
Returns true if element has material color and color type is not alpha.
70 71 72 73 |
# File 'lib/enfeditor/core_ext/color_utils.rb', line 70 def has_material_color_rgb? return false unless self.has_material_color? return self.material_color.color_type != :alpha end |
#material_color ⇒ EEMaterialColor? Also known as: color
Returns material color instance or nil for no color.
19 20 21 22 |
# File 'lib/enfeditor/core_ext/color_utils.rb', line 19 def material_color return nil unless self.has_material_color? self._material_color_property(@@propkey_color) end |
#material_color=(material_color) ⇒ Object Also known as: color=
31 32 33 |
# File 'lib/enfeditor/core_ext/color_utils.rb', line 31 def material_color=(material_color) self.set_material_color(material_color) end |