Class: MtgCardMaker::BorderLayer
- Includes:
- LayerInitializer, MetallicRenderer
- Defined in:
- lib/mtg_card_maker/layers/border_layer.rb
Overview
BorderLayer is a specialized layer for the border of the card. It renders the outermost border of the card and supports four color options: white, black, silver (colorless), and gold. The layer includes QR codes and copyright text at the bottom.
Constant Summary collapse
- SUPPORTED_COLORS =
Supported colors for the border
{ white: '#EEE', black: '#000', silver: :colorless, gold: :gold }.freeze
Instance Attribute Summary collapse
-
#color_scheme ⇒ ColorScheme
readonly
The color scheme for this layer.
-
#mask_id ⇒ String
readonly
The mask ID for the art window.
Attributes inherited from BaseLayer
#color, #height, #template, #width, #x, #y
Instance Method Summary collapse
-
#initialize(dimensions:, color: :white, mask_id: 'artWindowMask') ⇒ BorderLayer
constructor
Initialize a new border layer.
-
#render ⇒ void
Render the border layer with QR code and copyright text.
Methods included from MetallicRenderer
Methods inherited from BaseLayer
Constructor Details
#initialize(dimensions:, color: :white, mask_id: 'artWindowMask') ⇒ BorderLayer
Initialize a new border layer
49 50 51 52 53 54 55 56 57 |
# File 'lib/mtg_card_maker/layers/border_layer.rb', line 49 def initialize(dimensions:, color: :white, mask_id: 'artWindowMask') @color = color.to_sym validate_color! @mask_id = mask_id @icon_service = IconService.new @color_scheme = ColorScheme.new(color_key_for(@color)) super(dimensions: dimensions, color: @color) end |
Instance Attribute Details
#color_scheme ⇒ ColorScheme (readonly)
Returns the color scheme for this layer.
25 26 27 |
# File 'lib/mtg_card_maker/layers/border_layer.rb', line 25 def color_scheme @color_scheme end |
#mask_id ⇒ String (readonly)
Returns the mask ID for the art window.
28 29 30 |
# File 'lib/mtg_card_maker/layers/border_layer.rb', line 28 def mask_id @mask_id end |
Instance Method Details
#render ⇒ void
This method returns an undefined value.
Render the border layer with QR code and copyright text
62 63 64 65 66 67 68 69 70 |
# File 'lib/mtg_card_maker/layers/border_layer.rb', line 62 def render layer_config = LayerConfig.default corners = layer_config.corner_radius(:outer) color_key = color_key_for(@color) render_frame_by_color(color_key, corners) render_qr_code render_copyright_texts(layer_config) end |