class GammaCurveSample

Attributes

count[R]

Public Class Methods

invoke() click to toggle source
# File gtk2/sample/testgtk/gammacurve.rb, line 60
def GammaCurveSample.invoke
  @singleton = new if @singleton.nil? or @singleton.destroyed?
  @singleton.update
  unless @singleton.visible?
    @singleton.show_all
  end
  if @singleton.count == 4
    @singleton.destroy
  end
end
new() click to toggle source
Calls superclass method SampleWindow.new
# File gtk2/sample/testgtk/gammacurve.rb, line 38
def initialize
  super("Gtk::GammaCurve")
  set_border_width(10)

  @curve = Gtk::GammaCurve.new
  add(@curve)
  @count = 0
end

Public Instance Methods

update() click to toggle source
# File gtk2/sample/testgtk/gammacurve.rb, line 47
def update
  max = 127 + (@count % 2) * 128
  @curve.curve.set_range(0, max, 0, max)
  vec = []
  max.times do |i|
    vec[i] = (127 / sqrt(max)) * sqrt(i)
  end
  @curve.curve.set_vector(max, vec)
  @count += 1
end