コード例 #1
0
ファイル: Page.cs プロジェクト: pephek/EscherPublic
        public void AddVariety(string number, string description, string title, FrameColor frameColor, float width, float height, float horizontal, float vertical, bool skip, Appearance appearance, string picture, string overprint, Shape shape, Alignment alignment, string positions)
        {
            Variety variety = new Variety(number, description, frameColor.GetColor(), width, height, horizontal, vertical, title, shape, skip, "", appearance, picture, overprint, alignment, positions);

            Varieties varieties = Varieties[Varieties.Count() - 1];

            if (varieties.Rows.Count() == 0)
            {
                varieties.Rows.Add(new List <Variety>());
            }

            varieties.Rows[varieties.Rows.Count() - 1].Add(variety);
        }
コード例 #2
0
        public static Color GetColor(this FrameColor frameColor)
        {
            switch (frameColor)
            {
            case FrameColor.Black:
                return(Color.Black);

            case FrameColor.White:
                return(Color.White);

            default:
                throw new ArgumentOutOfRangeException("frameColor");
            }
        }
コード例 #3
0
ファイル: MycoView.cs プロジェクト: roceh/MycoLayout
        protected virtual void InternalDraw(SKCanvas canvas)
        {
            using (var paint = new SKPaint())
            {
                if (BackgroundColor.A > 0)
                {
                    paint.Color = BackgroundColor.ToSKColor();
                    canvas.DrawRect(RenderBounds.ToSKRect(), paint);
                }

                if (FrameColor.A > 0)
                {
                    paint.Color       = FrameColor.ToSKColor();
                    paint.IsStroke    = true;
                    paint.StrokeWidth = (float)FrameThickness;
                    canvas.DrawRect(RenderBounds.ToSKRect(), paint);
                }
            }

            if (Drawing != null)
            {
                Drawing(canvas);
            }
        }
コード例 #4
0
        protected override void OnPaintSurface(SKPaintSurfaceEventArgs e)
        {
            base.OnPaintSurface(e);
            var canvas = e.Surface.Canvas;

            canvas.Clear();

            int width  = e.Info.Width;
            int height = e.Info.Height;

            SKPaint backPaint = new SKPaint
            {
                Style = SKPaintStyle.Fill,
                Color = SKColors.WhiteSmoke,
            };

            canvas.DrawRect(new SKRect(0, 0, width, height), backPaint);

            canvas.Save();

            canvas.Translate(width / 2, height / 2);
            canvas.Scale(Math.Min(width / 210f, height / 520f));

            var rect = new SKRect(-100, -100, 100, 100);

            // Add a buffer for the rectangle
            rect.Inflate(-10, -10);

            var bgColorPaint = new SKPaint
            {
                Color       = BGColor.ToSKColor(),
                IsAntialias = true,
                Style       = SKPaintStyle.Fill,
                StrokeWidth = 0
            };


            var barColorPaint = new SKPaint
            {
                Color       = BarColor.ToSKColor(),
                IsAntialias = true,
                Style       = SKPaintStyle.Fill,
                StrokeWidth = 0
            };

            var frameColorPaint = new SKPaint
            {
                Color       = FrameColor.ToSKColor(),
                IsAntialias = true,
                Style       = SKPaintStyle.Stroke,
                StrokeWidth = 2
            };

            var skrect      = new SKRect(0, 0, PGWidth, PGHeight);
            var skRoundRect = new SKRoundRect(skrect, PGHeight / 2, PGHeight / 2);

            canvas.DrawRoundRect(0, 0, PGWidth, PGHeight, PGHeight / 2, PGHeight / 2, bgColorPaint);
            canvas.DrawRoundRect(skRoundRect, frameColorPaint);
            canvas.ClipRoundRect(skRoundRect, SKClipOperation.Intersect);

            if (StartColor != Color.Default && EndColor != Color.Default)
            {
                barColorPaint.Shader = SKShader.CreateLinearGradient(
                    new SKPoint(skrect.Left, skrect.Bottom),
                    new SKPoint(skrect.Right, skrect.Top),
                    new SKColor[] { StartColor.ToSKColor(), EndColor.ToSKColor() },
                    new float[] { 0, 1 },
                    SKShaderTileMode.Repeat);
            }
            canvas.DrawRoundRect(0, 0, PGWidth * Progress / 100, PGHeight, PGWidth / 2, 0, barColorPaint);

            canvas.Restore();
        }
コード例 #5
0
ファイル: Geo.cs プロジェクト: trmcnealy/Plotly.WPF
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Domain != null)
                {
                    hashCode = hashCode * 59 + Domain.GetHashCode();
                }

                if (FitBounds != null)
                {
                    hashCode = hashCode * 59 + FitBounds.GetHashCode();
                }

                if (Resolution != null)
                {
                    hashCode = hashCode * 59 + Resolution.GetHashCode();
                }

                if (Scope != null)
                {
                    hashCode = hashCode * 59 + Scope.GetHashCode();
                }

                if (Projection != null)
                {
                    hashCode = hashCode * 59 + Projection.GetHashCode();
                }

                if (Center != null)
                {
                    hashCode = hashCode * 59 + Center.GetHashCode();
                }

                if (Visible != null)
                {
                    hashCode = hashCode * 59 + Visible.GetHashCode();
                }

                if (ShowCoastlines != null)
                {
                    hashCode = hashCode * 59 + ShowCoastlines.GetHashCode();
                }

                if (CoastlineColor != null)
                {
                    hashCode = hashCode * 59 + CoastlineColor.GetHashCode();
                }

                if (CoastlineWidth != null)
                {
                    hashCode = hashCode * 59 + CoastlineWidth.GetHashCode();
                }

                if (ShowLand != null)
                {
                    hashCode = hashCode * 59 + ShowLand.GetHashCode();
                }

                if (LandColor != null)
                {
                    hashCode = hashCode * 59 + LandColor.GetHashCode();
                }

                if (ShowOcean != null)
                {
                    hashCode = hashCode * 59 + ShowOcean.GetHashCode();
                }

                if (OceanColor != null)
                {
                    hashCode = hashCode * 59 + OceanColor.GetHashCode();
                }

                if (ShowLakes != null)
                {
                    hashCode = hashCode * 59 + ShowLakes.GetHashCode();
                }

                if (LakeColor != null)
                {
                    hashCode = hashCode * 59 + LakeColor.GetHashCode();
                }

                if (ShowRivers != null)
                {
                    hashCode = hashCode * 59 + ShowRivers.GetHashCode();
                }

                if (RiverColor != null)
                {
                    hashCode = hashCode * 59 + RiverColor.GetHashCode();
                }

                if (RiverWidth != null)
                {
                    hashCode = hashCode * 59 + RiverWidth.GetHashCode();
                }

                if (ShowCountries != null)
                {
                    hashCode = hashCode * 59 + ShowCountries.GetHashCode();
                }

                if (CountryColor != null)
                {
                    hashCode = hashCode * 59 + CountryColor.GetHashCode();
                }

                if (CountryWidth != null)
                {
                    hashCode = hashCode * 59 + CountryWidth.GetHashCode();
                }

                if (ShowSubUnits != null)
                {
                    hashCode = hashCode * 59 + ShowSubUnits.GetHashCode();
                }

                if (SubUnitColor != null)
                {
                    hashCode = hashCode * 59 + SubUnitColor.GetHashCode();
                }

                if (SubUnitWidth != null)
                {
                    hashCode = hashCode * 59 + SubUnitWidth.GetHashCode();
                }

                if (ShowFrame != null)
                {
                    hashCode = hashCode * 59 + ShowFrame.GetHashCode();
                }

                if (FrameColor != null)
                {
                    hashCode = hashCode * 59 + FrameColor.GetHashCode();
                }

                if (FrameWidth != null)
                {
                    hashCode = hashCode * 59 + FrameWidth.GetHashCode();
                }

                if (BgColor != null)
                {
                    hashCode = hashCode * 59 + BgColor.GetHashCode();
                }

                if (LonAxis != null)
                {
                    hashCode = hashCode * 59 + LonAxis.GetHashCode();
                }

                if (LaTaxis != null)
                {
                    hashCode = hashCode * 59 + LaTaxis.GetHashCode();
                }

                if (UiRevision != null)
                {
                    hashCode = hashCode * 59 + UiRevision.GetHashCode();
                }

                return(hashCode);
            }
        }
コード例 #6
0
ファイル: Geo.cs プロジェクト: trmcnealy/Plotly.WPF
        public bool Equals([AllowNull] Geo other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Domain == other.Domain && Domain != null && other.Domain != null && Domain.Equals(other.Domain)) &&
                   (FitBounds == other.FitBounds && FitBounds != null && other.FitBounds != null && FitBounds.Equals(other.FitBounds)) &&
                   (Resolution == other.Resolution && Resolution != null && other.Resolution != null && Resolution.Equals(other.Resolution)) &&
                   (Scope == other.Scope && Scope != null && other.Scope != null && Scope.Equals(other.Scope)) &&
                   (Projection == other.Projection && Projection != null && other.Projection != null && Projection.Equals(other.Projection)) &&
                   (Center == other.Center && Center != null && other.Center != null && Center.Equals(other.Center)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (ShowCoastlines == other.ShowCoastlines && ShowCoastlines != null && other.ShowCoastlines != null && ShowCoastlines.Equals(other.ShowCoastlines)) &&
                   (CoastlineColor == other.CoastlineColor && CoastlineColor != null && other.CoastlineColor != null && CoastlineColor.Equals(other.CoastlineColor)) &&
                   (CoastlineWidth == other.CoastlineWidth && CoastlineWidth != null && other.CoastlineWidth != null && CoastlineWidth.Equals(other.CoastlineWidth)) &&
                   (ShowLand == other.ShowLand && ShowLand != null && other.ShowLand != null && ShowLand.Equals(other.ShowLand)) &&
                   (LandColor == other.LandColor && LandColor != null && other.LandColor != null && LandColor.Equals(other.LandColor)) &&
                   (ShowOcean == other.ShowOcean && ShowOcean != null && other.ShowOcean != null && ShowOcean.Equals(other.ShowOcean)) &&
                   (OceanColor == other.OceanColor && OceanColor != null && other.OceanColor != null && OceanColor.Equals(other.OceanColor)) &&
                   (ShowLakes == other.ShowLakes && ShowLakes != null && other.ShowLakes != null && ShowLakes.Equals(other.ShowLakes)) &&
                   (LakeColor == other.LakeColor && LakeColor != null && other.LakeColor != null && LakeColor.Equals(other.LakeColor)) &&
                   (ShowRivers == other.ShowRivers && ShowRivers != null && other.ShowRivers != null && ShowRivers.Equals(other.ShowRivers)) &&
                   (RiverColor == other.RiverColor && RiverColor != null && other.RiverColor != null && RiverColor.Equals(other.RiverColor)) &&
                   (RiverWidth == other.RiverWidth && RiverWidth != null && other.RiverWidth != null && RiverWidth.Equals(other.RiverWidth)) &&
                   (ShowCountries == other.ShowCountries && ShowCountries != null && other.ShowCountries != null && ShowCountries.Equals(other.ShowCountries)) &&
                   (CountryColor == other.CountryColor && CountryColor != null && other.CountryColor != null && CountryColor.Equals(other.CountryColor)) &&
                   (CountryWidth == other.CountryWidth && CountryWidth != null && other.CountryWidth != null && CountryWidth.Equals(other.CountryWidth)) &&
                   (ShowSubUnits == other.ShowSubUnits && ShowSubUnits != null && other.ShowSubUnits != null && ShowSubUnits.Equals(other.ShowSubUnits)) &&
                   (SubUnitColor == other.SubUnitColor && SubUnitColor != null && other.SubUnitColor != null && SubUnitColor.Equals(other.SubUnitColor)) &&
                   (SubUnitWidth == other.SubUnitWidth && SubUnitWidth != null && other.SubUnitWidth != null && SubUnitWidth.Equals(other.SubUnitWidth)) &&
                   (ShowFrame == other.ShowFrame && ShowFrame != null && other.ShowFrame != null && ShowFrame.Equals(other.ShowFrame)) &&
                   (FrameColor == other.FrameColor && FrameColor != null && other.FrameColor != null && FrameColor.Equals(other.FrameColor)) &&
                   (FrameWidth == other.FrameWidth && FrameWidth != null && other.FrameWidth != null && FrameWidth.Equals(other.FrameWidth)) &&
                   (BgColor == other.BgColor && BgColor != null && other.BgColor != null && BgColor.Equals(other.BgColor)) &&
                   (LonAxis == other.LonAxis && LonAxis != null && other.LonAxis != null && LonAxis.Equals(other.LonAxis)) &&
                   (LaTaxis == other.LaTaxis && LaTaxis != null && other.LaTaxis != null && LaTaxis.Equals(other.LaTaxis)) &&
                   (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)));
        }
コード例 #7
0
ファイル: BaseChart.cs プロジェクト: benlundberg/CinematicsXF
        protected void DrawVerticalLabels(SKCanvas canvas, SKRect frame, SKRect chart)
        {
            using (var paint = new SKPaint
            {
                TextSize = VerticalLabelTextSize,
                Color = this.VerticalLabelColor.ToSKColor(),
                IsAntialias = true
            })
            {
                // Calculates maximum value depending on chart height
                var maximumValue = chart.Height * (MaxValue / chart.Height);

                if (VerticalLabelMode != LabelMode.None)
                {
                    // Draw vertical unit
                    if (!string.IsNullOrEmpty(VerticalUnit))
                    {
                        // Draws maximum value
                        canvas.DrawText(this.VerticalUnit, ChartRectMargin.Left, frame.Top + VerticalLabelTextSize, paint);
                        canvas.DrawText(maximumValue.ToString(), ChartRectMargin.Left, frame.Top + (VerticalLabelTextSize * 2), paint);
                    }
                    else
                    {
                        // Draws maximum value
                        canvas.DrawText(maximumValue.ToString(), ChartRectMargin.Left, frame.Top + VerticalLabelTextSize, paint);
                    }

                    canvas.DrawText("0", ChartRectMargin.Left, frame.Bottom, paint);
                }

                if (VerticalLabelMode == LabelMode.StartCenterEnd || VerticalLabelMode == LabelMode.All)
                {
                    using (var framePaint = new SKPaint
                    {
                        Style = SKPaintStyle.Stroke,
                        Color = FrameColor.ToSKColor(),
                        StrokeWidth = FrameWidth / 2,
                    })
                    {
                        if (DashedFrame)
                        {
                            framePaint.PathEffect = SKPathEffect.CreateDash(new float[] { 12, 12 }, 0);
                        }

                        if (HideFrame)
                        {
                            canvas.DrawLine(frame.Left, string.IsNullOrEmpty(VerticalUnit) ? frame.Top + (VerticalLabelTextSize / 2) : frame.Top + VerticalLabelTextSize, frame.Right, string.IsNullOrEmpty(VerticalUnit) ? frame.Top + (VerticalLabelTextSize / 2) : frame.Top + VerticalLabelTextSize, framePaint);
                            canvas.DrawLine(frame.Left, frame.Bottom - (VerticalLabelTextSize / 4), frame.Right, frame.Bottom - (VerticalLabelTextSize / 4), framePaint);
                        }

                        canvas.DrawText((maximumValue / 2).ToString(), ChartRectMargin.Left, frame.MidY + (VerticalLabelTextSize / 4), paint);

                        canvas.DrawLine(frame.Left, frame.MidY, frame.Right, frame.MidY, framePaint);

                        if (VerticalLabelMode == LabelMode.All)
                        {
                            canvas.DrawText((maximumValue * .25).ToString(), ChartRectMargin.Left, (frame.Height * .75f) + (VerticalLabelTextSize / 4), paint);
                            canvas.DrawText((maximumValue * .75).ToString(), ChartRectMargin.Left, (frame.Height * .25f) + (VerticalLabelTextSize / 4), paint);

                            canvas.DrawLine(frame.Left, frame.Height * .75f, frame.Right, frame.Height * .75f, framePaint);
                            canvas.DrawLine(frame.Left, frame.Height * .25f, frame.Right, frame.Height * .25f, framePaint);
                        }
                    }
                }
            }
        }
コード例 #8
0
        void ReleaseDesignerOutlets()
        {
            if (ShadowCheckbox != null)
            {
                ShadowCheckbox.Dispose();
                ShadowCheckbox = null;
            }

            if (ShadowColor != null)
            {
                ShadowColor.Dispose();
                ShadowColor = null;
            }

            if (LinkedShadowColor != null)
            {
                LinkedShadowColor.Dispose();
                LinkedShadowColor = null;
            }

            if (ShadowOpacitySlider != null)
            {
                ShadowOpacitySlider.Dispose();
                ShadowOpacitySlider = null;
            }

            if (ShadowOpacityValue != null)
            {
                ShadowOpacityValue.Dispose();
                ShadowOpacityValue = null;
            }

            if (HorizontalShadowOffsetSlider != null)
            {
                HorizontalShadowOffsetSlider.Dispose();
                HorizontalShadowOffsetSlider = null;
            }

            if (HorizontalShadowOffsetValue != null)
            {
                HorizontalShadowOffsetValue.Dispose();
                HorizontalShadowOffsetValue = null;
            }

            if (VerticalShadowOffsetSlider != null)
            {
                VerticalShadowOffsetSlider.Dispose();
                VerticalShadowOffsetSlider = null;
            }

            if (VerticalShadowOffsetValue != null)
            {
                VerticalShadowOffsetValue.Dispose();
                VerticalShadowOffsetValue = null;
            }

            if (HorizontalShadowBlurSlider != null)
            {
                HorizontalShadowBlurSlider.Dispose();
                HorizontalShadowBlurSlider = null;
            }

            if (HorizontalShadowBlurValue != null)
            {
                HorizontalShadowBlurValue.Dispose();
                HorizontalShadowBlurValue = null;
            }

            if (VerticalShadowBlurSlider != null)
            {
                VerticalShadowBlurSlider.Dispose();
                VerticalShadowBlurSlider = null;
            }

            if (VerticalShadowBlurValue != null)
            {
                VerticalShadowBlurValue.Dispose();
                VerticalShadowBlurValue = null;
            }

            if (AddColorButton != null)
            {
                AddColorButton.Dispose();
                AddColorButton = null;
            }

            if (AntialiasCheckbox != null)
            {
                AntialiasCheckbox.Dispose();
                AntialiasCheckbox = null;
            }

            if (BlendMode != null)
            {
                BlendMode.Dispose();
                BlendMode = null;
            }

            if (BlurCheckbox != null)
            {
                BlurCheckbox.Dispose();
                BlurCheckbox = null;
            }

            if (Dash1 != null)
            {
                Dash1.Dispose();
                Dash1 = null;
            }

            if (Dash10 != null)
            {
                Dash10.Dispose();
                Dash10 = null;
            }

            if (Dash11 != null)
            {
                Dash11.Dispose();
                Dash11 = null;
            }

            if (Dash12 != null)
            {
                Dash12.Dispose();
                Dash12 = null;
            }

            if (Dash13 != null)
            {
                Dash13.Dispose();
                Dash13 = null;
            }

            if (Dash14 != null)
            {
                Dash14.Dispose();
                Dash14 = null;
            }

            if (Dash15 != null)
            {
                Dash15.Dispose();
                Dash15 = null;
            }

            if (Dash16 != null)
            {
                Dash16.Dispose();
                Dash16 = null;
            }

            if (Dash2 != null)
            {
                Dash2.Dispose();
                Dash2 = null;
            }

            if (Dash3 != null)
            {
                Dash3.Dispose();
                Dash3 = null;
            }

            if (Dash4 != null)
            {
                Dash4.Dispose();
                Dash4 = null;
            }

            if (Dash5 != null)
            {
                Dash5.Dispose();
                Dash5 = null;
            }

            if (Dash6 != null)
            {
                Dash6.Dispose();
                Dash6 = null;
            }

            if (Dash7 != null)
            {
                Dash7.Dispose();
                Dash7 = null;
            }

            if (Dash8 != null)
            {
                Dash8.Dispose();
                Dash8 = null;
            }

            if (Dash9 != null)
            {
                Dash9.Dispose();
                Dash9 = null;
            }

            if (DashCheckbox != null)
            {
                DashCheckbox.Dispose();
                DashCheckbox = null;
            }

            if (DeviationSlider != null)
            {
                DeviationSlider.Dispose();
                DeviationSlider = null;
            }

            if (DeviationValue != null)
            {
                DeviationValue.Dispose();
                DeviationValue = null;
            }

            if (EndCap != null)
            {
                EndCap.Dispose();
                EndCap = null;
            }

            if (FrameCheckbox != null)
            {
                FrameCheckbox.Dispose();
                FrameCheckbox = null;
            }

            if (FrameColor != null)
            {
                FrameColor.Dispose();
                FrameColor = null;
            }

            if (GradientDropdown != null)
            {
                GradientDropdown.Dispose();
                GradientDropdown = null;
            }

            if (HorizontalBlurSlider != null)
            {
                HorizontalBlurSlider.Dispose();
                HorizontalBlurSlider = null;
            }

            if (HorizontalBlurValue != null)
            {
                HorizontalBlurValue.Dispose();
                HorizontalBlurValue = null;
            }

            if (JitterCheckbox != null)
            {
                JitterCheckbox.Dispose();
                JitterCheckbox = null;
            }

            if (JoinType != null)
            {
                JoinType.Dispose();
                JoinType = null;
            }

            if (LengthSlider != null)
            {
                LengthSlider.Dispose();
                LengthSlider = null;
            }

            if (LengthValue != null)
            {
                LengthValue.Dispose();
                LengthValue = null;
            }

            if (LinkedColorSelector != null)
            {
                LinkedColorSelector.Dispose();
                LinkedColorSelector = null;
            }

            if (MiterSlider != null)
            {
                MiterSlider.Dispose();
                MiterSlider = null;
            }

            if (MiterValue != null)
            {
                MiterValue.Dispose();
                MiterValue = null;
            }

            if (OpacitySlider != null)
            {
                OpacitySlider.Dispose();
                OpacitySlider = null;
            }

            if (OpacityValue != null)
            {
                OpacityValue.Dispose();
                OpacityValue = null;
            }

            if (VerticalBlurSlider != null)
            {
                VerticalBlurSlider.Dispose();
                VerticalBlurSlider = null;
            }

            if (VerticalBlurValue != null)
            {
                VerticalBlurValue.Dispose();
                VerticalBlurValue = null;
            }

            if (WidthSlider != null)
            {
                WidthSlider.Dispose();
                WidthSlider = null;
            }

            if (WidthValue != null)
            {
                WidthValue.Dispose();
                WidthValue = null;
            }
        }
コード例 #9
0
        public SetFrameColorOutgoingPacket(uint creatureId, FrameColor frameColor)
        {
            this.CreatureId = creatureId;

            this.FrameColor = frameColor;
        }