Class: Gtk2HTML::DrawingInstructions
- Inherits:
-
Object
- Object
- Gtk2HTML::DrawingInstructions
- Defined in:
- lib/gtk2html.rb
Instance Attribute Summary collapse
-
#area ⇒ Object
Returns the value of attribute area.
Instance Method Summary collapse
- #draw_box(margin, raw_coords, padding, style) ⇒ Object
- #draw_layout(text, style) ⇒ Object
-
#initialize(area = nil) ⇒ DrawingInstructions
constructor
A new instance of DrawingInstructions.
- #render(a) ⇒ Object
- #script(args) ⇒ Object
- #window(args) ⇒ Object
Constructor Details
#initialize(area = nil) ⇒ DrawingInstructions
Returns a new instance of DrawingInstructions.
137 138 139 140 141 |
# File 'lib/gtk2html.rb', line 137 def initialize(area=nil) @area = area if area end |
Instance Attribute Details
#area ⇒ Object
Returns the value of attribute area.
134 135 136 |
# File 'lib/gtk2html.rb', line 134 def area @area end |
Instance Method Details
#draw_box(margin, raw_coords, padding, style) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/gtk2html.rb', line 143 def draw_box(margin, raw_coords, padding, style) coords = raw_coords.map.with_index {|x,i| x ? x : @curpos[i] } h2 = style.clone h2.delete :color x1, y1, x2, y2 = coords @curpos = coords width = x2 - x1 height = y2 - y1 gc = gc_ini(h2) @area.window.draw_rectangle(gc, 1, x1, y1, width, height) end |
#draw_layout(text, style) ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/gtk2html.rb', line 160 def draw_layout(text, style) x, y = @curpos text ||= '' h2 = style.clone h2.delete :'background-color' layout = Pango::Layout.new(Gdk::Pango.context) layout.font_description = Pango::FontDescription.\ new('Sans ' + style[:'font-size']) layout.text = text gc = gc_ini(h2) @area.window.draw_layout(gc, x, y, layout) end |
#render(a) ⇒ Object
180 181 182 |
# File 'lib/gtk2html.rb', line 180 def render(a) draw [a] end |
#script(args) ⇒ Object
184 185 186 |
# File 'lib/gtk2html.rb', line 184 def script(args) end |
#window(args) ⇒ Object
177 178 |
# File 'lib/gtk2html.rb', line 177 def window(args) end |