Class: AAlib::HardwareParams

Inherits:
CPtr show all
Defined in:
lib/aalib.rb

Constant Summary collapse

TYPE =

:nodoc:

'P' + 'I'*11 + 'D'*2
NAMES =
[:font, :supported, :minwidth, :minheight,
:maxwidth, :maxheight, :recwidth, :recheight,
:mmwidth, :mmheight, :width, :height, :dimmul, :boldmul]
DEFAULT =

Notably defined before we redifine initialize()

new(Foreign.defparams).freeze

Instance Method Summary collapse

Methods inherited from CPtr

#[], #[]=, #inspect, new_ptr

Methods included from ArgumentChecks

included

Methods inherited from DL::PtrData

#string?

Constructor Details

#initialize(with_ptr = nil) ⇒ HardwareParams

Returns a new instance of HardwareParams.



535
536
537
538
539
540
541
542
# File 'lib/aalib.rb', line 535

def initialize(with_ptr=nil)
  if with_ptr
    super(with_ptr)
  else
    super()
    copy_from(DEFAULT)
  end
end

Instance Method Details

#copy_from(other) ⇒ Object



544
545
546
547
548
549
# File 'lib/aalib.rb', line 544

def copy_from(other)
  NAMES.each do |get|
    set = (get.to_s + '=').to_sym
    self.send(set, other.send(get))
  end
end

#fontObject



551
552
553
# File 'lib/aalib.rb', line 551

def font
  self[:font] ? Font.new(self[:font]) : nil
end