Search code examples
javawinapijna

MAGIMAGEHEADER in java


I am creating class for MAGIMAGEHEADER in Java

The Structure of MAGIMAGEHEADER in Winapi is

typedef struct tagMAGIMAGEHEADER {
  UINT               width;
  UINT               height;
  WICPixelFormatGUID format;
  UINT               stride;
  UINT               offset;
  SIZE_T             cbSize;
} MAGIMAGEHEADER, *PMAGIMAGEHEADER;

I have created a equivalent class in Java.

import java.util.Arrays;
import java.util.List;


public class MAGIMAGEHEADER extends com.sun.jna.Structure {
    public int width;
    public int height;
    public Object format;
    public int stride;
    public int offset;
    public int cbsize;

    public List getFieldOrder() {
        return Arrays.asList("width","height","format","stride","offset","cbsize");
    }
}

I have problem with format field, How to define WICPixelFormatGUID in Java?

I didn't find any structure of WICPixelFormatGUID in winapi.


Solution

  • As stated in the documentation to which you link, the type is declared in wincodec.h. Search for the type there and you find:

    typedef /* [public] */ GUID WICPixelFormatGUID;
    

    So, it is, not surprisingly, a GUID.

    I believe that means you need to use com.sun.jna.platform.win32.Guid.GUID.