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();
            }
        }
Exemple #2
0
        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();
            }
        }