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
Maybe some more interface functions have to be implemented like in UIImage+Save.m ?
Thanks,
David.
https://play.google.com/store/apps/developer?id=SimplesApps
http://www.amazon.com/gp/mas/dl/android?p=com.simplesapps.actionbasket
https://itunes.apple.com/artist/david-rodriguez/id763996989
Wax workes with the Objective-C API so it sort of overlooks the C APIs. The CGImage functions are C functions and structures.
So for you to be able to use the rest of the code in Lua using Wax, you will have to include them into Wax, have a look at the various files you will see how the structures and C APIs are added.
@ANdy can also chime in on this if there is something different/misunderstood.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Best regards