Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Calling Objective-C functions from lua — Gideros Forum

Calling Objective-C functions from lua

SimplesAppsSimplesApps Member
edited January 2013 in Plugins
Hi everyone,

I'm trying to mask an image within the HotWax (BhWax) plugin (iOS platform).
I have tested different ways of implement some calls to the corresponding iOS functions (Objective-C) but without success.
How could these functions to be called from Lua ?

The piece of code to be "translated" is:

"
UIImage *inputImage = [UIImage imageName:@inputImage.png];

CGImageRef maskRef = [UIImage imageNamed:@mask.png].CGImage;

CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
CGImageGetHeight(maskRef),
CGImageGetBitsPerComponent(maskRef),
CGImageGetBitsPerPixel(maskRef),
CGImageGetBytesPerRow(maskRef),
CGImageGetDataProvider(maskRef), NULL, false);

CGImageRef masked = CGImageCreateWithMask([inputImage CGImage], mask);
"

Btw, the first one in Lua can be called like this:

"
UIImage:imageWithContentsOfFile(getPathForFile("inputImage.png"))
"

Thanks.

Comments

Sign In or Register to comment.