|
I'm trying to create a plugin that lets you grab images from the ALAssetLibrary in the photo album. I have the bytes for a jpeg, and I just need to return them back to my C# script. Objective C C# code: The Objective C code seems to run ok. But the length of the bytes I get back in C# is 16777217. No idea what it is, but its not the 12k I saw in the XCode debugger. Thanks.
(comments are locked)
|
|
Well, it's a problem to get unmanaged memory into managed code. I don't know ObjC (only C++) so the i'm not familiar with the syntax of ObjC. It's easier to do it the other way round. Pass a managed array to ObjC and fill the array. You need to set the array size either big enough, or you have to implement a query function to get the required size. hope that helps a bit ;) Maybe there's a ObjC expert around Thanks, will try that. I'm actually doing it in ObjC/C++, so what you've provided there is very close to how I would do it. I'm just a bit uncertain how I would work with the "data" variable you defined in the GetImageData() function. You defnined "data" with consts. So do I need to memory copy the image data into it, or can I do something like: data = (const **char)[pictureData bytes]; I also wonder if should not be an unsigned *char in both the function parameter and in the above line?
Jun 21 '11 at 12:02 PM
aicos
Found also another helpful post: http://answers.unity3d.com/questions/34606/how-do-i-pass-arrays-from-c-to-c-in-unity-if-at-al.html
Jun 21 '11 at 12:44 PM
aicos
(comments are locked)
|
