class ClientForPoslynx::SignatureImage::Draw

Constants

BIT_SEQUENCE_LENGTH
DELTA_BITS_LONG

Attributes

dx[R]
dy[R]

Public Class Methods

first_in_bit_sequence(bit_seq, format=nil) click to toggle source
# File lib/client_for_poslynx/signature_image/draw.rb, line 10
def self.first_in_bit_sequence(bit_seq, format=nil)
  bit_seq.first_bit_digit == '0' &&
    bit_seq.length >= BIT_SEQUENCE_LENGTH
end
new(dx, dy) click to toggle source
# File lib/client_for_poslynx/signature_image/draw.rb, line 24
def initialize(dx, dy)
  @dx = dx
  @dy = dy
end
parse_from_bit_sequence!(bit_seq, format=nil) click to toggle source
# File lib/client_for_poslynx/signature_image/draw.rb, line 15
def self.parse_from_bit_sequence!(bit_seq, format=nil)
  bit_seq.shift 1
  dx_bit_seq = bit_seq.shift( DELTA_BITS_LONG )
  dy_bit_seq = bit_seq.shift( DELTA_BITS_LONG )
  new( dx_bit_seq.as_signed, dy_bit_seq.as_signed )
end

Public Instance Methods

==(other) click to toggle source
# File lib/client_for_poslynx/signature_image/draw.rb, line 29
def ==(other)
  return false unless self.class === other
  return dx == other.dx && dy == other.dy
end
to_bit_sequence(serialization_format=nil) click to toggle source
# File lib/client_for_poslynx/signature_image/draw.rb, line 34
def to_bit_sequence(serialization_format=nil)
  bit_seq = ClientForPoslynx::BitSequence / '0'
  bit_seq << ClientForPoslynx::BitSequence.from_signed( dx, DELTA_BITS_LONG )
  bit_seq << ClientForPoslynx::BitSequence.from_signed( dy, DELTA_BITS_LONG )
end