Class: MtgCardMaker::FrameLayer
- 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.
Instance Attribute Summary collapse
- #color_scheme ⇒ Object readonly
- #layer_config ⇒ Object readonly
- #mask_id ⇒ Object readonly
Attributes inherited from BaseLayer
#color, #height, #template, #width, #x, #y
Instance Method Summary collapse
-
#initialize(dimensions:, color: nil, color_scheme: DEFAULT_COLOR_SCHEME, mask_id: 'artWindowMask') ⇒ FrameLayer
constructor
A new instance of FrameLayer.
-
#render ⇒ Object
Render the frame with a gradient background.
Methods included from MetallicRenderer
Methods inherited from BaseLayer
Constructor Details
#initialize(dimensions:, color: nil, color_scheme: DEFAULT_COLOR_SCHEME, mask_id: 'artWindowMask') ⇒ FrameLayer
Returns a new instance of FrameLayer.
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_scheme ⇒ Object (readonly)
12 13 14 |
# File 'lib/mtg_card_maker/layers/frame_layer.rb', line 12 def color_scheme @color_scheme end |
#layer_config ⇒ Object (readonly)
12 13 14 |
# File 'lib/mtg_card_maker/layers/frame_layer.rb', line 12 def layer_config @layer_config end |
#mask_id ⇒ Object (readonly)
12 13 14 |
# File 'lib/mtg_card_maker/layers/frame_layer.rb', line 12 def mask_id @mask_id end |
Instance Method Details
#render ⇒ Object
Render the frame with a gradient background
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 else render_standard_frame end end |