summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/image.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tk/image.rb')
-rw-r--r--ext/tk/lib/tk/image.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
index 0848eb5966..d38414d09f 100644
--- a/ext/tk/lib/tk/image.rb
+++ b/ext/tk/lib/tk/image.rb
@@ -15,9 +15,16 @@ class TkImage<TkObject
TkCore::INTERP.init_ip_env{ Tk_IMGTBL.clear }
def initialize(keys=nil)
- # @path = Tk_Image_ID.join('')
- @path = Tk_Image_ID.join(TkCore::INTERP._ip_id_)
- Tk_Image_ID[1].succ!
+ @path = nil
+ if keys.kind_of?(Hash)
+ keys = _symbolkey2str(keys)
+ @path = keys.delete('imagename')
+ end
+ unless @path
+ # @path = Tk_Image_ID.join('')
+ @path = Tk_Image_ID.join(TkCore::INTERP._ip_id_)
+ Tk_Image_ID[1].succ!
+ end
tk_call_without_enc('image', 'create', @type, @path, *hash_kv(keys, true))
Tk_IMGTBL[@path] = self
end