Beispiel #1
0
 public override void Draw(IDraw draw)
 {
     foreach(EditorContent content in this.ContentList)
     {
         content.Draw(draw);
     }
 }
Beispiel #2
0
 public void Add(IDraw draw)
 {
     if (draw != null)
     {
         list.Add(draw);
     }
 }
		/// <summary>
		/// Draws all registered Trails.
		/// </summary>
		public virtual void DrawTrails(IDraw drawer)
		{
			for (int i = 0; i < trails.Count; i++)
			{
				trails[i].Draw(drawer);
			}
		}
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Graphics g = this.panel1.CreateGraphics();
            g.Clear(Color.White);

            if(this.radioButton1.Checked)
                draw = new CairoAdapter(g);
            else
                draw = new GDIPlusAdapter(g);

            Random r = new Random();
            switch (r.Next(0, 5) % 3)
            {
                case 0:
                    MyRectangle rect = new MyRectangle(100, 150, 50, 50);
                    listshapeGraphics.addShape(rect);
                    rect.Draw(draw);
                    break;
                case 1:
                    MyRectangle rect1 = new MyRectangle(300, 150, 150, 50);
                    rect1.Draw(draw);
                    listshapeGraphics.addShape(rect1);
                    break;
                case 2:
                    MyEllipse ellipse = new MyEllipse(150, 170, 200, 100);
                    listshapeGraphics.addShape(ellipse);
                    ellipse.Draw(draw);
                    break;
            }

            g.Dispose();
        }
        public override void Draw(IDraw draw)
        {
            draw.DrawRectangleLine(1, this.Color, this.Rectangle.Left, this.Rectangle.Top,
                this.Rectangle.Width,
                this.Rectangle.Height,
                DrawLineStyle.Solid,
                null);                      // 绘制矩形

            draw.DrawLine(
                1, 
                this.Color, 
                this.Rectangle.Left,
                this.Rectangle.Top+this.Rectangle.Height/2,
                1,
                1,
                DrawLineStyle.Solid,
                null);                      // 绘制横线

            if (!this.Expand)
            {
                draw.DrawLine(1, this.Color, this.Rectangle.Left + this.Rectangle.Width / 2,
                    this.Rectangle.Top,
                    1,
                    1,
                    DrawLineStyle.Solid,
                    null);                  // 绘制竖线
            }
        }
 public BitmapExporter(IDraw draw, List<Shape.Shape> list)
     : base(draw, list)
 {
     bitmap = new Bitmap(Convert.ToInt32(1024), Convert.ToInt32(1024),
                    System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     g = Graphics.FromImage(bitmap);
     drawer.setGraphics(g);
 }
Beispiel #7
0
 public IDraw Multiply(IDraw draw)
 {
     int[] newDraw = new int[BallsArray.Length];
     for (int i = 0; i < BallsArray.Length; i++)
     {
         newDraw[i] = BallsArray[i] * draw.BallsArray[i];
     }
     return((IDraw)CreateDraw(newDraw, DrawDate));
 }
		/// <summary>
		/// Add a drawable item to this partition
		/// </summary>
		/// <param name="item"></param>
		public void Add(IDraw item)
		{
			runOptimize = true;

			if (processingActive)
				this.drawList.Add(item);
			else
				this.addList.Add(item);
		}
Beispiel #9
0
		public MenuItem(IDraw stateNormal, IDraw stateSelected, IDraw stateClicking)
        {
			ClickAction = null;
			Clickable = true;
			StateNormal = stateNormal;
			StateClicking = stateClicking;
			StateSelected = stateSelected;
			Normal();
        }
Beispiel #10
0
        private void UnexecuteLastCommand()
        {
            IDraw command = GetLastCommand();

            command?.Unexecute();
            if (_commands.Count > 0)
            {
                _commands.RemoveAt(_commands.Count - 1);
            }
        }
Beispiel #11
0
    void Start()
    {
        curDraw = _brush;

        var image = transform.GetComponent <RawImage>();

        _canvasTexture = new Texture2D((int)image.rectTransform.rect.width, (int)image.rectTransform.rect.height);
        image.texture  = _canvasTexture;
        Rest();
    }
Beispiel #12
0
        private void RemoveWidget(IComponent iWidget)
        {
            IDraw iDrawable = iWidget as IDraw;

            if (iDrawable != null)
            {
                serviceDocument.RemoveWidget(iWidget.Component as Widget);
                canvasDraw.Children.Remove(iDrawable as UIElement);
            }
        }
Beispiel #13
0
        public static IDraw S_DrawEnumPopup <TEnum>(this IDraw draw,
                                                    ref TEnum @enum,
                                                    string label   = null,
                                                    GUIStyle style = null)
            where TEnum : struct, IConvertible
        {
            EnumPopupDraw.Draw(ref @enum, label, style, null);

            return(draw);
        }
Beispiel #14
0
 private void AtachSingleItemEvents(IDraw iDraw)
 {
     if (iDraw == null)
     {
         throw new ArgumentNullException("iDraw", "iDraw can not be null");
     }
     // iDraw.MouseLeftButtonUp += new MouseButtonEventHandler(iDrawable_MouseLeftButtonUp);
     //
     iDraw.MouseLeftButtonDown += new MouseButtonEventHandler(iDrawable_MouseLeftButtonDown);
 }
Beispiel #15
0
        public static IDraw S_DrawStringsPopup(this IDraw draw,
                                               ref int selectedIndex,
                                               string[] displayedStrings,
                                               string label   = null,
                                               GUIStyle style = null)
        {
            StringsPopupDraw.Draw(ref selectedIndex, displayedStrings, label, style, null);

            return(draw);
        }
		/// <summary>
		/// Construct the DrawPredicate
		/// </summary>
		/// <param name="complex">The 'complex' object that is drawn based on the occlusion of the predicate</param>
		/// <param name="predicate">The 'simple' predicate object</param>
		public DrawPredicate(IDraw complex, IDraw predicate)
		{
			if (complex == null ||
				predicate == null)
				throw new ArgumentNullException();

			this.item = complex;
			this.predicate = predicate;

			this.supported = Application.GetApplicationInstance().IsHiDefDevice;
		}
Beispiel #17
0
        public static IDraw S_Button(this IDraw draw,
                                     string buttonText,
                                     Action buttonAction,
                                     GUIStyle style = null,
                                     Color?color    = null,
                                     bool lossFocus = false)
        {
            ButtonDraw.Draw(buttonText, buttonAction, style, null, color, lossFocus);

            return(draw);
        }
Beispiel #18
0
 // NOTE: No need to VisibilityChain in these events, because they terminate from the base.
 public override void DrawBase(IDraw renderArgument, Region dirty)
 {
     Draw(renderArgument, dirty);
     foreach (IComponent c in components)
     {
         if (c.visible && dirty.Intersects(c.DisplayRectangle))
         {
             c.DrawBase(renderArgument, dirty);
         }
     }
 }
Beispiel #19
0
        /// <summary>
        /// Construct the DrawPredicate
        /// </summary>
        /// <param name="complex">The 'complex' object that is drawn based on the occlusion of the predicate</param>
        /// <param name="predicate">The 'simple' predicate object</param>
        public DrawPredicate(IDraw complex, IDraw predicate)
        {
            if (complex == null ||
                predicate == null)
            {
                throw new ArgumentNullException();
            }

            this.item      = complex;
            this.predicate = predicate;
        }
Beispiel #20
0
 //#if UNITY_EDITOR
 void OnGUI()
 {
     if (GUI.Button(new Rect(0, 0, 150, 90), "橡皮擦"))
     {
         curDraw = _eraser;
     }
     if (GUI.Button(new Rect(0, 90, 150, 90), "画笔"))
     {
         curDraw = _brush;
     }
 }
Beispiel #21
0
        // Render methody
        public override void Draw(IDraw rt, Region dirty)
        {
            float lt = edge.strokeWidth;
            float bv = lt / 2;
            var   lr = DisplayRectangle.Inflated(new Thickness(-bv));
            var   ir = DisplayRectangle.Inflated(new Thickness(-lt));

            rt.uDraw.FillRectangle(ir, brushFill);
            rt.uDraw.DrawRectangle(lr, brushLine, edge);
            rt.uDraw.DrawText(textData, ir.Location, brushText, UTextDrawOptions.Clip, false);
        }
Beispiel #22
0
 public override void Draw(IDraw ra, Region dirty)
 {
     // Draw bg
     ra.uDraw.FillRectangle(DisplayRectangle, back);
     ra.uDraw.DrawRectangle(DisplayRectangle.Inflated(new Thickness(-.5f)), edge, edgeStroke);
     if (SelectionOptions.Count > 0)
     {
         Point tp = new Point(DisplayRectangle.left + textPad, DisplayRectangle.top + textPad);
         selectyTexty.text = SelectionOptions.Count > _selectedOption ? SelectionOptions[_selectedOption] : "";
         ra.uDraw.DrawText(selectyTexty, tp, edge, UTextDrawOptions.Clip, false);
     }
 }
Beispiel #23
0
 /// <summary>
 /// Called when the list of member nodes in the layer changes.
 /// </summary>
 protected virtual void OnMembershipChange()
 {
     this.drawObjects.Clear();
     foreach (INode curNode in this.members)
     {
         IDraw curDrawObj = curNode as IDraw;
         if (curDrawObj != null)
         {
             this.drawObjects.Add(curDrawObj);
         }
     }
 }
Beispiel #24
0
 public override void Draw(IDraw draw)
 {
     draw.DrawImage(this.Image, 0, 0, 
         this.Image.Width, 
         this.Image.Height,
         this.Rectangle.Left,
         this.Rectangle.Top,
         this.Rectangle.Width,
         this.Rectangle.Height,
         0,
         null);
 }
Beispiel #25
0
        private void UpdateTextLayout(IDraw sendMe = null)
        {
            float  roX = 0, roY = 0;
            Object passageLocker = new Object();

            lock (passageLocker)
            {
                if (sendMe == null)
                {
                    textLayoutNeedsUpdate = true;
                    Dirty(DisplayRectangle);
                    return;
                }
                else
                {
                    textLayoutNeedsUpdate = false;
                }

                // sort out some settings
                data.wrapped = layout == LayoutStyle.WrappedMultiLine;
                data.width   = PaddedRectangle.width;
                data.height  = PaddedRectangle.height;
                data.valign  = (layout == LayoutStyle.OneLine) ? UVAlign.Middle : UVAlign.Top;

                bool rev = caretPos > shiftOrigin;
                selectRange.start  = rev ? shiftOrigin : caretPos;
                selectRange.length = Math.Abs(caretPos - shiftOrigin);

                // get size of the render
                var   ti         = lastTextInfo = sendMe.uDraw.GetTextInfo(data);
                int   lines      = ti.numLines;
                Size  tms        = ti.minSize;
                float lineHeight = tms.height / (float)lines;

                // Get Caret location
                Point cp = sendMe.uDraw.HitText(caretPos, false, data);

                // determine render offset
                roX = cp.X > PaddedRectangle.width ? cp.X - PaddedRectangle.width : 0;
                roY = cp.Y > PaddedRectangle.height - lineHeight ? cp.Y - PaddedRectangle.height + lineHeight : 0;

                float yCenteringOffset = PaddedRectangle.height / 2 - lineHeight / 2;
                if (layout == LayoutStyle.OneLine)
                {
                    roY += yCenteringOffset;
                }

                // set caret line
                caret1 = new Point((float)Math.Round(PaddedRectangle.left + cp.X - roX) + 0.5f, (float)Math.Round(PaddedRectangle.top + cp.Y - roY));
                caret2 = new Point((float)Math.Round(PaddedRectangle.left + cp.X - roX) + 0.5f, (float)Math.Round(PaddedRectangle.top + cp.Y - roY + lineHeight));
            }
        }
Beispiel #26
0
        public override void Draw(IDraw renderArg, Region dirty)
        {
            if (invisible)
            {
                return;
            }
            renderArg.uDraw.FillRectangle(DisplayRectangle, background);
            float epad = 3;

            renderArg.uDraw.DrawLine(aof(new Point(1 * DisplayRectangle.width / 5, DisplayRectangle.height - epad)), aof(new Point(DisplayRectangle.width - epad, 1 * DisplayRectangle.height / 5)), foreground, lineStroke);
            renderArg.uDraw.DrawLine(aof(new Point(2 * DisplayRectangle.width / 5, DisplayRectangle.height - epad)), aof(new Point(DisplayRectangle.width - epad, 2 * DisplayRectangle.height / 5)), foreground, lineStroke);
            renderArg.uDraw.DrawLine(aof(new Point(3 * DisplayRectangle.width / 5, DisplayRectangle.height - epad)), aof(new Point(DisplayRectangle.width - epad, 3 * DisplayRectangle.height / 5)), foreground, lineStroke);
        }
Beispiel #27
0
        /// <summary>
        /// Add a drawable item to this partition
        /// </summary>
        /// <param name="item"></param>
        public void Add(IDraw item)
        {
            runOptimize = true;

            if (processingActive)
            {
                this.drawList.Add(item);
            }
            else
            {
                this.addList.Add(item);
            }
        }
Beispiel #28
0
        public static IDraw S_DrawLabel(this IDraw draw,
                                        string label,
                                        GUIStyle style = null)
        {
            if (label == null)
            {
                throw new ArgumentNullException(nameof(label));
            }

            LabelDraw.Draw(label, style, null);

            return(draw);
        }
Beispiel #29
0
 /// <summary>
 /// 添加一个渲染任务
 /// </summary>
 /// <param name="camera"></param>
 /// <param name="paniter"></param>
 public void AddGraphics(Camera camera, IDraw paniter)
 {
     if (m_GraphicsDic.ContainsKey(camera))
     {
         m_GraphicsDic[camera].AddGraphics(paniter);
     }
     else
     {
         GraphicsMono temp = camera.gameObject.AddComponent <GraphicsMono>();
         m_GraphicsDic.Add(camera, temp);
         temp.AddGraphics(paniter);
     }
 }
Beispiel #30
0
        // clique para criar linha
        private void CreateLineClick(object sender, EventArgs e)
        {
            ICreate ic = new LineCreator();

            // inicializa os listeners dos eventos
            ic.Finished  += LineCreated;
            ic.Cancelled += LineCancelled;

            ic.RegisterEvents(canvas);

            // muda o objeto atual para a linha
            _currObject = ic.Result;
        }
Beispiel #31
0
        public override void Draw(IDraw ra, Region dirty)
        {
            ra.uDraw.FillRectangle(DisplayRectangle, background);
            ra.uDraw.DrawText(textData, DisplayRectangle.Location, foreground, UTextDrawOptions.None, false);

            var  ti      = ra.uDraw.GetTextInfo(textData);
            int  nLines  = ti.numLines;
            Size minSize = ti.minSize;

            if ((autosizeX && minSize.width != Size.width) || (autosizeY && minSize.height != Size.height))
            {
                Size = new Size(autosizeX ? minSize.width : Size.width, autosizeY ? minSize.height : Size.height);
            }
        }
Beispiel #32
0
        private void drawingCanvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            var mouseLocation = e.GetPosition(drawingCanvas);
            var myCircle      = new Circle(100);

            IDraw drawCircle = myCircle;

            drawCircle.SetLocation((int)mouseLocation.X, (int)mouseLocation.Y);
            drawCircle.Draw(drawingCanvas);

            IColor colorCircle = myCircle;

            colorCircle.SetColor(Colors.HotPink);
        }
Beispiel #33
0
 public override void Draw(IDraw rt, Common.Region dirty)
 {
     base.Draw(rt, dirty);
     rt.uDraw.FillRectangle(DisplayRectangle, usb2);
     dtt(0, 0, UHAlign.Left, UVAlign.Top, new Color(1, 1, 0, 0), rt);
     dtt(100, 0, UHAlign.Center, UVAlign.Top, new Color(1, 1, 1, 0), rt);
     dtt(200, 0, UHAlign.Right, UVAlign.Top, new Color(1, 1, 0, 1), rt);
     dtt(0, 100, UHAlign.Left, UVAlign.Middle, new Color(1, 0, 1, 1), rt);
     dtt(100, 100, UHAlign.Center, UVAlign.Middle, new Color(1, 0, 1, 0), rt);
     dtt(200, 100, UHAlign.Right, UVAlign.Middle, new Color(1, 1, 1, 0), rt);
     dtt(0, 200, UHAlign.Left, UVAlign.Bottom, new Color(1, 1, 0, 1), rt);
     dtt(100, 200, UHAlign.Center, UVAlign.Bottom, new Color(1, 1, 1, 0), rt);
     dtt(200, 200, UHAlign.Right, UVAlign.Bottom, new Color(1, 0, 0, 1), rt);
 }
Beispiel #34
0
        public void Add(IDraw draw)
        {
            if (draw.Rectangle.Height > this.Rectangle.Height)
            {
                throw new ArgumentException("�ɴ�ӡ���Ӷ���߶ȳ���������ĸ߶ȣ�");
            }
            if (draw.Rectangle.Width > this.Rectangle.Width)
            {
                throw new ArgumentException("�ɴ�ӡ���Ӷ����ȳ���������Ŀ�ȣ�");
            }
            CheckAdd(draw);

            list.Add(draw);
        }
Beispiel #35
0
        private void drawingCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var mouseLocation = e.GetPosition(drawingCanvas);
            var mySquare      = new Square(100);

            IDraw drawSquare = mySquare;

            drawSquare.SetLocation((int)mouseLocation.X, (int)mouseLocation.Y);
            drawSquare.Draw(drawingCanvas);

            IColor colorSquare = mySquare;

            colorSquare.SetColor(Colors.BlueViolet);
        }
Beispiel #36
0
        public static void InitDraw()
        {
            switch (CConfig.Renderer)
            {
                case ERenderer.TR_CONFIG_SOFTWARE:
                    _Draw = new CDrawWinForm();
                    break;

                case ERenderer.TR_CONFIG_OPENGL:
                    try
                    {
                        _Draw = new COpenGL();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message + " - Error in initializing of OpenGL. Please check whether" +
                            " your graphic card drivers are up to date.");
                        CLog.LogError(e.Message + " - Error in initializing of OpenGL. Please check whether" +
                            " your graphic card drivers are up to date.");
                        Environment.Exit(Environment.ExitCode);
                    }
                    break;

#if WIN
                case ERenderer.TR_CONFIG_DIRECT3D:
                    try
                    {
                        _Draw = new CDirect3D();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message + " - Error in initializing of Direct3D. Please check if " +
                            "your DirectX redistributables and graphic card drivers are up to date. You can " +
                            "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
                    CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        CLog.LogError(e.Message + " - Error in initializing of Direct3D. Please check if " +
                            "your DirectX redistributables and graphic card drivers are up to date. You can " +
                            "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
                        Environment.Exit(Environment.ExitCode);
                    }
                    break;
#endif

                default:
                    _Draw = new CDrawWinForm();
                    break;
            }
            _Draw.Init();
        }
Beispiel #37
0
        public static float WarUnitGoDown(IDraw currentUnit, float moveSpeed, IReadOnlyDictionary <WarUnit, decimal> playerUnits, IReadOnlyDictionary <WarUnit, decimal> enemyUnits)
        {
            float unitTop;
            float unitBottom;
            float unitLeft;
            float unitRight;

            float pUp    = currentUnit.DrawCoord.Y;
            float pDown  = currentUnit.DrawCoord.Y + currentUnit.CropHeight;
            float pLeft  = currentUnit.DrawCoord.X;
            float pRight = currentUnit.DrawCoord.X + currentUnit.CropWidth;

            if (pDown + moveSpeed >= ScreenManager.SCREEN_HEIGHT)
            {
                return(0);
            }

            foreach (var unit in playerUnits.Keys)
            {
                unitTop    = unit.DrawCoord.Y;
                unitBottom = unit.DrawCoord.Y + unit.CropHeight;
                unitLeft   = unit.DrawCoord.X;
                unitRight  = unit.DrawCoord.X + unit.CropWidth;

                moveSpeed = HaveCollision(pDown, unitTop, pLeft, unitRight, pRight, unitLeft, moveSpeed);

                if (moveSpeed == 0)
                {
                    return(0);
                }
            }

            foreach (var unit in enemyUnits.Keys)
            {
                unitTop    = unit.DrawCoord.Y;
                unitBottom = unit.DrawCoord.Y + unit.CropHeight;
                unitLeft   = unit.DrawCoord.X;
                unitRight  = unit.DrawCoord.X + unit.CropWidth;

                moveSpeed = HaveCollision(pDown, unitTop, pLeft, unitRight, pRight, unitLeft, moveSpeed);

                if (moveSpeed == 0)
                {
                    return(0);
                }
            }

            return(moveSpeed);
        }
Beispiel #38
0
        public static void InitDraw()
        {
            switch (CConfig.Renderer)
            {
            case ERenderer.TR_CONFIG_SOFTWARE:
                _Draw = new CDrawWinForm();
                break;

            case ERenderer.TR_CONFIG_OPENGL:
                try
                {
                    _Draw = new COpenGL();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message + " - Error in initializing of OpenGL. Please check whether" +
                                    " your graphic card drivers are up to date.");
                    CLog.LogError(e.Message + " - Error in initializing of OpenGL. Please check whether" +
                                  " your graphic card drivers are up to date.");
                    Environment.Exit(Environment.ExitCode);
                }
                break;

#if WIN
            case ERenderer.TR_CONFIG_DIRECT3D:
                try
                {
                    _Draw = new CDirect3D();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message + " - Error in initializing of Direct3D. Please check if " +
                                    "your DirectX redistributables and graphic card drivers are up to date. You can " +
                                    "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
                                    CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    CLog.LogError(e.Message + " - Error in initializing of Direct3D. Please check if " +
                                  "your DirectX redistributables and graphic card drivers are up to date. You can " +
                                  "download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
                    Environment.Exit(Environment.ExitCode);
                }
                break;
#endif

            default:
                _Draw = new CDrawWinForm();
                break;
            }
            _Draw.Init();
        }
Beispiel #39
0
        public Adapter(IDraw draw, object rhomb) : base(draw)
        {
            Type rhombType = rhomb.GetType();

            FieldInfo[] field  = rhombType.GetFields();
            Point       point1 = (Point)field[0].GetValue(rhomb);
            Point       point2 = (Point)field[1].GetValue(rhomb);
            Point       point3 = new Point(point2.X + point2.X - point1.X, point1.Y);
            Point       point4 = new Point(point2.X, point1.Y + point1.Y - point2.Y);

            AddPoint(point1);
            AddPoint(point2);
            AddPoint(point3);
            AddPoint(point4);
        }
Beispiel #40
0
        public override void Draw(IDraw draw)
        {
            draw.DrawChar(this.m_content, this.FontColor, this.Font,
                this.Rectangle.Left,
                this.Rectangle.Top,
                0,
                null);

#if DEBUG
            // 绘制字符边距
            //draw.DrawRectangleLine(1, System.Drawing.Color.Red.ToArgb(), this.Rectangle.Left,
            //    this.Rectangle.Top, this.Rectangle.Width, this.Rectangle.Height,
            //    DrawLineStyle.Solid,null);
#endif
        }
Beispiel #41
0
 public void Add(IDraw draw)
 {
     if (draw.Rectangle.Height > this.Rectangle.Height)
     {
         throw new ArgumentException("可打印的子对象高度超出父对象的高度!");
     }
     if (draw.Rectangle.Width > this.Rectangle.Width)
     {
         throw new ArgumentException("可打印的子对象宽度超出父对象的宽度!");
     }
     CheckAdd(draw);
         
     list.Add(draw);
   
 }
		/// <summary>
		/// Add an item to the sorter
		/// </summary>
		/// <param name="item"></param>
		public void Add(IDraw item)
		{
			if (item == null)
				throw new ArgumentNullException();

			if (itemCount == items.Length)
			{
				Array.Resize(ref items, items.Length * 2);
				Array.Resize(ref depths, depths.Length * 2);
			}

			items[itemCount++] = new Entry() { item = item, addIndex = this.addCount++ };

			sortFrameIndex = sortEvery;
		}
Beispiel #43
0
        public void DrawBase(IDraw rt, Region dirty)
        {
            rt.uDraw.PushAxisAlignedClip(DisplayRectangle, false);
            Draw(rt, dirty);

            // Now we need to draw our childrens....
            foreach (IComponent c in components)
            {
                if (c.visible && dirty.Intersects(c.DisplayRectangle))
                {
                    c.DrawBase(rt, dirty);
                }
            }
            rt.uDraw.PopAxisAlignedClip();
        }
Beispiel #44
0
        /// <summary>
        /// Marca un TextField como seleccionado.
        /// </summary>
        /// <param name="selected">TextField que se marcará seleccionado.</param>
        private void MarkSelectedItem(TextField selected)
        {
            if (currentElement != null)
            {
                TextField textField = currentElement as TextField;
                textField.rectanglePrincipal.Stroke = new SolidColorBrush(Colors.Black);
            }
            currentElement = selected;
            TextField selectedItem = selected as TextField;

            selectedItem.rectanglePrincipal.Stroke = new SolidColorBrush(Colors.Red);

            checkBoxBold.IsChecked   = selected.TemplateListItem.Bold;
            checkBoxItalic.IsChecked = selected.TemplateListItem.Italic;
        }
Beispiel #45
0
        protected override void CheckAdd(IDraw draw)
        {
            if (draw.Rectangle.Y + draw.Rectangle.Height > this.Rectangle.Height)
            {
                throw new ArgumentException("�Բ�����ӵ�draw�������еĸ߶ȣ�");
            }
            if (draw.Rectangle.X+draw.Rectangle.Width > this.Rectangle.Width)
            {
                throw new ArgumentException("�Բ�����ӵ�draw��ȳ������еĿ�ȣ�");
            }

            /**
            * �����Ӷ���ĸ߶ȵ��������Ƿ񳬳�������ĸ߶ȣ�����˵���޷�������ӡint allheight = 0;
               foreach (IDraw tmp in list)
               {
               allheight += tmp.Rectangle.Height;
               }
               if (allheight > this.Rectangle.Height)
               {
               return false;
               }
               return true;*/
        }
Beispiel #46
0
        public override void Draw(IDraw draw)
        {
            if(TempDraw == null)
            {
                TempDraw = (IDraw)draw.Clone();
                this.SortContent();
            }

            int curIndex = -1;
            foreach (EditorContent content in this.ContentList)
            {
                curIndex++;

                // 此判断是判断需要绘制的内容对象是否被选中
                if (curIndex >= Math.Min(this.SelectStart, this.SelectEnd) && 
                    curIndex < Math.Max(this.SelectStart, this.SelectEnd))
                {
                    if (content.GetType() == typeof(EditorImage))
                    {
                        // 如果是图片,在选择状态下先画图片,再画选择的阴影
                        content.Draw(draw);
                        this.DrawBackground(draw, content, this.SelectBackgroundColor);
                    }
                    else
                    {
                        // 默认选中状态是先画背景阴影,再画内容
                        this.DrawBackground(draw, content, this.SelectBackgroundColor);
                        content.Draw(draw);
                    }
                }
                else
                {
                    // 如果是没被选中的内容,则直接绘制对象。
                    content.Draw(draw);
                }
            }
        }
Beispiel #47
0
        public void AddDrawObject(IDraw drawObject)
        {
            int depth = 3;
            if (drawObject is IBackgroundObject)
            {
                depth = 0;
            }
            else if (drawObject is IMapObject)
            {
                depth = 1;
            }
            else if (drawObject is IActor)
            {
                depth = 2;
            }

            this.drawObjects[depth].Add(drawObject);
        }
		/// <summary>
		/// Adds a drawable item into the list of items to be drawn to the draw target
		/// </summary>
		/// <param name="index"></param>
		/// <param name="drawable"></param>
		public void Insert(int index, IDraw drawable)
		{
			drawList.Insert(index, drawable);
		}
		/// <summary>
		/// Removes a drawable item from the list of items to be drawn to the draw target
		/// </summary>
		/// <param name="drawable"></param>
		/// <returns>true if the item was removed</returns>
		public bool Remove(IDraw drawable)
		{
			return drawList.Remove(drawable);
		}
Beispiel #50
0
 /// <summary>
 /// 绘制编辑器对象
 /// </summary>
 public abstract void Draw(IDraw draw);
		/// <summary>
		/// Adds a drawable item to the list of items to be drawn to the draw target
		/// </summary>
		/// <param name="drawable"></param>
		public void Add(IDraw drawable)
		{
			drawList.Add(drawable);
		}
Beispiel #52
0
        /// <summary>
        /// Draws the trail as a dotted line, fading away with age.
        /// </summary>
        public void Draw(IDraw drawer)
        {
            int index = _currentIndex;
            for (int j = 0; j < _vertices.Length; j++)
            {
                // index of the next vertex (mod around ring buffer)
                int next = (index + 1) % _vertices.Length;

                // "tick mark": every second, draw a segment in a different color
                bool tick = ((_flags[index] & 2) != 0 || (_flags[next] & 2) != 0);
                Color color = tick ? _tickColor : _trailColor;

                // draw every other segment
                if ((_flags[index] & 1) != 0)
                {
                    if (j == 0)
                    {
                        // draw segment from current position to first trail point
                        drawer.LineAlpha(_currentPosition, _vertices[index], color, 1);
                    }
                    else
                    {
                        // draw trail segments with opacity decreasing with age
                        const float minO = 0.05f; // minimum opacity
                        float fraction = (float)j / _vertices.Length;
                        float opacity = (fraction * (1 - minO)) + minO;
                        drawer.LineAlpha(_vertices[index], _vertices[next], color, opacity);
                    }
                }
                index = next;
            }
        }
Beispiel #53
0
 public override void Draw(IDraw draw)
 {
     return;
 }
		/// <summary>Implemented by a subclass</summary>
		protected abstract void AddItem(IDraw item, ref Vector3 minBounds, ref Vector3 maxBounds);
 public void DrawTrails(IDraw drawer)
 {
 }
		public GeometryDrawer(IDraw geometry, IShader shader, IShader wireframeShader)
		{
			this.geometry = geometry;
			this.shader = shader;
			this.wireframeShader = wireframeShader;
		}
 //Я буду гореть в аду за это название.
 private IDraw FindSolarOrBlackHoleSystemWithObject(IDraw toFind)
 {
     foreach (IDraw obj in screens["GalaxyMap"].Objects["Map"].ToMap().Objects)
     {
         if (obj is StarOnMap)
         {
             foreach (IDraw obj2 in obj.ToStarOnMap().SS.Objects)
             {
                 if (Object.ReferenceEquals(toFind, obj2))
                 {
                     return obj.ToStarOnMap().SS;
                 }
             }
         }
         else if (obj is BlackHoleOnMap)
         {
             foreach (IDraw obj2 in obj.ToBlackHoleOnMap().System.Objects)
             {
                 if (Object.ReferenceEquals(toFind, obj2))
                 {
                     return obj.ToBlackHoleOnMap().System;
                 }
             }
         }
     }
     return null;
 }
Beispiel #58
0
 public override void Draw(IDraw draw) {
     CreateCaret(this.WindowHandle, IntPtr.Zero, (int)this.Rectangle.Width, (int)this.Rectangle.Height);
     SetCaretPos((int)this.Rectangle.Left, (int)this.Rectangle.Top);
 }
Beispiel #59
0
 public Exporter(IDraw draw, List<Shape.Shape> list)
 {
     drawer = draw;
     listShape = list;
 }
Beispiel #60
0
		/// <summary>
		/// Sets the state.
		/// Change for the good IDraw.
		/// </summary>
		/// <param name="state">State.</param>
		protected void SetState(IDraw state)
		{
			if (CurrentState != state) {
				if (state != null) {
					RemoveChild(CurrentState);
					if (state.Parent == null) {
						AddChild(state);
					}
					CurrentState = state;
				} else {
					RemoveChild(CurrentState);
					if (StateNormal.Parent == null) {
						AddChild(StateNormal);
					}
					CurrentState = StateNormal;
				}
			}
		}