Class: Pango::Matrix

Inherits:
Object
  • Object
show all
Defined in:
lib/pango/matrix.rb

Instance Method Summary collapse

Constructor Details

#initialize(xx = nil, xy = nil, yx = nil, yy = nil, x0 = nil, y0 = nil) ⇒ Matrix

Returns a new instance of Matrix.



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

def initialize(xx=nil, xy=nil, yx=nil, yy=nil, x0=nil, y0=nil)
  initialize_raw
  self.xx = xx || 1.0
  self.xy = xy || 0.0
  self.yx = yx || 0.0
  self.yy = yy || 1.0
  self.x0 = x0 || 0.0
  self.y0 = y0 || 0.0
end

Instance Method Details

#concat(matrix) ⇒ Object Also known as: +



57
58
59
60
61
# File 'lib/pango/matrix.rb', line 57

def concat(matrix)
  copied_matrix = dup
  copied_matrix.concat!(matrix)
  copied_matrix
end

#initialize_rawObject



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

alias_method :initialize_raw, :initialize

#rotate(degree) ⇒ Object



51
52
53
54
55
# File 'lib/pango/matrix.rb', line 51

def rotate(degree)
  copied_matrix = dup
  copied_matrix.rotate!(degree)
  copied_matrix
end

#scale(scale_x, scale_y) ⇒ Object



45
46
47
48
49
# File 'lib/pango/matrix.rb', line 45

def scale(scale_x, scale_y)
  copied_matrix = dup
  copied_matrix.scale!(scale_x, scale_y)
  copied_matrix
end

#to_aObject



30
31
32
33
34
35
36
37
# File 'lib/pango/matrix.rb', line 30

def to_a
  [
    xx, xy,
    yx, yy,
    x0,
    y0,
  ]
end

#translate(tx, ty) ⇒ Object



39
40
41
42
43
# File 'lib/pango/matrix.rb', line 39

def translate(tx, ty)
  copied_matrix = dup
  copied_matrix.translate!(tx, ty)
  copied_matrix
end