Page 1 of 1

Wrapper for .NET for GFL SDK - gflLoadEXIF()?

Posted: Fri May 08, 2009 11:44 pm
by WatcherFF
Hello,

I'm searching for a .NET wrapper for GFL SDK. Does somebody already implement such one?

Actually I need only wrapper for gflLoadEXIF() function.
But I've some troubles with marshaling of data. What do I wrong?

Code: Select all

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
        public struct GFL_EXIF_ENTRY
        {
            /// <summary>
            /// Directory of the tag. 
            /// EXIF_MAIN_IFD 0 Main 
            /// EXIF_IFD_0 2 IFD 0 or Camera IFD 
            /// EXIF_INTEROPERABILITY_IFD 4 Interoperability IFD 
            /// EXIF_IFD_THUMBNAIL 8 Thumbnail IFD 
            /// EXIF_GPS_IFD 16 GPS IFD 
            /// EXIF_MAKERNOTE_IFD 32 Makernote IFD (Canon, Olympus, Minolta, Fuji, Nikon, Casio camera supported) 
            /// </summary>
            public uint Flag;
            /// <summary>
            /// Tag value
            /// </summary>
            public uint Tag;
            /// <summary>
            /// Pointer to a null-terminated string that contains the label of the tag. 
            /// </summary>
            public IntPtr Name;
            /// <summary>
            /// Pointer to a null-terminated string that contains the value of the tag
            /// </summary>
            public IntPtr Value;
        }

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
        public struct GFL_EXIF_DATA
        {
            public GFL_EXIF_ENTRY[]  ItemsList;
            public uint NumberOfItems;
        }
...
	[DllImport("libgfl290.dll", EntryPoint ="gflLibraryInit", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall )]
        public static extern GFL_ERROR gflLibraryInit();
        [DllImport("libgfl290.dll", EntryPoint = "gflLoadEXIF", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
        public static extern IntPtr gflLoadEXIF(StringBuilder fileName, uint flags);
...
            StringBuilder name = new StringBuilder(@"F:\Photo\CN0340.JPG");
            GFL_EXIF_DATA ExifStruct;
            IntPtr pExif = gflLoadEXIF(name, 1);
            ExifStruct = (GFL_EXIF_DATA)Marshal.PtrToStructure(pExif, typeof(GFL_EXIF_DATA));
But right here (Marshal.PtrToStructure) I get the exception...

Do you have some tip for me? What do I wrong?

Re: Wrapper for .NET for GFL SDK - gflLoadEXIF()?

Posted: Sun May 10, 2009 3:35 pm
by xnview
I can send you a first version of my C# wrapper...

Re: Wrapper for .NET for GFL SDK - gflLoadEXIF()?

Posted: Fri Nov 13, 2009 12:50 pm
by Nike
Could you share this wrapper with me too?
I guess the best way is to use it in distribution of SDK.

Re: Wrapper for .NET for GFL SDK - gflLoadEXIF()?

Posted: Fri Nov 13, 2009 1:28 pm
by xnview
Nike wrote:Could you share this wrapper with me too?
I guess the best way is to use it in distribution of SDK.
I have only a beginning of VB.net wrapper

Re: Wrapper for .NET for GFL SDK - gflLoadEXIF()?

Posted: Thu Dec 10, 2009 3:17 pm
by fdfino
Is Possible to have C# wrapper
is sufficient to convert the gfllib.bas file from visual basic to c#?

Re: Wrapper for .NET for GFL SDK - gflLoadEXIF()?

Posted: Fri Feb 12, 2010 10:51 am
by Christophe
Hi,

If it's possible It will be great to have this wrapper, I'm working in VB.Net but C# will be enougth if you don't have it in VB.

For my part I work on a use of GDI32 in .Net

Thank's in advance.

NB: Encore merci pour ce travail, la GFL est un outil vraiment puissant, je suis encore obligé d'utiliser VB6 uniquement pour pouvoir en profiter, un wrapper pour le .Net serait
un très très gros cadeau !!

Christophe

Re: Wrapper for .NET for GFL SDK - gflLoadEXIF()?

Posted: Sat Feb 13, 2010 10:56 am
by Christophe
Hello

I had begun to test libgfl311 under VB.Net,

But there is something strange, on GFL_Loadbitmap I have an Erorr N° 6 unknow format. I test it with a picture in bmp, tif, jpg always the same.
in a public module

Code: Select all

Public Declare Sub gflGetDefaultLoadParams Lib "libgfl311.dll" (ByRef params As GFL_LOAD_PARAMS)
    '*********************************
    Public Declare Function gflLoadBitmap Lib "libgfl311.dll" (<MarshalAs(UnmanagedType.BStr)> ByVal filename As String, ByRef BITMAP As IntPtr, ByRef params As GFL_LOAD_PARAMS, ByRef info As GFL_FILE_INFORMATION) As Integer
    '*********************************


in a button_click

Code: Select all

Dim GflParams As GFL_LOAD_PARAMS
        Dim PtrBitmap As IntPtr
        Dim GflInfo As GFL_FILE_INFORMATION
        Dim Error1 As Integer

        gflLibraryInit()
        gflGetDefaultLoadParams(GflParams)

        With GflParams
            .Flags = GFL_LOAD_SKIP_ALPHA Or GFL_LOAD_BY_EXTENSION_ONLY
            .FormatIndex = -1
            .Origin = GFL_ORIGIN.GFL_BOTTOM_LEFT
            .ColorModel = GFL_BITMAP_TYPE.GFL_BGR 'Component order like DIB
            .LinePadding = 4 'Line padding on 4 bytes (32bits)
        End With


        Error1 = gflLoadBitmap("C:\test.bmp", PtrBitmap, GflParams, GflInfo)
        gflLibraryExit()
The gflparams structure is correctely filled by the call of gflgetdefaultloadparams. But Error1=6 after gflloadbitmap.
I had tryed an other declare for gflloadbitmap without marshalas but with "auto", it's the same error 6.
May be the string passed is not correct ??