#region MIT License /*Copyright (c) 2012 Robert Rouhani SharpFont based on Tao.FreeType, Copyright (c) 2003-2007 Tao Framework Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ #endregion using System; using System.Runtime.InteropServices; using SharpFont.Internal; namespace SharpFont { /// /// A function used to initialize (not create) a new module object. /// /// The module to initialize. /// FreeType error code. [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate Error ModuleConstructor([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ModuleMarshaler))] Module module); /// /// A function used to finalize (not destroy) a given module object. /// /// The module to finalize. [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void ModuleDestructor([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ModuleMarshaler))] Module module); /// /// A function used to query a given module for a specific interface. /// /// The module that contains the interface. /// The name of the interface in the module. /// The interface. [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate IntPtr ModuleRequester([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ModuleMarshaler))] Module module, [MarshalAs(UnmanagedType.LPStr)] string name); /// /// The module class descriptor. /// public class ModuleClass { #region Fields private IntPtr reference; private ModuleClassRec rec; #endregion #region Constructors internal ModuleClass(IntPtr reference) { Reference = reference; } #endregion #region Properties /// /// Gets bit flags describing the module. /// [CLSCompliant(false)] public uint Flags { get { return rec.module_flags; } } /// /// Gets the size of one module object/instance in bytes. /// public int Size { get { return (int)rec.module_size; } } /// /// Gets the name of the module. /// public string Name { get { return rec.module_name; } } /// /// Gets the version, as a 16.16 fixed number (major.minor). /// public int Version { get { return (int)rec.module_version; } } /// /// Gets the version of FreeType this module requires, as a 16.16 fixed number (major.minor). Starts at version /// 2.0, i.e., 0x20000. /// public int Requires { get { return (int)rec.module_requires; } } public IntPtr Interface { get { return rec.module_interface; } } /// /// Gets the initializing function. /// public ModuleConstructor Init { get { return rec.module_init; } } /// /// Gets the finalizing function. /// public ModuleDestructor Done { get { return rec.module_done; } } /// /// Gets the interface requesting function. /// public ModuleRequester GetInterface { get { return rec.get_interface; } } internal IntPtr Reference { get { return reference; } set { reference = value; rec = PInvokeHelper.PtrToStructure(reference); } } #endregion } }