コード例 #1
0
ファイル: Color.cs プロジェクト: alvinc-git/pdfmod
        public Poppler.Color Copy()
        {
            IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(this));

            System.Runtime.InteropServices.Marshal.StructureToPtr(this, this_as_native, false);
            IntPtr raw_ret = poppler_color_copy(this_as_native);

            Poppler.Color ret = Poppler.Color.New(raw_ret);
            ReadNative(this_as_native, ref this);
            System.Runtime.InteropServices.Marshal.FreeHGlobal(this_as_native);
            return(ret);
        }
コード例 #2
0
ファイル: Color.cs プロジェクト: alvinc-git/pdfmod
 static void ReadNative(IntPtr native, ref Poppler.Color target)
 {
     target = New(native);
 }
コード例 #3
0
        public void RenderSelection(Cairo.Context cairo, Poppler.Rectangle selection, Poppler.Rectangle old_selection, Poppler.SelectionStyle style, Poppler.Color glyph_color, Poppler.Color background_color)
        {
            IntPtr native_selection        = GLib.Marshaller.StructureToPtrAlloc(selection);
            IntPtr native_old_selection    = GLib.Marshaller.StructureToPtrAlloc(old_selection);
            IntPtr native_glyph_color      = GLib.Marshaller.StructureToPtrAlloc(glyph_color);
            IntPtr native_background_color = GLib.Marshaller.StructureToPtrAlloc(background_color);

            poppler_page_render_selection(Handle, cairo == null ? IntPtr.Zero : cairo.Handle, native_selection, native_old_selection, (int)style, native_glyph_color, native_background_color);
            selection = Poppler.Rectangle.New(native_selection);
            Marshal.FreeHGlobal(native_selection);
            old_selection = Poppler.Rectangle.New(native_old_selection);
            Marshal.FreeHGlobal(native_old_selection);
            glyph_color = Poppler.Color.New(native_glyph_color);
            Marshal.FreeHGlobal(native_glyph_color);
            background_color = Poppler.Color.New(native_background_color);
            Marshal.FreeHGlobal(native_background_color);
        }