struct Goban::QR::Mask

Overview

Represents a mask pattern that can be applied to a canvas.

Defined in:

goban/qr/mask.cr

Constant Summary

FORMAT_BITS = { {Low: 30660, Medium: 21522, Quartile: 13663, High: 5769}, {Low: 29427, Medium: 20773, Quartile: 12392, High: 5054}, {Low: 32170, Medium: 24188, Quartile: 16177, High: 7399}, {Low: 30877, Medium: 23371, Quartile: 14854, High: 6608}, {Low: 26159, Medium: 17913, Quartile: 9396, High: 1890}, {Low: 25368, Medium: 16590, Quartile: 8579, High: 597}, {Low: 27713, Medium: 20375, Quartile: 11994, High: 3340}, {Low: 26998, Medium: 19104, Quartile: 11245, High: 2107} }
MASK_PATTERNS = {->(x : Int32, y : Int32) do ((x + y) & 1) == 0 end, ->(x : Int32, y : Int32) do (y & 1) == 0 end, ->(x : Int32, y : Int32) do (x % 3) == 0 end, ->(x : Int32, y : Int32) do ((x + y) % 3) == 0 end, ->(x : Int32, y : Int32) do (((x // 3) + (y // 2)) & 1) == 0 end, ->(x : Int32, y : Int32) do (((x * y) & 1) + ((x * y) % 3)) == 0 end, ->(x : Int32, y : Int32) do ((((x * y) & 1) + ((x * y) % 3)) & 1) == 0 end, ->(x : Int32, y : Int32) do ((((x + y) & 1) + ((x * y) % 3)) & 1) == 0 end}
MAX = 7_u8
MIN = 0_u8

Constructors

Instance methods inherited from struct Goban::AbstractQR::Mask

value : UInt8 value

Constructor Detail

def self.new(value) #