Class: Fontisan::Models::ColorLayer
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Fontisan::Models::ColorLayer
- Defined in:
- lib/fontisan/models/color_layer.rb
Overview
Color layer information model
Represents a single color layer in a COLR glyph. Each layer specifies a glyph ID to render and the palette index for its color.
This model uses lutaml-model for structured serialization to YAML/JSON/XML.
Instance Attribute Summary collapse
-
#color ⇒ String?
Hex color from palette (#RRGGBBAA), nil if foreground.
-
#glyph_id ⇒ Integer
Glyph ID of the layer.
-
#palette_index ⇒ Integer
Index into CPAL palette (0xFFFF = foreground).
Instance Method Summary collapse
-
#uses_foreground_color? ⇒ Boolean
Check if this layer uses the foreground color.
-
#uses_palette_color? ⇒ Boolean
Check if this layer uses a palette color.
Instance Attribute Details
#color ⇒ String?
Returns Hex color from palette (#RRGGBBAA), nil if foreground.
36 |
# File 'lib/fontisan/models/color_layer.rb', line 36 attribute :color, :string |
#glyph_id ⇒ Integer
Returns Glyph ID of the layer.
28 |
# File 'lib/fontisan/models/color_layer.rb', line 28 attribute :glyph_id, :integer |
#palette_index ⇒ Integer
Returns Index into CPAL palette (0xFFFF = foreground).
32 |
# File 'lib/fontisan/models/color_layer.rb', line 32 attribute :palette_index, :integer |
Instance Method Details
#uses_foreground_color? ⇒ Boolean
Check if this layer uses the foreground color
41 42 43 |
# File 'lib/fontisan/models/color_layer.rb', line 41 def uses_foreground_color? palette_index == 0xFFFF end |
#uses_palette_color? ⇒ Boolean
Check if this layer uses a palette color
48 49 50 |
# File 'lib/fontisan/models/color_layer.rb', line 48 def uses_palette_color? !uses_foreground_color? end |