Class: MtgCardMaker::FrameLayer

Inherits:
BaseLayer show all
Includes:
LayerInitializer, MetallicRenderer
Defined in:
lib/mtg_card_maker/layers/frame_layer.rb

Overview

FrameLayer is a specialized layer for the colored frame of the card You choose the color, making it possible to make a blue card that costs mountains, for example.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Attributes inherited from BaseLayer

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

Instance Method Summary collapse

Methods included from MetallicRenderer

#render_metallic_elements

Methods inherited from BaseLayer

#svg

Constructor Details

#initialize(dimensions:, color: nil, color_scheme: DEFAULT_COLOR_SCHEME, mask_id: 'artWindowMask') ⇒ FrameLayer

Returns a new instance of FrameLayer.

Since:

  • 0.1.0



14
15
16
17
18
19
20
# File 'lib/mtg_card_maker/layers/frame_layer.rb', line 14

def initialize(dimensions:, color: nil, color_scheme: DEFAULT_COLOR_SCHEME, mask_id: 'artWindowMask')
  frame_color = initialize_layer_color(color, color_scheme, :primary_color)
  super(dimensions: dimensions, color: frame_color)
  @color_scheme = color_scheme
  @mask_id = mask_id
  @layer_config = LayerConfig.default
end

Instance Attribute Details

#color_schemeObject (readonly)

Since:

  • 0.1.0



12
13
14
# File 'lib/mtg_card_maker/layers/frame_layer.rb', line 12

def color_scheme
  @color_scheme
end

#layer_configObject (readonly)

Since:

  • 0.1.0



12
13
14
# File 'lib/mtg_card_maker/layers/frame_layer.rb', line 12

def layer_config
  @layer_config
end

#mask_idObject (readonly)

Since:

  • 0.1.0



12
13
14
# File 'lib/mtg_card_maker/layers/frame_layer.rb', line 12

def mask_id
  @mask_id
end

Instance Method Details

#renderObject

Render the frame with a gradient background

Since:

  • 0.1.0



23
24
25
26
27
28
29
30
# File 'lib/mtg_card_maker/layers/frame_layer.rb', line 23

def render
  SvgGradientService.define_all_gradients(svg, color_scheme)
  if metallic_properties?
    render_metallic_frame
  else
    render_standard_frame
  end
end