Class/Module Index [+]

Quicksearch

TkPhotoImage

Constants

NullArgOptionKeys

Public Class Methods

new(*args) click to toggle source
                
# File tk/lib/tk/image.rb, line 149
def initialize(*args)
  @type = 'photo'
  super(*args)
end

Public Instance Methods

blank() click to toggle source
                
# File tk/lib/tk/image.rb, line 154
def blank
  tk_send_without_enc('blank')
  self
end
cget(option) click to toggle source
                
# File tk/lib/tk/image.rb, line 167
def cget(option)
  unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
    cget_strict(option)
  else
    begin
      cget_strict(option)
    rescue => e
      if current_configinfo.has_key?(option.to_s)
        # error on known option
        fail e
      else
        # unknown option
        nil
      end
    end
  end
end
cget_strict(option) click to toggle source
                
# File tk/lib/tk/image.rb, line 159
def cget_strict(option)
  case option.to_s
  when 'data', 'file'
    tk_send 'cget', '-' << option.to_s
  else
    tk_tcl2ruby(tk_send('cget', '-' << option.to_s))
  end
end
copy(src, *opts) click to toggle source
                
# File tk/lib/tk/image.rb, line 185
def copy(src, *opts)
  if opts.size == 0
    tk_send('copy', src)
  elsif opts.size == 1 && opts[0].kind_of?(Hash)
    tk_send('copy', src, *_photo_hash_kv(opts[0]))
  else
    # for backward compatibility
    args = opts.collect{|term|
      if term.kind_of?(String) && term.include?(\s\)
        term.split
      else
        term
      end
    }.flatten
    tk_send('copy', src, *args)
  end
  self
end
data(keys={}) click to toggle source
                
# File tk/lib/tk/image.rb, line 204
def data(keys={})
  #tk_send('data', *_photo_hash_kv(keys))
  tk_split_list(tk_send('data', *_photo_hash_kv(keys)))
end
get(x, y) click to toggle source
                
# File tk/lib/tk/image.rb, line 209
def get(x, y)
  tk_send('get', x, y).split.collect{|n| n.to_i}
end
get_transparency(x, y) click to toggle source
                
# File tk/lib/tk/image.rb, line 249
def get_transparency(x, y)
  bool(tk_send('transparency', 'get', x, y))
end
put(data, *opts) click to toggle source
                
# File tk/lib/tk/image.rb, line 213
def put(data, *opts)
  if opts.empty?
    tk_send('put', data)
  elsif opts.size == 1 && opts[0].kind_of?(Hash)
    tk_send('put', data, *_photo_hash_kv(opts[0]))
  else
    # for backward compatibility
    tk_send('put', data, '-to', *opts)
  end
  self
end
read(file, *opts) click to toggle source
                
# File tk/lib/tk/image.rb, line 225
def read(file, *opts)
  if opts.size == 0
    tk_send('read', file)
  elsif opts.size == 1 && opts[0].kind_of?(Hash)
    tk_send('read', file, *_photo_hash_kv(opts[0]))
  else
    # for backward compatibility
    args = opts.collect{|term|
      if term.kind_of?(String) && term.include?(\s\)
        term.split
      else
        term
      end
    }.flatten
    tk_send('read', file, *args)
  end
  self
end
redither() click to toggle source
                
# File tk/lib/tk/image.rb, line 244
def redither
  tk_send 'redither'
  self
end
set_transparency(x, y, st) click to toggle source
                
# File tk/lib/tk/image.rb, line 252
def set_transparency(x, y, st)
  tk_send('transparency', 'set', x, y, st)
  self
end
write(file, *opts) click to toggle source
                
# File tk/lib/tk/image.rb, line 257
def write(file, *opts)
  if opts.size == 0
    tk_send('write', file)
  elsif opts.size == 1 && opts[0].kind_of?(Hash)
    tk_send('write', file, *_photo_hash_kv(opts[0]))
  else
    # for backward compatibility
    args = opts.collect{|term|
      if term.kind_of?(String) && term.include?(\s\)
        term.split
      else
        term
      end
    }.flatten
    tk_send('write', file, *args)
  end
  self
end
blog comments powered by Disqus