Class: TECSCDE::View::CairoMatrix

Inherits:
Cairo::Matrix
  • Object
show all
Defined in:
lib/tecscde/view/cairo_matrix.rb

Overview

CairoMatrix

this class is necessary for draw_text_v_cairo & totally shift when writing PDF

Instance Method Summary collapse

Constructor Details

#initializeCairoMatrix

Returns a new instance of CairoMatrix.



57
58
59
60
61
# File 'lib/tecscde/view/cairo_matrix.rb', line 57

def initialize
  @base_x = 0
  @base_y = 0
  super(1, 0, 0, 1, 0, 0)
end

Instance Method Details

#set(xx, yx, xy, yy, x0, y0) ⇒ Object



63
64
65
66
67
# File 'lib/tecscde/view/cairo_matrix.rb', line 63

def set(xx, yx, xy, yy, x0, y0)
  x0 += @base_x
  y0 += @base_y
  super
end

#set_base_shift(x, y) ⇒ Object



83
84
85
86
87
# File 'lib/tecscde/view/cairo_matrix.rb', line 83

def set_base_shift(x, y)
  @base_x = x
  @base_y = y
  set_rotate0
end

#set_rotate0(x = 0, y = 0) ⇒ Object

CairoMatrix#set_rotate0

no rotate, then shift (x, y)



71
72
73
74
# File 'lib/tecscde/view/cairo_matrix.rb', line 71

def set_rotate0(x = 0, y = 0)
  set(1, 0, 0, 1, x, y)
  self
end

#set_rotate90(x, y) ⇒ Object

CairoMatrix#set_rotate90

rotate 90 around (0, 0) then shift (x, y)



78
79
80
81
# File 'lib/tecscde/view/cairo_matrix.rb', line 78

def set_rotate90(x, y)
  set(0, -1, 1, 0, x, y)
  self
end