示例#1
0
		void SetBGI(RipHandler handler)
		{
			var pane = handler?.ViewerControl as ViewerPane;
			var viewer = pane != null ? pane?.Viewer : null;
			
			if (BGI != null)
				BGI.Control = viewer;
			else
				BGI = new BGICanvas(viewer);
		}
示例#2
0
        void SetBGI(RipHandler handler)
        {
            var pane   = handler != null && handler.HasViewerControl ? handler.ViewerControl as ViewerPane : null;
            var viewer = pane != null ? pane.Viewer : null;

            if (BGI != null)
            {
                BGI.Control = viewer;
            }
            else
            {
                BGI = new BGICanvas(viewer);
            }
        }
示例#3
0
 public abstract void Set(RipHandler handler, bool forDrawing);
示例#4
0
        public void Load(Stream stream, RipDocument document, RipHandler handler)
        {
            var reader   = new BinaryReader(stream);
            var commands = document.Commands;

            commands.Clear();
            bool lastEnableZoom = true;

            /*
             */
            if (document.AnimateView && Application.Instance != null)
            {
                document.BGI.DelayDraw = true;                 // for faster animation
                Application.Instance.Invoke(delegate {
                    //lastEnableZoom = handler.EnableZoom;
#if DESKTOP
                    handler.EnableZoom = false;
#endif
                });
            }

            try {
                var args = new WaitEventArgs();
                while (true)
                {
                    if (document.AnimateView)
                    {
                        document.OnWait(args);
                        if (args.Exit)
                        {
                            break;
                        }
                    }
                    byte b = reader.ReadRipByte();

                    /*
                     */
                    if (b == (byte)'|')
                    {
                        string op = ((char)reader.ReadRipByte()).ToString();
                        if (op == "1")
                        {
                            op += ((char)reader.ReadRipByte());
                        }
                        else if (op == "#")
                        {
                            break;                             // done reading rip!
                        }
                        var command = RipCommands.Create(op, document);
                        if (command != null)
                        {
                            command.Read(reader);
                            command.Apply();
                            if (command.Store)
                            {
                                commands.Add(command);
                            }
                        }
                    }

                    /*
                     */
                }
            } catch (EndOfStreamException) {
            } finally {
                if (document.AnimateView && Application.Instance != null)
                {
                    Application.Instance.Invoke(delegate {
                        if (document.AnimateView)
                        {
                            handler.EnableZoom = lastEnableZoom;
                        }
                    });
                }
            }
        }