internal RopOutput(RopBind own, OutputCallBack outputCB) { this.own = new WeakReference <RopBind>(own); this.lib = own.getLib(); this.oid = null; this.outputCB = outputCB; }
public RopOutput create_output(OutputCallBack outputCB, Object app_ctx, int tag = 0) { RopOutput outp = new RopOutput(this, outputCB); int ret = (int)lib.rnp_output_to_callback(out RopHandle hnd, outp, app_ctx); outp.Attach(Util.PopHandle(lib, hnd, ret)); PutObj(outp, tag); return(outp); }
/// <summary> /// Calls the Ghostscript API with a collection of arguments to be passed to it /// </summary> private static void CallAPI(string[] args) { IntPtr gsInstancePtr; // Get a pointer to an instance of the Ghostscript API and run the API with the current arguments output = new StringBuilder(); List<string> test = args.ToList<string>(); StringBuilder sb = new StringBuilder(); foreach (string str in test) { sb.Append(str + " "); } Console.WriteLine("GhostscriptSharp Params Used: " + sb.ToString()); lock (resourceLock) { CreateAPIInstance(out gsInstancePtr, IntPtr.Zero); OutputCallBack callBack = new OutputCallBack(GeneralOutput); int intReturn = SetOuputCallback(gsInstancePtr, callBack, callBack, callBack); if (output == null) output = new StringBuilder(); else output.Remove(0, output.Length); try { int result = InitAPI(gsInstancePtr, args.Length, args); if (result < 0) { throw new ExternalException("Ghostscript conversion error", result); } } finally { Cleanup(gsInstancePtr); } } }
private static extern int SetOuputCallback(IntPtr instance, OutputCallBack input, OutputCallBack output, OutputCallBack error);
public static void SetCallBack(OutputCallBack cb) { gpCallBack = cb; }