Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
How to get the path of the image that was used to create a specific bitmap object? — Gideros Forum

How to get the path of the image that was used to create a specific bitmap object?

MellsMells Guru
edited August 2012 in General questions
I'd like to get the texture or textureRegion object that was given when creating a Bitmap :
local bitmap1 = Bitmap.new(texture)
local bitmap2 = Bitmap.new(region)
My goal is to get the path of the image that was used to create a specific bitmap object.

Is that currently possible?
twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    No not that I know of.

    You have two choices:

    Create a property on your own
    local bitmap1 = Bitmap.new(texture)
    bitmap1.texture = texture
    local bitmap2 = Bitmap.new(region)
    bitmap2.texture = region
    Or overwrite Bitmap class by putting this code to main.lua or init.lua (to execute before any other code)
    Bitmap.__new = Bitmap.new
     
    function Bitmap.myNew(texture)
    	self = Bitmap.__new(texture)
    	self.texture = texture
    	return self
    end
     
    Bitmap.new = Bitmap.myNew
     
    function Bitmap:getTexture()
    	return self.texture
    end
    And Bitmap object now will have a method getTexture() to return texture object
  • Thank you. Would be great to have get/set built-in.
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
Sign In or Register to comment.