Class: Projector

Inherits:
Object show all
Includes:
Observable
Defined in:
lib/ext/projector/projector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProjector

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

#controllerObject

Returns the value of attribute controller



165
166
167
# File 'lib/ext/projector/projector.rb', line 165

def controller
  @controller
end

#widgetObject

Returns the value of attribute widget



164
165
166
# File 'lib/ext/projector/projector.rb', line 164

def widget
  @widget
end

Instance Method Details

#drawObject



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

#updateObject



178
179
180
181
# File 'lib/ext/projector/projector.rb', line 178

def update
  @invalid_drawing = true
  self
end