public DeviceEngine(string type)
        {
            this._initialize = Initialize;
            this._format = Format;
            this._finalize = Finalize;

            unsafe
            {
                gvdevice_engine_t* deviceEngine = (gvdevice_engine_t*)Marshal.AllocHGlobal(Marshal.SizeOf(typeof(gvdevice_engine_t)));
                _deviceEngine = new SafeMarshalHGlobalHandle((IntPtr)deviceEngine, true);

                *deviceEngine = new gvdevice_engine_t();
                deviceEngine->initialize = Marshal.GetFunctionPointerForDelegate(_initialize);
                deviceEngine->format = Marshal.GetFunctionPointerForDelegate(_format);
                deviceEngine->finalize = Marshal.GetFunctionPointerForDelegate(_finalize);

                gvdevice_features_t* deviceFeatures = (gvdevice_features_t*)Marshal.AllocHGlobal(Marshal.SizeOf(typeof(gvdevice_features_t)));
                _deviceFeatures = new SafeMarshalHGlobalHandle((IntPtr)deviceFeatures, true);

                *deviceFeatures = new gvdevice_features_t();
                deviceFeatures->flags = DeviceFeatures.None;
                deviceFeatures->default_margin = new pointf(36, 36);
                deviceFeatures->default_pagesize = new pointf(612, 792);
                deviceFeatures->default_dpi = new pointf(72, 72);

                gvplugin_installed_t* installedPluginData = (gvplugin_installed_t*)Marshal.AllocHGlobal(2 * Marshal.SizeOf(typeof(gvplugin_installed_t)));
                _installedPluginData = new SafeMarshalHGlobalHandle((IntPtr)installedPluginData, true);
                _engineType = new SafeMarshalHGlobalHandle(Marshal.StringToHGlobalAnsi(type), true);

                installedPluginData->id = 0;
                installedPluginData->type = (byte*)_engineType.DangerousGetHandle();
                installedPluginData->quality = 0;
                installedPluginData->engine = deviceEngine;
                installedPluginData->features = deviceFeatures;
                installedPluginData[1] = new gvplugin_installed_t();
            }
        }
        public TextLayoutEngine(string type)
        {
            unsafe
            {
                this._textlayout = TextLayout;

                gvtextlayout_engine_t* textLayoutEngine = (gvtextlayout_engine_t*)Marshal.AllocHGlobal(Marshal.SizeOf(typeof(gvtextlayout_engine_t)));
                _textLayoutEngine = new SafeMarshalHGlobalHandle((IntPtr)textLayoutEngine, true);

                *textLayoutEngine = new gvtextlayout_engine_t();
                textLayoutEngine->textlayout = Marshal.GetFunctionPointerForDelegate(_textlayout);

                gvplugin_installed_t* installedPluginData = (gvplugin_installed_t*)Marshal.AllocHGlobal(2 * Marshal.SizeOf(typeof(gvplugin_installed_t)));
                _installedPluginData = new SafeMarshalHGlobalHandle((IntPtr)installedPluginData, true);
                _engineType = new SafeMarshalHGlobalHandle(Marshal.StringToHGlobalAnsi(type), true);

                installedPluginData->id = 0;
                installedPluginData->type = (byte*)_engineType.DangerousGetHandle();
                installedPluginData->quality = 0;
                installedPluginData->engine = textLayoutEngine;
                installedPluginData->features = null;
                installedPluginData[1] = new gvplugin_installed_t();
            }
        }
        public RenderEngine(string type)
        {
            this._begin_job = BeginJob;
            this._end_job = EndJob;
            this._begin_graph = BeginGraph;
            this._end_graph = EndGraph;
            this._begin_layer = BeginLayer;
            this._end_layer = EndLayer;
            this._begin_page = BeginPage;
            this._end_page = EndPage;
            this._begin_cluster = BeginCluster;
            this._end_cluster = EndCluster;
            this._begin_nodes = BeginNodes;
            this._end_nodes = EndNodes;
            this._begin_edges = BeginEdges;
            this._end_edges = EndEdges;
            this._begin_node = BeginNode;
            this._end_node = EndNode;
            this._begin_edge = BeginEdge;
            this._end_edge = EndEdge;
            this._begin_anchor = BeginAnchor;
            this._end_anchor = EndAnchor;
            this._begin_label = BeginLabel;
            this._end_label = EndLabel;
            this._textpara = TextParagraph;
            this._resolve_color = ResolveColor;
            this._ellipse = Ellipse;
            this._polygon = Polygon;
            this._beziercurve = BezierCurve;
            this._polyline = Polyline;
            this._comment = Comment;
            this._library_shape = LibraryShape;

            unsafe
            {
                gvrender_engine_t* renderEngine = (gvrender_engine_t*)Marshal.AllocHGlobal(Marshal.SizeOf(typeof(gvrender_engine_t)));
                _renderEngine = new SafeMarshalHGlobalHandle((IntPtr)renderEngine, true);

                *renderEngine = new gvrender_engine_t();
                renderEngine->begin_job = Marshal.GetFunctionPointerForDelegate(_begin_job);
                renderEngine->end_job = Marshal.GetFunctionPointerForDelegate(_end_job);
                renderEngine->begin_graph = Marshal.GetFunctionPointerForDelegate(_begin_graph);
                renderEngine->end_graph = Marshal.GetFunctionPointerForDelegate(_end_graph);
                renderEngine->begin_layer = Marshal.GetFunctionPointerForDelegate(_begin_layer);
                renderEngine->end_layer = Marshal.GetFunctionPointerForDelegate(_end_layer);
                renderEngine->begin_page = Marshal.GetFunctionPointerForDelegate(_begin_page);
                renderEngine->end_page = Marshal.GetFunctionPointerForDelegate(_end_page);
                renderEngine->begin_cluster = Marshal.GetFunctionPointerForDelegate(_begin_cluster);
                renderEngine->end_cluster = Marshal.GetFunctionPointerForDelegate(_end_cluster);
                renderEngine->begin_nodes = Marshal.GetFunctionPointerForDelegate(_begin_nodes);
                renderEngine->end_nodes = Marshal.GetFunctionPointerForDelegate(_end_nodes);
                renderEngine->begin_edges = Marshal.GetFunctionPointerForDelegate(_begin_edges);
                renderEngine->end_edges = Marshal.GetFunctionPointerForDelegate(_end_edges);
                renderEngine->begin_node = Marshal.GetFunctionPointerForDelegate(_begin_node);
                renderEngine->end_node = Marshal.GetFunctionPointerForDelegate(_end_node);
                renderEngine->begin_edge = Marshal.GetFunctionPointerForDelegate(_begin_edge);
                renderEngine->end_edge = Marshal.GetFunctionPointerForDelegate(_end_edge);
                renderEngine->begin_anchor = Marshal.GetFunctionPointerForDelegate(_begin_anchor);
                renderEngine->end_anchor = Marshal.GetFunctionPointerForDelegate(_end_anchor);
                renderEngine->begin_label = Marshal.GetFunctionPointerForDelegate(_begin_label);
                renderEngine->end_label = Marshal.GetFunctionPointerForDelegate(_end_label);
                renderEngine->textpara = Marshal.GetFunctionPointerForDelegate(_textpara);
                renderEngine->resolve_color = Marshal.GetFunctionPointerForDelegate(_resolve_color);
                renderEngine->ellipse = Marshal.GetFunctionPointerForDelegate(_ellipse);
                renderEngine->polygon = Marshal.GetFunctionPointerForDelegate(_polygon);
                renderEngine->beziercurve = Marshal.GetFunctionPointerForDelegate(_beziercurve);
                renderEngine->polyline = Marshal.GetFunctionPointerForDelegate(_polyline);
                renderEngine->comment = Marshal.GetFunctionPointerForDelegate(_comment);
                renderEngine->library_shape = Marshal.GetFunctionPointerForDelegate(_library_shape);

                gvrender_features_t* renderFeatures = (gvrender_features_t*)Marshal.AllocHGlobal(Marshal.SizeOf(typeof(gvrender_features_t)));
                _renderFeatures = new SafeMarshalHGlobalHandle((IntPtr)renderFeatures, true);
                *renderFeatures = new gvrender_features_t();

                gvplugin_installed_t* installedPluginData = (gvplugin_installed_t*)Marshal.AllocHGlobal(2 * Marshal.SizeOf(typeof(gvplugin_installed_t)));
                _installedPluginData = new SafeMarshalHGlobalHandle((IntPtr)installedPluginData, true);
                _engineType = new SafeMarshalHGlobalHandle(Marshal.StringToHGlobalAnsi(type), true);

                installedPluginData->id = 0;
                installedPluginData->type = (byte*)_engineType.DangerousGetHandle();
                installedPluginData->quality = 0;
                installedPluginData->engine = renderEngine;
                installedPluginData->features = renderFeatures;
                installedPluginData[1] = new gvplugin_installed_t();
            }
        }