4 messages in net.java.dev.jna.usersRe: [jna-users] Nested Structure alig...
FromSent OnAttachments
Francis FernandezApr 11, 2008 8:31 am 
Timothy WallApr 11, 2008 8:39 am 
Francis FernandezApr 11, 2008 8:47 am 
Timothy WallApr 11, 2008 9:22 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Nested Structure alignmentActions...
From:Timothy Wall (twal@dev.java.net)
Date:Apr 11, 2008 8:39:27 am
List:net.java.dev.jna.users

Helps to have the original C source. Verbal explanations are usually less accurate than compilable code.

On Apr 11, 2008, at 11:31 AM, Francis Fernandez wrote:

Thanks for the help with the Pointer issue. I'm now running across a problem with the raw images returned by the camera. The Structure for the image itself looks like this:

public class VRmImage extends Structure implements ByReference {

public VRmImageFormat m_image_format;

public Pointer mp_buffer;

public NativeLong m_pitch;

public double m_time_stamp;

public Pointer mp_private;

}

The VRmImageFormat Structure nested within it looks like this:

public class VRmImageFormat extends Structure {

public NativeLong m_width;

public NativeLong m_height;

//enum VRmColorFormat // { VRM_ARGB_4X8, VRM_BGR_3X8, VRM_RGB_565, VRM_YUYV_4X8, VRM_GRAY_8, VRM_BAYER_GBRG_8, // VRM_BAYER_BGGR_8, VRM_BAYER_RGGB_8, VRM_BAYER_GRBG_8, VRM_GRAY_10, VRM_BAYER_GBRG_10, // VRM_BAYER_BGGR_10, VRM_BAYER_RGGB_10, VRM_BAYER_GRBG_10 } public int m_color_format;

public int m_image_modifier;

}

When I attempt to grab a new image from the camera, it returns successful, and the object's toString() looks like this:

VRmImage(allocated@0x2fb2830 (40 bytes)) { VRmImageFormat m_image_format@0=VRmImageFormat(allocated@0x2fb2830 (40 bytes) (shared from allocated@0x2fb2830 (40 bytes))) { NativeLong m_width@0=48121264 NativeLong m_height@4=0 int m_color_format@8=0 int m_image_modifier@c=0 } Pointer mp_buffer@10=null NativeLong m_pitch@14=0 double m_time_stamp@18=0.0 Pointer mp_private@20=null }

The problem here is that the VRmImageFormat field is taking up the entirety of the Structure (at least, that's what it looks like to me). The format object is supposed to be inline in the image object, as I understand it, but it doesn't seem to be aligning properly. How can I best get this issue sorted out? Thank you.

~Francis