Class: Pango::Rectangle

Inherits:
Object
  • Object
show all
Extended by:
GLib::Deprecatable
Defined in:
lib/pango/rectangle.rb,
lib/pango/deprecated.rb

Instance Method Summary collapse

Constructor Details

#initialize(x, y, width, height) ⇒ Rectangle

Returns a new instance of Rectangle.



20
21
22
23
24
25
26
# File 'lib/pango/rectangle.rb', line 20

def initialize(x, y, width, height)
  initialize_raw
  self.x = x
  self.y = y
  self.width = width
  self.height = height
end

Instance Method Details

#ascent ⇒ Object



28
29
30
# File 'lib/pango/rectangle.rb', line 28

def ascent
  -y
end

#descent ⇒ Object



32
33
34
# File 'lib/pango/rectangle.rb', line 32

def descent
  y + height
end

#dup ⇒ Object



48
49
50
51
52
53
54
# File 'lib/pango/rectangle.rb', line 48

def dup
  duplicated = self.class.new(x, y, width, height)
  if respond_to?(:tainted?) and tainted?
    duplicated.taint
  end
  duplicated
end

#initialize_raw ⇒ Object



19
# File 'lib/pango/rectangle.rb', line 19

alias_method :initialize_raw, :initialize

#left_bearing ⇒ Object



36
37
38
# File 'lib/pango/rectangle.rb', line 36

def left_bearing
  x
end

#right_bearing ⇒ Object



40
41
42
# File 'lib/pango/rectangle.rb', line 40

def right_bearing
  x + width
end

#to_a ⇒ Object



44
45
46
# File 'lib/pango/rectangle.rb', line 44

def to_a
  [x, y, width, height]
end