예제 #1
0
 static void OverrideDrawGlyphItem(GLib.GType gtype, DrawGlyphItemNativeDelegate callback)
 {
     unsafe {
         IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("draw_glyph_item"));
         *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback);
     }
 }
예제 #2
0
        private void InternalDrawGlyphItem(string text, Pango.GlyphItem glyph_item, int x, int y)
        {
            DrawGlyphItemNativeDelegate unmanaged = class_abi.BaseOverride <DrawGlyphItemNativeDelegate>(this.LookupGType(), "draw_glyph_item");

            if (unmanaged == null)
            {
                return;
            }

            IntPtr native_text       = GLib.Marshaller.StringToPtrGStrdup(text);
            IntPtr native_glyph_item = GLib.Marshaller.StructureToPtrAlloc(glyph_item);

            unmanaged(this.Handle, native_text, native_glyph_item, x, y);
            GLib.Marshaller.Free(native_text);
            Marshal.FreeHGlobal(native_glyph_item);
        }
예제 #3
0
        private void InternalDrawGlyphItem(string text, Pango.GlyphItem glyph_item, int x, int y)
        {
            DrawGlyphItemNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("draw_glyph_item"));
                unmanaged = (DrawGlyphItemNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(DrawGlyphItemNativeDelegate));
            }
            if (unmanaged == null)
            {
                return;
            }

            IntPtr native_text       = GLib.Marshaller.StringToPtrGStrdup(text);
            IntPtr native_glyph_item = GLib.Marshaller.StructureToPtrAlloc(glyph_item);

            unmanaged(this.Handle, native_text, native_glyph_item, x, y);
            GLib.Marshaller.Free(native_text);
            Marshal.FreeHGlobal(native_glyph_item);
        }