Draw() public abstract méthode

public abstract Draw ( ) : void
Résultat void
        public void FillEllipse(Brush brush, float x, float y, float width, float height)
        {
            SetOffset(true);
            StartDrawing();
            var rect = new CGRect(x, y, width, height);

            Control.AddEllipseInRect(rect);
            brush.Draw(this, false, FillMode.Winding);
            EndDrawing();
        }
        public void FillPath(Brush brush, IGraphicsPath path)
        {
            SetOffset(true);
            StartDrawing();

            Control.BeginPath();
            Control.AddPath(path.ToCG());
            Control.ClosePath();
            brush.Draw(this, false, FillMode.Winding);
            EndDrawing();
        }
Exemple #3
0
        public void FillRectangle(Brush brush, float x, float y, float width, float height)
        {
            SetOffset(true);
            StartDrawing();
            var rect = new CGRect(x, y, width, height);

            Control.AddRect(rect);
            Control.Clip();
            brush.Draw(this, rect.ToEto());
            EndDrawing();
        }
Exemple #4
0
        private void Overlay_MouseMove(object sender, MouseEventArgs e)
        {
            if (StylusActive)
            {
                return;
            }

            Point pos = e.GetPosition(glControlHost);

            if (e.MiddleButton == MouseButtonState.Pressed)
            {
                offsetX -= (int)pos.X - preX;
                offsetY += (int)pos.Y - preY;
                SetCam();
                RefreshOverlay();
                glControl.Refresh();

                preX = (int)pos.X;
                preY = (int)pos.Y;
            }
            else if (WintabUtility.PenButtonPressed)
            {
                if (!PenDraging)
                {
                    preX       = (int)pos.X;
                    preY       = (int)pos.Y;
                    PenDraging = true;
                }
                offsetX -= ((int)pos.X - preX) * 2;
                offsetY += ((int)pos.Y - preY) * 2;
                SetCam();
                RefreshOverlay();
                glControl.Refresh();

                preX = (int)pos.X;
                preY = (int)pos.Y;
            }
            else if (e.LeftButton == MouseButtonState.Pressed)
            {
                if (Brush == null || ShowingElement == null)
                {
                    return;
                }

                Brush.Draw(GetImageCoord(this, e.GetPosition(null), ZoomPerCent / 100.0));
            }
            else
            {
                PenDraging = false;
            }
        }
Exemple #5
0
        /// <summary>
        /// Draw in gameworld.
        /// </summary>
        /// <param name="spriteBatch"></param>
        public static void Draw(SpriteBatch spriteBatch)
        {
            if (!IsIntersectingUi())
            {
                Brush.Draw(spriteBatch);
            }

            //spriteBatch.Draw(Main.DefaultTexture, EditorRectangle, Color.White);
            GameWorld.PlayerTrail.Draw(spriteBatch);

            foreach (var line in InteractableConnections)
            {
                line.Draw(spriteBatch);
            }
        }
Exemple #6
0
        /// <inheritdoc />
        public override void Draw()
        {
            base.Draw();

            if (Brush == null)
            {
                return;
            }

            Rectangle rect;

            if (KeepAspectRatio)
            {
                // Figure out the ratio
                var size      = Size;
                var imageSize = Brush.Size;
                if (imageSize.LengthSquared < 1)
                {
                    return;
                }
                var ratio       = size / imageSize;
                var aspectRatio = ratio.MinValue;

                // Get the new height and width
                var newSize = imageSize * aspectRatio;

                // Calculate the X,Y position of the upper-left corner
                // (one of these will always be zero)
                var newPos = (size - newSize) / 2;

                rect = new Rectangle(newPos, newSize);
            }
            else
            {
                rect = new Rectangle(Vector2.Zero, Size);
            }

            Margin.ShrinkRectangle(ref rect);

            var color = IsMouseOver ? MouseOverColor : Color;

            if (!Enabled)
            {
                color *= DisabledTint;
            }
            Brush.Draw(rect, color);
        }
Exemple #7
0
        public void FillEllipse(Brush brush, float x, float y, float width, float height)
        {
            SetOffset(true);
            StartDrawing();

            /*	if (width == 1 || height == 1)
             * {
             *      DrawLine(color, x, y, x+width-1, y+height-1);
             *      return;
             * }*/
            var rect = new CGRect(x, y, width, height);

            Control.AddEllipseInRect(rect);
            Control.Clip();
            brush.Draw(this, rect.ToEto());
            EndDrawing();
        }
Exemple #8
0
    public void AddBox(Transform brushTransform, Vector3 extents, float powerScale, float fadeRadius)
    {
        Matrix4x4 invTransformMtx = brushTransform.worldToLocalMatrix * transform.localToWorldMatrix;

        Brush newBrush = new Brush(Brush.Shape.box, invTransformMtx, fadeRadius, powerScale, 1.0f, extents);

        newBrush.Draw(this);

        if (bSaveBrushHistory)
        {
            _brushHistory.Add(newBrush);

                        #if UNITY_EDITOR
            UnityEditor.EditorUtility.SetDirty(this);
                        #endif
        }

        CreateMesh();
    }
        public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
        {
            SetOffset(true);
            StartDrawing();

            var rect = new CGRect(x, y, width, height);

            Control.SaveState();             // save so the drawing of the brush isn't affected by the transform
            var yscale  = rect.Height / rect.Width;
            var centerY = rect.GetMidY();
            var centerX = rect.GetMidX();

            Control.ConcatCTM(new CGAffineTransform(1.0f, 0, 0, yscale, 0, centerY - centerY * yscale));
            Control.MoveTo(centerX, centerY);
            Control.AddArc(centerX, centerY, rect.Width / 2, CGConversions.DegreesToRadians(startAngle), CGConversions.DegreesToRadians(startAngle + sweepAngle), sweepAngle < 0);
            Control.AddLineToPoint(centerX, centerY);
            Control.ClosePath();
            Control.RestoreState();
            brush.Draw(this, false, FillMode.Winding);
            EndDrawing();
        }
Exemple #10
0
        private void Overlay_StylusMove(object sender, StylusEventArgs e)
        {
            StylusActive = true;

            Point pos = e.GetPosition(glControlHost);

            StylusPressure = e.GetStylusPoints(null)[0].PressureFactor;

            if (WintabUtility.PenButtonPressed)
            {
                if (!PenDraging)
                {
                    preX       = (int)pos.X;
                    preY       = (int)pos.Y;
                    PenDraging = true;
                }
                offsetX -= ((int)pos.X - preX) * 2;
                offsetY += ((int)pos.Y - preY) * 2;
                SetCam();
                RefreshOverlay();
                glControl.Refresh();

                preX = (int)pos.X;
                preY = (int)pos.Y;
            }
            else if (!e.InAir)
            {
                if (Brush == null || ShowingElement == null)
                {
                    return;
                }

                Brush.Draw(GetImageCoord(this, e.GetPosition(null), ZoomPerCent / 100.0));
            }
            else
            {
                PenDraging = false;
            }
        }
Exemple #11
0
        public void FillPath(Brush brush, IGraphicsPath path)
        {
            SetOffset(true);
            StartDrawing();

            Control.BeginPath();
            Control.AddPath(path.ToCG());
            Control.ClosePath();
            switch (path.FillMode)
            {
            case FillMode.Alternate:
                Control.EOClip();
                break;

            case FillMode.Winding:
                Control.Clip();
                break;

            default:
                throw new NotSupportedException();
            }
            brush.Draw(this, path.Bounds);
            EndDrawing();
        }
Exemple #12
0
 public void Finish(GraphicsHandler graphics)
 {
     Brush.Draw(graphics, true, FillMode.Winding);
 }
Exemple #13
0
 public void DrawOnScreen()
 {
     Brush.Draw(GetDataToDraw());
 }