Class: QrForge::Components::EyeInner::Square

Inherits:
ForgeComponent show all
Defined in:
lib/qr_forge/components/eye_inner/square.rb

Overview

Square component for the inner eye of a finder pattern This draws a 3x3 square in the center of the finder pattern.

Instance Method Summary collapse

Methods inherited from ForgeComponent

#initialize

Constructor Details

This class inherits a constructor from QrForge::Components::ForgeComponent

Instance Method Details

#draw(y:, x:, quiet_zone:, area:, color: "black", **_) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/qr_forge/components/eye_inner/square.rb', line 11

def draw(y:, x:, quiet_zone:, area:, color: "black", **_)
  position_offset = 2
  area_offset = 4

  x = x + position_offset + quiet_zone
  y = y + position_offset + quiet_zone
  area_with_offset = area - area_offset

  @xml_builder.rect(
    x:,
    y:,
    width: area_with_offset,
    height: area_with_offset,
    fill: color,
    test_id: @test_id
  )
end