Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Drawing images
Started by richard11 Nov 25 2018 09:08 AM

No replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 242 posts
  • Corona SDK

Hopefully my last stumbling block!

 

Say I've created the following class:

public class imageOverlay implements com.naef.jnlua.NamedJavaFunction {
    // This reports a class name back to Lua during the initiation phase.
    @Override
    public String getName() {
        return "imageOverlay";
    }

    // This is what actually gets invoked by the Lua call
    @Override
    public int invoke(final LuaState luaState) {
        CoronaActivity activity = CoronaEnvironment.getCoronaActivity();
        if (activity == null) {
            return 0;
        }

        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                CoronaActivity activity = CoronaEnvironment.getCoronaActivity();
                if (activity == null) {
                    return;
                }

                // Some code to go here
            });
        }

        return 1;
    }
}

Firstly, how would I modify this so that calling imageOverlay("something") passes "something" as a param to this method?

 

And secondly, how would I then load "something" in either as a image data directly, or as a path to load an image from, and then render that image to activity.getOverlayView() ?

 

Presumably I want to use BitmapFactory but exactly how, I've no idea.




[topic_controls]
[/topic_controls]