Class: MtgCardMaker::NameLayer
Overview
NameLayer is a specialized layer
This is the area that surrounds the name and cost of the card
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:, name:, cost:, color: nil, color_scheme: DEFAULT_COLOR_SCHEME) ⇒ NameLayer
Returns a new instance of NameLayer.
12
13
14
15
16
17
18
|
# File 'lib/mtg_card_maker/layers/name_layer.rb', line 12
def initialize(dimensions:, name:, cost:, color: nil, color_scheme: DEFAULT_COLOR_SCHEME)
frame_color = initialize_layer_color(color, color_scheme, :background_color)
super(dimensions: dimensions, color: frame_color)
@name = name
@cost = cost
@color_scheme = color_scheme
end
|
Instance Attribute Details
#color_scheme ⇒ Object
10
11
12
|
# File 'lib/mtg_card_maker/layers/name_layer.rb', line 10
def color_scheme
@color_scheme
end
|
#cost ⇒ Object
10
11
12
|
# File 'lib/mtg_card_maker/layers/name_layer.rb', line 10
def cost
@cost
end
|
#name ⇒ Object
10
11
12
|
# File 'lib/mtg_card_maker/layers/name_layer.rb', line 10
def name
@name
end
|
Instance Method Details
#render ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/mtg_card_maker/layers/name_layer.rb', line 20
def render
SvgGradientService.define_all_gradients(svg, color_scheme)
svg.g do
render_name_area
render_card_name
render_mana_cost if cost && !cost.empty?
end
end
|