TkPhotoImage (Class)

In: tk/lib/tk/image.rb
Parent: TkImage

Methods

blank   cget   copy   data   get   get_transparency   new   put   read   redither   set_transparency   write  

Constants

NullArgOptionKeys = [ "shrink", "grayscale" ]

Public Class methods

[Source]

# File tk/lib/tk/image.rb, line 76
  def initialize(*args)
    @type = 'photo'
    super
  end

Public Instance methods

[Source]

# File tk/lib/tk/image.rb, line 81
  def blank
    tk_send_without_enc('blank')
    self
  end

[Source]

# File tk/lib/tk/image.rb, line 86
  def cget(option)
    case option.to_s
    when 'data', 'file'
      tk_send 'cget', option
    else
      tk_tcl2ruby(tk_send('cget', option))
    end
  end

[Source]

# File tk/lib/tk/image.rb, line 95
  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', source, *args)
    end
    self
  end

[Source]

# File tk/lib/tk/image.rb, line 114
  def data(keys={})
    #tk_send('data', *_photo_hash_kv(keys))

    tk_split_list(tk_send('data', *_photo_hash_kv(keys)))
  end

[Source]

# File tk/lib/tk/image.rb, line 119
  def get(x, y)
    tk_send('get', x, y).split.collect{|n| n.to_i}
  end

[Source]

# File tk/lib/tk/image.rb, line 159
  def get_transparency(x, y)
    bool(tk_send('transparency', 'get', x, y))
  end

[Source]

# File tk/lib/tk/image.rb, line 123
  def put(data, *opts)
    if opts == []
      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

[Source]

# File tk/lib/tk/image.rb, line 135
  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

[Source]

# File tk/lib/tk/image.rb, line 154
  def redither
    tk_send 'redither'
    self
  end

[Source]

# File tk/lib/tk/image.rb, line 162
  def set_transparency(x, y, st)
    tk_send('transparency', 'set', x, y, st)
    self
  end

[Source]

# File tk/lib/tk/image.rb, line 167
  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

[Validate]