Class: MtgCardMaker::TypeLineLayer

Inherits:
BaseLayer
  • Object
show all
Includes:
LayerInitializer
Defined in:
lib/mtg_card_maker/layers/type_line_layer.rb

Overview

TypeLineLayer is a specialized layer for the type of the card This is the small area in the center of the card below the artwork

Since:

  • 0.1.0

Instance Attribute Summary collapse

Attributes inherited from BaseLayer

#color, #height, #template, #width, #x, #y

Instance Method Summary collapse

Methods inherited from BaseLayer

#svg

Constructor Details

#initialize(dimensions:, type_line:, color: nil, color_scheme: DEFAULT_COLOR_SCHEME) ⇒ TypeLineLayer

Returns a new instance of TypeLineLayer.

Since:

  • 0.1.0



10
11
12
13
14
15
# File 'lib/mtg_card_maker/layers/type_line_layer.rb', line 10

def initialize(dimensions:, type_line:, color: nil, color_scheme: DEFAULT_COLOR_SCHEME)
  frame_color = initialize_layer_color(color, color_scheme, :background_color)
  super(dimensions: dimensions, color: frame_color)
  @type_line = type_line
  @color_scheme = color_scheme
end

Instance Attribute Details

#color_schemeObject (readonly)

Since:

  • 0.1.0



8
9
10
# File 'lib/mtg_card_maker/layers/type_line_layer.rb', line 8

def color_scheme
  @color_scheme
end

#type_lineObject (readonly)

Since:

  • 0.1.0



8
9
10
# File 'lib/mtg_card_maker/layers/type_line_layer.rb', line 8

def type_line
  @type_line
end

Instance Method Details

#renderObject

Since:

  • 0.1.0



17
18
19
20
21
22
23
24
25
26
# File 'lib/mtg_card_maker/layers/type_line_layer.rb', line 17

def render
  # Ensure gradients are defined for this color scheme
  SvgGradientService.define_all_gradients(svg, color_scheme)

  svg.g do
    render_type_background
    render_type_line
    render_type_icon
  end
end