Beispiel #1
0
        public void PaintWorld(WorldLayer layer)
        {
            var visible = !Hud.Game.IsInTown && (Hud.Game.MapMode == MapMode.Minimap);

            if (!Fader.TestVisiblity(visible))
            {
                return;
            }

            var skill = Hud.Game.Me.Powers.UsedSkills.Where(x => x.SnoPower.Sno == Hud.Sno.SnoPowers.Necromancer_Frailty.Sno).FirstOrDefault();

            if (skill == null)
            {
                return;
            }
            if (Hud.Render.UiHidden)
            {
                return;
            }
            var skillRune = Hud.Game.Me.Powers.UsedNecromancerPowers.Frailty.RuneNameEnglish;

            if (string.Equals(skillRune, "Aura of Frailty"))
            {
                OutlineBrush.DrawWorldEllipse(TotalRadius, -1, Hud.Game.Me.FloorCoordinate);
                FillBrush.DrawWorldEllipse(TotalRadius, -1, Hud.Game.Me.FloorCoordinate);
            }
        }
Beispiel #2
0
        public virtual void Deserialize(ElementPropertyBag epb)
        {
            Id = epb.Id;
            DisplayRectangle = epb.DisplayRectangle;
            BorderPen.Dispose();
            BorderPen = new Pen(epb.BorderPenColor, epb.BorderPenWidth);
            FillBrush.Dispose();
            FillBrush = new SolidBrush(epb.FillBrushColor);
            Text      = epb.Text;
            TextColor = epb.TextColor;
            TextFont.Dispose();
            FontStyle fontStyle = (epb.TextFontUnderline ? FontStyle.Underline : FontStyle.Regular) | (epb.TextFontItalic ? FontStyle.Italic : FontStyle.Regular) | (epb.TextFontStrikeout ? FontStyle.Strikeout : FontStyle.Regular);

            TextFont = new Font(epb.TextFontFamily, epb.TextFontSize, fontStyle);

            HasCornerAnchors    = epb.HasCornerAnchors;
            HasCenterAnchors    = epb.HasCenterAnchors;
            HasLeftRightAnchors = epb.HasLeftRightAnchors;
            HasTopBottomAnchors = epb.HasTopBottomAnchors;

            HasCornerConnections    = epb.HasCornerConnections;
            HasCenterConnections    = epb.HasCenterConnections;
            HasLeftRightConnections = epb.HasLeftRightConnections;
            HasTopBottomConnections = epb.HasTopBottomConnections;
        }
Beispiel #3
0
        public virtual void Deserialize(ElementPropertyBag epb)
        {
            Id = epb.Id;

            if (!String.IsNullOrEmpty(epb.Json))
            {
                Json = JsonConvert.DeserializeObject <Dictionary <string, string> >(epb.Json);
            }

            DisplayRectangle = epb.DisplayRectangle;
            BorderPen.Dispose();
            BorderPen = new Pen(epb.BorderPenColor, epb.BorderPenWidth);
            FillBrush.Dispose();
            FillBrush = new SolidBrush(epb.FillBrushColor);
            Text      = epb.Text;
            TextColor = epb.TextColor;
            // If missing (backwards compatibility) middle-center align.
            TextAlign = epb.TextAlign == 0 ? ContentAlignment.MiddleCenter : epb.TextAlign;
            TextFont.Dispose();
            FontStyle fontStyle = (epb.TextFontUnderline ? FontStyle.Underline : FontStyle.Regular) | (epb.TextFontItalic ? FontStyle.Italic : FontStyle.Regular) | (epb.TextFontStrikeout ? FontStyle.Strikeout : FontStyle.Regular);

            TextFont = new Font(epb.TextFontFamily, epb.TextFontSize, fontStyle);

            HasCornerAnchors    = epb.HasCornerAnchors;
            HasCenterAnchors    = epb.HasCenterAnchors;
            HasLeftRightAnchors = epb.HasLeftRightAnchors;
            HasTopBottomAnchors = epb.HasTopBottomAnchors;

            HasCornerConnections    = epb.HasCornerConnections;
            HasCenterConnections    = epb.HasCenterConnections;
            HasLeftRightConnections = epb.HasLeftRightConnections;
            HasTopBottomConnections = epb.HasTopBottomConnections;
        }
Beispiel #4
0
        public BasicStyleCache(BasicStyle style)
        {
            if (style == null)
            {
                return;
            }

            Thickness     = style.Thickness;
            HalfThickness = Thickness / 2.0;

            if (style.Fill != null)
            {
                FillBrush = ToBrush(style.Fill);
                FillBrush.Freeze();
            }

            if (style.Stroke != null)
            {
                StrokeBrush = ToBrush(style.Stroke);
                StrokeBrush.Freeze();

                StrokePen = new Pen(StrokeBrush, Thickness);
                StrokePen.Freeze();
            }
        }
Beispiel #5
0
        internal override void Render(SKSurface surface, SKImageInfo info)
        {
            if (Geometry is CompositionPathGeometry cpg)
            {
                if (cpg.Path?.GeometrySource is SkiaGeometrySource2D geometrySource)
                {
                    if (FillBrush != null)
                    {
                        FillBrush.UpdatePaint(TryCreateFillPaint());

                        surface.Canvas.DrawPath(geometrySource.Geometry, _fillPaint);
                    }

                    if (StrokeBrush != null)
                    {
                        var strokePaint = TryCreateStrokePaint();

                        if (StrokeBrush is CompositionColorBrush stroke)
                        {
                            strokePaint.StrokeWidth = StrokeThickness;
                            strokePaint.Color       = stroke.Color.ToSKColor(Compositor.CurrentOpacity);
                        }

                        surface.Canvas.DrawPath(geometrySource.Geometry, _strokePaint);
                    }
                }
                else if (cpg.Path?.GeometrySource is null)
                {
                }
                else
                {
                    throw new InvalidOperationException($"CompositionPath does not support the {cpg.Path?.GeometrySource} geometry source");
                }
            }
        }
Beispiel #6
0
 void IDisposable.Dispose()
 {
     VeryLargeFont.Dispose();
     VeryLargeFont.Dispose();
     LargeFont.Dispose();
     MediumFont.Dispose();
     SmallFont.Dispose();
     VerySmallFont.Dispose();
     FillBrush.Dispose();
     AccentBrush.Dispose();
     DefaultBrush.Dispose();
 }
Beispiel #7
0
        public void PaintWorld(WorldLayer layer)
        {
            var visible = !Hud.Game.IsInTown && (Hud.Game.Me.AnimationState == AcdAnimationState.Running) && (Hud.Game.MapMode == MapMode.Minimap);

            if (!Fader.TestVisiblity(visible))
            {
                return;
            }

            OutlineBrush.DrawWorldEllipse(Hud.Game.Me.Stats.PickupRange, -1, Hud.Game.Me.FloorCoordinate);
            FillBrush.DrawWorldEllipse(Hud.Game.Me.Stats.PickupRange, -1, Hud.Game.Me.FloorCoordinate);
        }
Beispiel #8
0
        void DrawBackground(Graphics g)
        {
            Brush FillBrush;

            if (RTLMenu)
            {
                FillBrush = new LinearGradientBrush(m_BackRect, m_ItemColors.GradientEndColor, m_ItemColors.GradientStartColor, LinearGradientMode.Horizontal);
            }
            else
            {
                FillBrush = new LinearGradientBrush(m_BackRect, m_ItemColors.GradientStartColor, m_ItemColors.GradientEndColor, LinearGradientMode.Horizontal);
            }
            g.FillRectangle(FillBrush, m_BackRect);
            FillBrush.Dispose();
        }
Beispiel #9
0
        // Clean up managed resources.
        public void Dispose()
        {
            // If we've already run Dispose, do nothing.
            if (IsDisposed)
            {
                return;
            }

            // Dispose of FillBrush and OutlinePen.
            FillBrush.Dispose();
            OutlinePen.Dispose();

            // Remember that we ran Dispose.
            IsDisposed = true;
        }
Beispiel #10
0
        // Clean up managed resources.
        public void Dispose()
        {
            Console.WriteLine("Disposing the Managed Resources");
            // If we've already run Dispose, do nothing.

            if (IsDisposed)
            {
                return;
            }
            // Dispose of FillBrush and OutlinePen.
            FillBrush.Dispose();
            OutlinePen.Dispose();
            // Remember that we ran Dispose.
            IsDisposed = true;
        }
Beispiel #11
0
        protected override Rectangle CalculateBounds()
        {
            Rectangle bounds = base.CalculateBounds();

            bounds.Y--;
            bounds.Height++;
            bounds.Width--;
            // update brush
            if (FillBrush != null)
            {
                FillBrush.Dispose();
            }
            FillBrush = new LinearGradientBrush(bounds, Color.FromArgb(64, Color.LightBlue),
                                                Color.FromArgb(64, Color.DodgerBlue), LinearGradientMode.Vertical);
            return(bounds);
        }
Beispiel #12
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (Hud.Render.UiHidden)
            {
                return;
            }
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }

            RuleList.CalculatePaintInfo(Hud.Game.Me);
            if (RuleList.PaintInfoList.Count > 0)
            {
                var uiMinimapRect = Hud.Render.MinimapUiElement.Rectangle;

                FillBrush.DrawRectangleGridFit(uiMinimapRect.X, uiMinimapRect.Y, uiMinimapRect.Width, uiMinimapRect.Height);
                BorderBrush.DrawRectangleGridFit(uiMinimapRect.X, uiMinimapRect.Y, uiMinimapRect.Width, uiMinimapRect.Height);
            }
        }
Beispiel #13
0
        public virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                disposed = true;

                if (disposing)
                {
                    BorderPen.Dispose();
                    FillBrush.Dispose();
                    background?.Dispose();
                    selectionPen.Dispose();
                    altSelectionPen.Dispose();
                    anchorPen.Dispose();
                    anchorBrush.Dispose();
                    TextFont.Dispose();
                    connectionPointPen.Dispose();
                }
            }
        }
 public virtual void Dispose()
 {
     if (!disposed)
     {
         if (FillBrush != null)
         {
             FillBrush.Dispose();
             FillBrush = null;
         }
         if (PenBrush != null)
         {
             PenBrush.Dispose();
             PenBrush = null;
         }
         if (StrokeStyle != null)
         {
             StrokeStyle.Dispose();
             StrokeStyle = null;
         }
     }
 }
Beispiel #15
0
        internal override void Render(SKSurface surface, SKImageInfo info)
        {
            SkiaGeometrySource2D?geometrySource = Geometry?.BuildGeometry() as SkiaGeometrySource2D;

            SKPath?geometry = geometrySource?.Geometry;

            if (geometry == null)
            {
                return;
            }

            if (FillBrush != null)
            {
                var fillPaint = TryCreateAndClearFillPaint();

                FillBrush.UpdatePaint(fillPaint, geometry.Bounds);

                surface.Canvas.DrawPath(geometry, fillPaint);
            }

            if (StrokeBrush != null && StrokeThickness > 0)
            {
                var fillPaint   = TryCreateAndClearFillPaint();
                var strokePaint = TryCreateAndClearStrokePaint();

                // Set stroke thickness
                strokePaint.StrokeWidth = StrokeThickness;
                // TODO: Add support for dashes here
                // strokePaint.PathEffect = SKPathEffect.CreateDash();

                // Generate stroke geometry for bounds that will be passed to a brush.
                // - [Future]: This generated geometry should also be used for hit testing.
                using (var strokeGeometry = strokePaint.GetFillPath(geometry))
                {
                    StrokeBrush.UpdatePaint(fillPaint, strokeGeometry.Bounds);

                    surface.Canvas.DrawPath(strokeGeometry, fillPaint);
                }
            }
        }
Beispiel #16
0
        /// <summary>
        /// Do the actual work of drawing the filled border
        /// </summary>
        /// <param name="g"></param>
        /// <param name="bounds"></param>
        protected void DrawFilledBorder(Graphics g, Rectangle bounds)
        {
            bounds.Inflate(BoundsPadding);
            GraphicsPath path = GetRoundedRect(bounds, CornerRounding);

            if (FillGradientFrom != null && FillGradientTo != null)
            {
                if (FillBrush != null)
                {
                    FillBrush.Dispose();
                }
                FillBrush = new LinearGradientBrush(bounds, FillGradientFrom.Value, FillGradientTo.Value,
                                                    FillGradientMode);
            }
            if (FillBrush != null)
            {
                g.FillPath(FillBrush, path);
            }
            if (BorderPen != null)
            {
                g.DrawPath(BorderPen, path);
            }
        }
        /// <summary>
        /// Draw rectangles for notes
        /// </summary>
        /// <param name="e"></param>
        /// <param name="noteNumber"></param>
        /// <param name="startTime"></param>
        /// <param name="duration"></param>
        /// <param name="channel"></param>
        private void MakeNoteRectangle(Graphics g, int noteNumber, long startTime, int duration, int channel)
        {
            Rectangle  rect = new Rectangle();
            SolidBrush FillBrush;
            Pen        StrokePen;
            int        PH = pnlCanvas.Height;

            int X = (int)((noteNumber - lowNoteID) * xscale);        // X = notenumber - 23 (graves à gauche aigues à droite)
            int Y = (int)(PH - (startTime + duration) * yscale);     // hauteur - starttime

            int W = (int)xscale;
            int H = (int)(duration * yscale);

            Rectangle rectn = new Rectangle(X, Y, W, H);

            if (channel == 9)  // Drums are green
            {
                StrokePen = new Pen(Color.DarkGreen, 2);
                FillBrush = new SolidBrush(Color.LightGreen);
                duration  = sequence1.Time.Quarter / 4;
            }
            else
            {
                // Other
                #region colors per channel
                switch (channel)
                {
                case 0:
                    StrokePen = new Pen(Color.DarkGreen, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.LightGreen);
                    break;

                case 1:
                    StrokePen = new Pen(Color.DarkBlue, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.CornflowerBlue);
                    break;

                case 2:
                    StrokePen = new Pen(Color.DarkGoldenrod, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.LightGoldenrodYellow);
                    break;

                case 3:
                    StrokePen = new Pen(Color.DarkGreen, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.SlateBlue);
                    break;

                case 4:
                    StrokePen = new Pen(Color.Pink, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.LightPink);
                    break;

                case 5:
                    StrokePen = new Pen(Color.Salmon, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.LightSalmon);
                    break;

                case 6:
                    StrokePen = new Pen(Color.SeaGreen, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.LightSeaGreen);
                    break;

                case 7:
                    StrokePen = new Pen(Color.SlateBlue, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.LightSteelBlue);
                    break;

                case 8:
                    StrokePen = new Pen(Color.BlueViolet, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.Plum);
                    break;

                case 10:
                    StrokePen = new Pen(Color.DarkGray, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.Maroon);
                    break;

                case 11:
                    StrokePen = new Pen(Color.DarkGray, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.Red);
                    break;

                case 12:
                    StrokePen = new Pen(Color.DarkGray, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.Chocolate);
                    break;

                case 13:
                    StrokePen = new Pen(Color.DarkGray, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.NavajoWhite);
                    break;

                case 14:
                    StrokePen = new Pen(Color.DarkGray, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.Green);
                    break;

                default:
                    StrokePen = new Pen(Color.DarkGray, 2);
                    FillBrush = new SolidBrush(System.Drawing.Color.LightGray);
                    break;
                }
                #endregion colors per channel
            }

            rect = new Rectangle(X, Y, W, H);

            //g.DrawRectangle(StrokePen, X, Y, W, H);
            //g.FillRectangle(FillBrush, rect);
            // Draw rectangles with rounded corners
            RectRoutines.DrawRoundedRectangle(g, StrokePen, rect, 5);
            RectRoutines.FillRoundedRectangle(g, FillBrush, rect, 5);


            FillBrush.Dispose();
            StrokePen.Dispose();
        }