Esempio n. 1
0
        public void ToXml(XmlWriter writer)
        {
            var provider = new NumberFormatInfo {
                NumberDecimalSeparator = GlobalProfile.DecimalSymbolStandard.ToString()
            };

            var cultureInfo = new CultureInfo("")
            {
                NumberFormat = { NumberDecimalSeparator = GlobalProfile.DecimalSymbolStandard.ToString() }
            };

            cultureInfo.TextInfo.ListSeparator = GlobalProfile.ArgumentsSeparatorStandard.ToString();

            var colorConverter               = TypeDescriptor.GetConverter(typeof(Color));
            var dashStyleConverter           = TypeDescriptor.GetConverter(typeof(DashStyle));
            var plotLinesMethodEnumConverter = TypeDescriptor.GetConverter(typeof(PlotLinesMethodEnum));

            writer.WriteAttributeString("isvisible", Visible.ToString().ToLower());
            writer.WriteAttributeString("plotmethod", plotLinesMethodEnumConverter.ConvertToString(PlotMethod));

            writer.WriteAttributeString("lineantialias", AntiAlias.ToString().ToLower());
            writer.WriteAttributeString("linecolor", colorConverter.ConvertToString(null, cultureInfo, LineColor));
            writer.WriteAttributeString("linethickness", Thickness.ToString(provider));
            writer.WriteAttributeString("linepattern", dashStyleConverter.ConvertToString(Pattern));
        }
        /// <summary>
        /// Perform rendering before child elements are rendered.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        public override void RenderBefore(RenderContext context)
        {
            // Create a border offset down and right for drawing a shadow
            Rectangle shadowRect = ClientRectangle;

            shadowRect.X++;
            shadowRect.Y++;

            // Reduce background to fit inside the border
            Rectangle backRect = ClientRectangle;

            backRect.Inflate(-1, -1);

            // Create border paths
            using (GraphicsPath borderPath = CreateBorderPath(ClientRectangle),
                   shadowPath = CreateBorderPath(shadowRect))
            {
                // Are we allowed to draw a border?
                if (_ribbon.StateCommon.RibbonScroller.PaletteBorder.GetBorderDraw(State) == InheritBool.True)
                {
                    // Draw the border shadow
                    using (AntiAlias aa = new AntiAlias(context.Graphics))
                        using (SolidBrush shadowBrush = new SolidBrush(Color.FromArgb(16, Color.Black)))
                            context.Graphics.FillPath(shadowBrush, shadowPath);
                }

                // Are we allowed to draw a background?
                if (_ribbon.StateCommon.RibbonScroller.PaletteBack.GetBackDraw(State) == InheritBool.True)
                {
                    _mementoBack = context.Renderer.RenderStandardBack.DrawBack(context, backRect, borderPath,
                                                                                _ribbon.StateCommon.RibbonScroller.PaletteBack,
                                                                                VisualOrientation.Top, State, _mementoBack);
                }

                // Are we allowed to draw the content?
                if (_ribbon.StateCommon.RibbonScroller.PaletteContent.GetContentDraw(State) == InheritBool.True)
                {
                    // Get the text color from palette
                    Color textColor = _ribbon.StateCommon.RibbonScroller.PaletteContent.GetContentShortTextColor1(State);

                    // Draw the arrow content in center of the background
                    DrawArrow(context.Graphics, textColor, backRect);
                }

                // Are we allowed to draw border?
                if (_ribbon.StateCommon.RibbonScroller.PaletteBorder.GetBorderDraw(State) == InheritBool.True)
                {
                    // Get the border color from palette
                    Color borderColor = _ribbon.StateCommon.RibbonScroller.PaletteBorder.GetBorderColor1(State);

                    // Draw the border last to overlap the background
                    using (AntiAlias aa = new AntiAlias(context.Graphics))
                        using (Pen borderPen = new Pen(borderColor))
                            context.Graphics.DrawPath(borderPen, borderPath);
                }
            }
        }
Esempio n. 3
0
 public SkiaCanvas(SKCanvas canvas, SKStrokeCap strokeCap, AntiAlias antiAliasLevel)
 {
     Canvas    = canvas;
     StrokeCap = strokeCap;
     _paint    = new SKPaint {
         IsAntialias  = antiAliasLevel != AntiAlias.Disable,
         SubpixelText = antiAliasLevel == AntiAlias.WithSubpixelText,
         HintingLevel = SKPaintHinting.Full
     };
     CurrentStyle = default;
     CurrentColor = default;
     DefaultColor = default;
 }
Esempio n. 4
0
        /// <summary>
        /// Perform rendering before child elements are rendered.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        public override void RenderBefore(RenderContext context)
        {
            // Reduce background to fit inside the border
            Rectangle backRect = ClientRectangle;

            backRect.Inflate(-1, -1);

            // If disabled then we need to reflect that immediately
            if (!Enabled)
            {
                ElementState = PaletteState.Disabled;
            }
            else if (ElementState == PaletteState.Disabled)
            {
                ElementState = PaletteState.Normal;
            }

            // Create border paths
            using (GraphicsPath borderPath = CreateBorderPath(ClientRectangle))
            {
                // Are we allowed to draw a background?
                if (_paletteBack.GetBackDraw(State) == InheritBool.True)
                {
                    _mementoBack = context.Renderer.RenderStandardBack.DrawBack(context, backRect, borderPath, _paletteBack,
                                                                                VisualOrientation.Top, State, _mementoBack);
                }

                // Are we allowed to draw the content?
                if (_paletteContent.GetContentDraw(State) == InheritBool.True)
                {
                    context.Renderer.RenderStandardContent.DrawContent(context, ClientRectangle, _paletteContent,
                                                                       _mementoContent, VisualOrientation.Top,
                                                                       State, false, false, false);
                }

                // Are we allowed to draw border?
                if (_paletteBorder.GetBorderDraw(State) == InheritBool.True)
                {
                    // Get the border color from palette
                    Color borderColor = _paletteBorder.GetBorderColor1(State);

                    // Draw the border last to overlap the background
                    using (AntiAlias aa = new AntiAlias(context.Graphics))
                        using (Pen borderPen = new Pen(borderColor))
                        {
                            context.Graphics.DrawPath(borderPen, borderPath);
                        }
                }
            }
        }
Esempio n. 5
0
        internal Settings()
        {
            HIGHLIGHT_FX                 = GameSettings.HIGHLIGHT_FX;
            INFLIGHT_HIGHLIGHT           = GameSettings.INFLIGHT_HIGHLIGHT;
            TEMPERATURE_GAUGES_MODE      = GameSettings.TEMPERATURE_GAUGES_MODE;
            CAMERA_DOUBLECLICK_MOUSELOOK = GameSettings.CAMERA_DOUBLECLICK_MOUSELOOK;
            ADVANCED_TWEAKABLES          = GameSettings.ADVANCED_TWEAKABLES;
            CONFIRM_MESSAGE_DELETION     = GameSettings.CONFIRM_MESSAGE_DELETION;
            ADVANCED_MESSAGESAPP         = GameSettings.ADVANCED_MESSAGESAPP;
            EXTENDED_BURNTIME            = GameSettings.EXTENDED_BURNTIME;

            ANTI_ALIASING   = (AntiAlias)GameSettings.ANTI_ALIASING;
            TEXTURE_QUALITY = (TextureQuality)GameSettings.TEXTURE_QUALITY;
        }
Esempio n. 6
0
        public void ToXml(XmlWriter writer)
        {
            var provider = new NumberFormatInfo {
                NumberDecimalSeparator = GlobalProfile.DecimalSymbolStandard.ToString()
            };

            var cultureInfo = new CultureInfo("")
            {
                NumberFormat = { NumberDecimalSeparator = GlobalProfile.DecimalSymbolStandard.ToString() }
            };

            cultureInfo.TextInfo.ListSeparator = GlobalProfile.ArgumentsSeparatorStandard.ToString();

            var colorConverter          = TypeDescriptor.GetConverter(typeof(Color));
            var symbolTypeEnumConverter = TypeDescriptor.GetConverter(typeof(SymbolTypeEnum));

            writer.WriteAttributeString("symbolantialias", AntiAlias.ToString().ToLower());
            writer.WriteAttributeString("symbolsize", SymbolSize.ToString(provider));
            writer.WriteAttributeString("symboltype", symbolTypeEnumConverter.ConvertToString(SymbolType));
            writer.WriteAttributeString("symbolborderthickness", BorderThickness.ToString(provider));
            writer.WriteAttributeString("symbolbordercolor", colorConverter.ConvertToString(null, cultureInfo, BorderColor));
            writer.WriteAttributeString("symbolfillcolor", colorConverter.ConvertToString(null, cultureInfo, FillColor));
        }
Esempio n. 7
0
 public MathPainter(float fontSize = DefaultFontSize, AntiAlias antiAlias = DefaultAntiAlias) : base(fontSize) =>