Class: Projector
- Includes:
- Observable
- Defined in:
- lib/ext/projector/projector.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#widget ⇒ Object
Returns the value of attribute widget.
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize ⇒ Projector
constructor
A new instance of Projector.
- #update ⇒ Object
Constructor Details
#initialize ⇒ Projector
Returns a new instance of Projector.
173 174 175 176 |
# File 'lib/ext/projector/projector.rb', line 173 def initialize @widget = nil @invalid_drawing = true end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
165 166 167 |
# File 'lib/ext/projector/projector.rb', line 165 def controller @controller end |
#widget ⇒ Object
Returns the value of attribute widget.
164 165 166 |
# File 'lib/ext/projector/projector.rb', line 164 def @widget end |
Instance Method Details
#draw ⇒ Object
183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/ext/projector/projector.rb', line 183 def draw @invalid_drawing or return self drawing_area_context = @widget.window.create_cairo_context port = @widget.allocation fb = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, port.width, port.height) fb_context = Cairo::Context.new(fb) scene(fb_context, port) drawing_area_context.set_source(fb) drawing_area_context.paint @invalid_drawing = false self end |
#update ⇒ Object
178 179 180 181 |
# File 'lib/ext/projector/projector.rb', line 178 def update @invalid_drawing = true self end |