public override int GetHashCode()
 {
     return(TextureSize.GetHashCode() ^
            Size.GetHashCode() ^
            Border.GetHashCode() ^
            BackgroundStyle.GetHashCode());
 }
        public void GetStyleItemTest()
        {
            Style target = new Style();

            //Add a background color and style
            //PDFBackgroundStyle bg = new PDFBackgroundStyle();
            target.Background.Color     = PDFColors.Aqua;
            target.Background.FillStyle = Scryber.Drawing.FillType.Pattern;
            //target.AddItem(bg);

            //Add a font
            //PDFFontStyle fs = new PDFFontStyle();
            target.Font.FontBold   = true;
            target.Font.FontFamily = (PDFFontSelector)"Bauhaus 92";
            //target.AddItem(fs);



            //Flattenting should replace the duplicate backgrounds
            BackgroundStyle actual = target.GetOrCreateItem <BackgroundStyle>(StyleKeys.BgItemKey) as BackgroundStyle;

            Assert.IsNotNull(actual);

            //But we should not have lost any detail within the style for the background
            Assert.AreEqual(PDFColors.Aqua, actual.Color);
            Assert.AreEqual(Scryber.Drawing.FillType.Pattern, actual.FillStyle);
        }
Example #3
0
        public void Background_ConstructorTest()
        {
            BackgroundStyle target = new BackgroundStyle();

            Assert.IsNotNull(target);
            Assert.AreEqual(StyleKeys.BgItemKey, target.ItemKey);
        }
        public void FlattenTest()
        {
            Style target = new Style();

            //Add a background color and style
            BackgroundStyle bg = new BackgroundStyle();

            target.Background.Color     = PDFColors.Aqua;
            target.Background.FillStyle = Scryber.Drawing.FillType.Pattern;
            //target.Background.AddItem(bg);

            //Add a font
            Scryber.Styles.FontStyle fs = new Scryber.Styles.FontStyle();
            target.Font.FontBold   = true;
            target.Font.FontFamily = (PDFFontSelector)"Bauhaus 92";
            //target.AddItem(fs);

            //Flattening process will remove the duplicates from the bottom up.
            Style actual = target.Flatten();

            Assert.AreEqual(PDFColors.Aqua, actual.Background.Color);
            Assert.AreEqual(Scryber.Drawing.FillType.Pattern, actual.Background.FillStyle);
            Assert.AreEqual(true, actual.Font.FontBold);
            Assert.AreEqual((PDFFontSelector)"Bauhaus 92", actual.Font.FontFamily);
        }
Example #5
0
        private void SetBackgroundStyle(BackgroundStyle value)
        {
            _backgroundStyle = value;
            
            if (_backgroundStyle == BackgroundStyle.Image) imageToolStripMenuItemImage.Checked = true;
            else imageToolStripMenuItemImage.Checked = false;

            if (_backgroundStyle == BackgroundStyle.White) imageToolStripMenuItemWhite.Checked = true;
            else imageToolStripMenuItemWhite.Checked = false;

            if (_backgroundStyle == BackgroundStyle.Black) imageToolStripMenuItemBlack.Checked = true;
            else imageToolStripMenuItemBlack.Checked = false;

            if (_backgroundStyle == BackgroundStyle.Red) imageToolStripMenuItemRed.Checked = true;
            else imageToolStripMenuItemRed.Checked = false;

            if (_backgroundStyle == BackgroundStyle.Green) imageToolStripMenuItemGreen.Checked = true;
            else imageToolStripMenuItemGreen.Checked = false;

            if (_backgroundStyle == BackgroundStyle.Blue) imageToolStripMenuItemBlue.Checked = true;
            else imageToolStripMenuItemBlue.Checked = false;

            if (_backgroundStyle == BackgroundStyle.Alpha) imageToolStripMenuItemAlpha.Checked = true;
            else imageToolStripMenuItemAlpha.Checked = false;
        }
Example #6
0
        private static async Task Get(HttpResponse res, int index)
        {
            var show = await Slides.LoadAsync();

            if (Interlocked.Exchange(ref _started, 1) == 0)
            {
                await StartOnline(show);
            }
            if (show.TryGetSlide(index, out var slide))
            {
                var backgroundImage = slide.Metadata.GetStringOrDefault("backgroundImage", show.Metadata.GetStringOrEmpty("backgroundImage"));
                var html            = Web.template_html.Utf8ToString()
                                      .Replace("{{title}}", slide.Metadata.GetStringOrDefault("title", show.Metadata.GetStringOrEmpty("title")))
                                      .Replace("{{layout}}", slide.Metadata.GetStringOrDefault("layout", show.Metadata.GetStringOrDefault("layout", "blank")))
                                      .Replace("{{inlineStyle}}", BackgroundStyle.Generate(backgroundImage))
                                      .Replace("{{content}}", slide.Html)
                                      .Replace("{{previousIndex}}", (index - 1).ToString(CultureInfo.InvariantCulture))
                                      .Replace("{{nextIndex}}", (index + 1).ToString(CultureInfo.InvariantCulture))
                                      .Replace("{{deckhub}}", _options.Api);

                res.ContentType = "text/html";
                res.StatusCode  = 200;
                await res.WriteAsync(html);

                return;
            }

            res.StatusCode = 404;
        }
Example #7
0
        /// <summary>
        /// This method initiates the bottomNavigationBar properties,
        /// Tries to get them form XML if not preset sets them to their default values.
        /// </summary>
        /// <param name="context"> context of the bottomNavigationBar </param>
        /// <param name="attrs">   attributes mentioned in the layout XML by user </param>
        private void parseAttrs(Context context, IAttributeSet attrs)
        {
            if (attrs != null)
            {
                TypedArray typedArray = context.Theme.ObtainStyledAttributes(attrs, Resource.Styleable.BottomNavigationBar, 0, 0);

                mActiveColor     = typedArray.GetColor(Resource.Styleable.BottomNavigationBar_bnbActiveColor, Utils.fetchContextColor(context, Resource.Attribute.colorAccent));
                mInActiveColor   = typedArray.GetColor(Resource.Styleable.BottomNavigationBar_bnbInactiveColor, Color.LightGray);
                mBackgroundColor = typedArray.GetColor(Resource.Styleable.BottomNavigationBar_bnbBackgroundColor, Color.White);
                mAutoHideEnabled = typedArray.GetBoolean(Resource.Styleable.BottomNavigationBar_bnbAutoHideEnabled, true);
                mElevation       = typedArray.GetDimension(Resource.Styleable.BottomNavigationBar_bnbElevation, Resources.GetDimension(Resource.Dimension.bottom_navigation_elevation));

                setAnimationDuration(typedArray.GetInt(Resource.Styleable.BottomNavigationBar_bnbAnimationDuration, DEFAULT_ANIMATION_DURATION));

                Mode mode = (Mode)typedArray.GetInt(Resource.Styleable.BottomNavigationBar_bnbMode, (int)Mode.MODE_DEFAULT);
                switch (mode)
                {
                case Mode.MODE_FIXED:
                    mMode = Mode.MODE_FIXED;
                    break;

                case Mode.MODE_SHIFTING:
                    mMode = Mode.MODE_SHIFTING;
                    break;

                case Mode.MODE_DEFAULT:
                default:
                    mMode = Mode.MODE_DEFAULT;
                    break;
                }

                BackgroundStyle style = (BackgroundStyle)typedArray.GetInt(Resource.Styleable.BottomNavigationBar_bnbBackgroundStyle, (int)BackgroundStyle.BACKGROUND_STYLE_DEFAULT);

                switch (style)
                {
                case BackgroundStyle.BACKGROUND_STYLE_STATIC:
                    mBackgroundStyle = BackgroundStyle.BACKGROUND_STYLE_STATIC;
                    break;

                case BackgroundStyle.BACKGROUND_STYLE_RIPPLE:
                    mBackgroundStyle = BackgroundStyle.BACKGROUND_STYLE_RIPPLE;
                    break;

                case BackgroundStyle.BACKGROUND_STYLE_DEFAULT:
                default:
                    mBackgroundStyle = BackgroundStyle.BACKGROUND_STYLE_DEFAULT;
                    break;
                }

                typedArray.Recycle();
            }
            else
            {
                mActiveColor     = Utils.fetchContextColor(context, Resource.Attribute.colorAccent);
                mInActiveColor   = Color.LightGray;
                mBackgroundColor = Color.White;
                mElevation       = Resources.GetDimension(Resource.Dimension.bottom_navigation_elevation);
            }
        }
Example #8
0
        private void AddPath(BackgroundStyle background, string path)
        {
            if (background?.Image == null)
            {
                return;
            }

            background.Image.File = CombinePath(path, background.Image.File);
        }
Example #9
0
 public Section(int startTime, int endTime, string artistName, string songName, int backgroundID, BackgroundStyle backgroundStyle)
 {
     this.startTime       = startTime;
     this.endTime         = endTime;
     this.artistName      = artistName;
     this.songName        = songName;
     this.backgroundID    = backgroundID;
     this.backgroundStyle = backgroundStyle;
     this.duration        = endTime - startTime;
 }
Example #10
0
        public static void RenderBorderAndArea(ICanvas canvas, IShapef shape, IPathf border,
                                               Area.AreaStyle style, Area.AreaStyle nextStyle, float alpha)
        {
            // We first fill background.
            {
                // We create background fill.
                ITransform mappingTransform;
                IMapper    mapper;
                IFill      fill = BackgroundStyle.Merge(style != null ? style.Background : null,
                                                        nextStyle != null ? nextStyle.Background : null, alpha,
                                                        out mappingTransform, out mapper);

                if (fill != null)
                {
                    if (mappingTransform != null)
                    {
                        canvas.TextureTransform = mappingTransform;
                    }

                    // We fill shape
                    canvas.FillShape(fill, shape, mapper);

                    // Must reset.
                    if (mappingTransform != null)
                    {
                        canvas.TextureTransform = null;
                    }
                }
            }

            // Now we add border over it.

            {
                ITransform transform;
                IMapper    mapper;
                Pen        pen = BorderStyle.Merge(style != null ? style.Border : null,
                                                   nextStyle != null ? nextStyle.Border : null, alpha, out transform, out mapper);

                if (pen != null && pen.Fill != null)
                {
                    if (transform != null)
                    {
                        canvas.TextureTransform = transform;
                    }

                    canvas.DrawShape(pen, border, mapper);

                    if (transform != null)
                    {
                        canvas.TextureTransform = null;
                    }
                }
            }
        }
Example #11
0
        /// <summary>
        /// Set background style and gradient colors.
        ///
        /// Mark background as modified if any given parameter differs from original.
        /// </summary>
        /// <param name="backgroundStyle"></param>
        /// <param name="color1"></param>
        /// <param name="color2"></param>
        public void SetBackgroundData(BackgroundStyle backgroundStyle, sd.Color color1, sd.Color color2)
        {
            var mod = false;

            mod |= _cqBackground.BackgroundFill != backgroundStyle;
            _cqBackground.BackgroundFill = backgroundStyle;
            mod |= !_cqBackground.Color1.Equals(color1);
            _cqBackground.Color1 = color1;
            mod |= !_cqBackground.Color2.Equals(color2);
            _cqBackground.Color2 = color2;

            _cqBackground.Modified |= mod;
        }
Example #12
0
        public void Background_PatternRepeatTest()
        {
            BackgroundStyle target = new BackgroundStyle();

            Assert.AreEqual(target.PatternRepeat, PatternRepeat.RepeatBoth); //RepeatBoth is the current default.

            target.PatternRepeat = PatternRepeat.RepeatX;
            Assert.AreEqual(target.PatternRepeat, PatternRepeat.RepeatX);

            target.PatternRepeat = PatternRepeat.None;
            Assert.AreEqual(target.PatternRepeat, PatternRepeat.None);

            target.RemovePatternRepeat();
            Assert.AreEqual(target.PatternRepeat, PatternRepeat.RepeatBoth);
        }
Example #13
0
        public void Background_ColorTest()
        {
            BackgroundStyle target = new BackgroundStyle();

            Assert.AreEqual(target.Color, PDFColor.Transparent);

            target.Color = PDFColors.Red;
            Assert.AreEqual(target.Color, PDFColors.Red);

            target.Color = PDFColors.Blue;
            Assert.AreEqual(target.Color, PDFColors.Blue);

            target.RemoveColor();
            Assert.AreEqual(target.Color, PDFColor.Transparent);
        }
Example #14
0
        public static Rect BoxedRects(RectOffset offset, BackgroundStyle style, params Rect[] rects)
        {
            if (rects.Length == 0)
            {
                return(new Rect());
            }

            float xMin = rects.Min(r => r.xMin);
            float yMin = rects.Min(r => r.yMin);
            float xMax = rects.Max(r => r.xMax);
            float yMax = rects.Max(r => r.yMax);
            Rect  rect = Rect.MinMaxRect(xMin, yMin, xMax, yMax);

            return(BoxedRect(rect, offset, style));
        }
Example #15
0
        public void Background_FillStyleTest()
        {
            BackgroundStyle target = new BackgroundStyle();

            Assert.AreEqual(target.FillStyle, FillType.None);

            target.FillStyle = FillType.Solid;
            Assert.AreEqual(target.FillStyle, FillType.Solid);


            target.FillStyle = FillType.Image;
            Assert.AreEqual(target.FillStyle, FillType.Image);


            target.RemoveFillStyle();
            Assert.AreEqual(target.FillStyle, FillType.None);
        }
Example #16
0
        public void DrawBackground(SpriteBatch spriteBatch, BackgroundStyle background, Rectangle backgroundRect)
        {
            if (background == null)
            {
                return;
            }

            this.SpriteBatch = spriteBatch;

            if (background.Color.A > 0)
            {
                spriteBatch.Draw(
                    blankSurface,
                    backgroundRect,
                    background.Color);
            }

            if (string.IsNullOrEmpty(background.Image?.File) == false)
            {
                var   backgroundImage    = imageProvider.Load <Texture2D>(background.Image.File);
                Point origin             = backgroundRect.Location;
                var   backgroundPosition = background.Position;

                origin.X += backgroundPosition.X;
                origin.Y += backgroundPosition.Y;

                switch (background.Repeat)
                {
                case BackgroundRepeat.None:
                    DrawClipped(backgroundImage, origin, backgroundRect, background.Image.SourceRect);
                    break;

                case BackgroundRepeat.Repeat:
                    DrawRepeatedClipped(backgroundImage, origin, backgroundRect, true, true, background.Image.SourceRect);
                    break;

                case BackgroundRepeat.Repeat_X:
                    DrawRepeatedClipped(backgroundImage, origin, backgroundRect, true, false, background.Image.SourceRect);
                    break;

                case BackgroundRepeat.Repeat_Y:
                    DrawRepeatedClipped(backgroundImage, origin, backgroundRect, false, true, background.Image.SourceRect);
                    break;
                }
            }
        }
Example #17
0
        public static void DrawBackground(Rect rect, BackgroundStyle style)
        {
            switch (style)
            {
            case BackgroundStyle.HelpBox:
                EditorGUI.HelpBox(rect, string.Empty, MessageType.None);
                break;

            case BackgroundStyle.Darken:
                EditorGUI.DrawRect(rect, DARKEN_COLOUR);
                break;

            case BackgroundStyle.Lighten:
                EditorGUI.DrawRect(rect, LIGHTEN_COLOUR);
                break;
            }
        }
Example #18
0
        private void DrawBlockingListGUI()
        {
            var lineColor1 = new Color(0.3f, 0.3f, 0.3f, 0.5f);
            var lineColor2 = new Color(0.3f, 0.3f, 0.3f, 0.3f);

            var maxId = infos.Any() ? infos.Select(x => x.id).Max() : 0;

            var idLabelSize = EditorStyles.label.CalcSize(new GUIContent(maxId.ToString()));

            using (new EditorGUILayout.VerticalScope(listStyle))
            {
                using (var scrollView = new EditorGUILayout.ScrollViewScope(listScrollPosition, GUILayout.ExpandWidth(true)))
                {
                    for (var i = 0; i < infos.Length; i++)
                    {
                        var info = infos[i];

                        var color = i % 2 == 0 ? lineColor1 : lineColor2;

                        if (selectionId == info.id)
                        {
                            color = SelectionLineColor;
                        }

                        var backgroundStyle = BackgroundStyle.Get(color);

                        using (new EditorGUILayout.HorizontalScope(backgroundStyle))
                        {
                            EditorGUILayout.LabelField(info.id.ToString(), GUILayout.Width(idLabelSize.x));

                            GUILayout.Space(4f);

                            var size = EditorStyles.label.CalcSize(new GUIContent(info.from));

                            if (GUILayout.Button(info.from, EditorStyles.label, GUILayout.Width(size.x)))
                            {
                                selectionId = info.id;
                            }
                        }
                    }

                    listScrollPosition = scrollView.scrollPosition;
                }
            }
        }
Example #19
0
        public void Background_PatternXStepTest()
        {
            BackgroundStyle target = new BackgroundStyle(); // TODO: Initialize to an appropriate value

            Assert.AreEqual(target.PatternXStep, PDFUnit.Zero);

            PDFUnit expected = (PDFUnit)10;

            target.PatternXStep = expected;
            Assert.AreEqual(target.PatternXStep, expected);

            expected            = -20;
            target.PatternXStep = expected;
            Assert.AreEqual(target.PatternXStep, expected);

            target.RemovePatternXStep();
            Assert.AreEqual(target.PatternXStep, PDFUnit.Zero);
        }
Example #20
0
        public void Background_OpacityTest()
        {
            BackgroundStyle target = new BackgroundStyle();

            Assert.AreEqual(target.Opacity, 1.0);

            double opacity = 0.4;

            target.Opacity = opacity;
            Assert.AreEqual(target.Opacity, opacity);

            opacity        = 0.8;
            target.Opacity = opacity;
            Assert.AreEqual(target.Opacity, opacity);

            target.RemoveOpacity();
            Assert.AreEqual(target.Opacity, 1.0);
        }
Example #21
0
        public void Background_ImageSourceTest()
        {
            BackgroundStyle target = new BackgroundStyle();

            Assert.IsTrue(string.IsNullOrEmpty(target.ImageSource));

            string path = "../images/image.png";

            target.ImageSource = path;
            Assert.AreEqual(target.ImageSource, path);

            path = "../images/image2.png";
            target.ImageSource = path;
            Assert.AreEqual(target.ImageSource, path);

            target.RemoveImageSource();
            Assert.IsTrue(string.IsNullOrEmpty(target.ImageSource));
        }
Example #22
0
        public void Background_PatternYStepTest()
        {
            BackgroundStyle target = new BackgroundStyle();

            Assert.AreEqual(target.PatternYStep, PDFUnit.Zero);

            PDFUnit expected = (PDFUnit)10;

            target.PatternYStep = expected;
            Assert.AreEqual(target.PatternYStep, expected);

            expected            = -20;
            target.PatternYStep = expected;
            Assert.AreEqual(target.PatternYStep, expected);

            target.RemovePatternYStep();
            Assert.AreEqual(target.PatternYStep, PDFUnit.Zero);
        }
Example #23
0
        private StyleItemCollection GetStdCollection()
        {
            Style style             = new Style();
            StyleItemCollection col = new StyleItemCollection(style);
            BackgroundStyle     bg  = new BackgroundStyle();

            bg.Color = PDFColors.Red;
            col.Add(bg);

            BorderStyle bor = new BorderStyle();

            bor.Color = PDFColors.Green;
            col.Add(bor);

            Scryber.Styles.FontStyle fnt = new Scryber.Styles.FontStyle();
            fnt.FontFamily = (PDFFontSelector)"Symbol";
            col.Add(fnt);

            return(col);
        }
Example #24
0
        internal void SetBackground(string url, BackgroundStyle bs)
        {
            var bim = new BitmapImage();

            bim.BeginInit();
            bim.CacheOption = BitmapCacheOption.OnLoad;
            bim.UriSource   = new Uri(url);
            if (Program.GameEngine.IsTableBackgroundFlipped)
            {
                bim.Rotation = Rotation.Rotate180;
            }
            bim.EndInit();

            var backBrush = new ImageBrush(bim);

            switch (bs)
            {
            case BackgroundStyle.Tile:
                backBrush.TileMode      = TileMode.Tile;
                backBrush.Viewport      = new Rect(0, 0, backBrush.ImageSource.Width, backBrush.ImageSource.Height);
                backBrush.ViewportUnits = BrushMappingMode.Absolute;
                break;

            case BackgroundStyle.Uniform:
                backBrush.Stretch = Stretch.Uniform;
                break;

            case BackgroundStyle.UniformToFill:
                backBrush.Stretch = Stretch.UniformToFill;
                break;

            case BackgroundStyle.Stretch:
                backBrush.Stretch = Stretch.Fill;
                break;
            }
            Background = backBrush;
        }
Example #25
0
        /// <param name="backgroundStyle"> any of the three Background Styles supported by library </param>
        /// <returns> this, to allow builder pattern </returns>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: public BottomNavigationBar setBackgroundStyle(@BackgroundStyle int backgroundStyle)
        public virtual BottomNavigationBar SetBackgroundStyle(BackgroundStyle backgroundStyle)
        {
            this.mBackgroundStyle = backgroundStyle;
            return(this);
        }
Example #26
0
        private VectorGraphics.Primitives.Container CreateItemVisualItem( Context context, Rectangle logicalBounds, Item item, double glow, BackgroundStyle backgroundStyle )
        {
            double overGlow = glow;

            if( logicalBounds.Height == RowHeight )
            {
                overGlow = 1;
            }

            VectorGraphics.Types.Rectangle rect = VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( logicalBounds );
            VectorGraphics.Factories.RoundedRectangle roundedRectangleFactory = new VectorGraphics.Factories.RoundedRectangle();

            VectorGraphics.Primitives.Container container = new VectorGraphics.Primitives.Container();

            VectorGraphics.Primitives.Path roundedRect = roundedRectangleFactory.Create( rect, 3 );

            roundedRect.Pen = CreateItemPen( context, item, glow, overGlow, backgroundStyle );
            roundedRect.Brush = CreateItemBrush( context, item, glow, overGlow, rect, backgroundStyle );

            container.AddBack( roundedRect );

            VectorGraphics.Primitives.Path lightRoundedRect = roundedRectangleFactory.Create
                ( new VectorGraphics.Types.Rectangle( rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2 ), 2 );
            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, null, glow );

            lightRoundedRect.Pen = new VectorGraphics.Paint.Pens.SolidPen( new VectorGraphics.Paint.Color( lightener, 0.4 * overGlow ), 1 );
            lightRoundedRect.Brush = null;

            container.AddBack( lightRoundedRect );

            if( glow > 0 )
            {
                VectorGraphics.Primitives.Path glowRoundedRect = roundedRectangleFactory.Create
                    ( new VectorGraphics.Types.Rectangle( rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2 ), 4 );
                VectorGraphics.Paint.Color glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowHighlightColor );

                glowEndColor = new VectorGraphics.Paint.Color( glowEndColor, overGlow );

                glowRoundedRect.Pen = new VectorGraphics.Paint.Pens.SolidPen
                    ( new VectorGraphics.Paint.Color( glowEndColor.Red, glowEndColor.Green, glowEndColor.Blue, glow / 2 ), 1 );
                glowRoundedRect.Brush = null;

                container.AddBack( glowRoundedRect );
            }

            return container;
        }
Example #27
0
        private VectorGraphics.Primitives.Container CreateItemVisualItem( Context context, Rectangle logicalBounds, Item item, BackgroundStyle backgroundStyle )
        {
            double glow = item == null ? 0 : GetFade( context, item, FadeIn, FadeOut );

            if( backgroundStyle == BackgroundStyle.Disabled )
            {
                glow = 0;
            }

            return CreateItemVisualItem( context, logicalBounds, item, glow, backgroundStyle );
        }
Example #28
0
        private VectorGraphics.Paint.Pens.Pen CreateItemPen( Context context, Item item, double glow, double overGlow, BackgroundStyle backgroundStyle )
        {
            VectorGraphics.Paint.Color primaryColor = GetPrimaryForegroundColor( context, item == null ? null : item.Section );
            VectorGraphics.Paint.Color glowColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowColor );

            primaryColor = VectorGraphics.Paint.Color.Combine( primaryColor, VectorGraphics.Paint.Color.White, 0.7 );

            if( backgroundStyle == BackgroundStyle.Disabled )
            {
                primaryColor = VectorGraphics.Paint.Color.Combine( primaryColor, VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GrayBackgroundColor ), 0.2 );
            }
            else
            {
                if( (backgroundStyle & BackgroundStyle.Pressed) != 0 )
                {
                    glowColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowDeepColor );
                }
            }

            primaryColor = new VectorGraphics.Paint.Color( primaryColor, overGlow );
            glowColor = new VectorGraphics.Paint.Color( glowColor, overGlow );

            return new VectorGraphics.Paint.Pens.SolidPen( VectorGraphics.Paint.Color.Combine( primaryColor, glowColor, 1 - glow ), 1 );
        }
Example #29
0
        private VectorGraphics.Paint.Brushes.Brush CreateItemBrush( Context context, Item item, double glow, double overGlow, VectorGraphics.Types.Rectangle rect, BackgroundStyle backgroundStyle )
        {
            VectorGraphics.Factories.GlossyBrush glossyBrushFactory = CreateGlossyBrushFactory( context, glow );
            VectorGraphics.Paint.Color primaryColor = GetPrimaryBackgroundColor( context, item == null ? null : item.Section );
            VectorGraphics.Paint.Color glowStartColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowColor );
            VectorGraphics.Paint.Color glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowHighlightColor );

            if( backgroundStyle == BackgroundStyle.Disabled )
            {
                primaryColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GrayPrimaryBackgroundColor );
                glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GrayPrimaryBackgroundColor );
            }
            else
            {
                if( (backgroundStyle & BackgroundStyle.Pressed) != 0 )
                {
                    glowStartColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowDeepColor );
                    glowEndColor = VectorGraphics.Renderers.GdiPlusUtility.Convert.Color( context.RibbonControl.ColorTable.GlowDeepColor );
                }
            }

            VectorGraphics.Paint.Color lightener = GetLightenerColor( context, null, glow );
            VectorGraphics.Paint.Color primaryEnd = VectorGraphics.Paint.Color.Combine( primaryColor, lightener, 0.6 );

            primaryColor = new VectorGraphics.Paint.Color( primaryColor, overGlow );
            primaryEnd = new VectorGraphics.Paint.Color( primaryEnd, overGlow );
            glowStartColor = new VectorGraphics.Paint.Color( glowStartColor, overGlow );
            glowEndColor = new VectorGraphics.Paint.Color( glowEndColor, overGlow );

            return glossyBrushFactory.Create
                ( VectorGraphics.Paint.Color.Combine( primaryColor, glowStartColor, 1 - glow )
                , VectorGraphics.Paint.Color.Combine( primaryEnd, glowEndColor, 1 - glow )
                , rect.Top, rect.Bottom );
        }
Example #30
0
        public override void PaintItemBackground( Context context, Rectangle clip, Rectangle logicalBounds, Item item, BackgroundStyle backgroundStyle )
        {
            if( logicalBounds == Rectangle.Empty )
            {
                return;
            }

            VectorGraphics.Primitives.Container visualItem = CreateItemVisualItem( context, logicalBounds, item, backgroundStyle );

            using( VectorGraphics.Renderers.GdiPlusRenderer renderer = CreateRenderer( context ) )
            {
                renderer.Render( context.Graphics, visualItem, VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( clip ) );
            }
        }
Example #31
0
 public abstract void PaintItemBackground( Context context, Rectangle clip, Rectangle logicalBounds, Item item, BackgroundStyle backgroundStyle );
Example #32
0
        private void LoadConfig()
        {
            RegistryKey key;
            key = Registry.CurrentUser.OpenSubKey(_configRegistryKey, false);
            if (key != null)
            {
                _currentPath = key.GetValue("CurrentPath", "").ToString();
                _currentBackground = key.GetValue("CurrentBackground", "").ToString();

                if ((int)key.GetValue("Rollover", 0) != 0) _rollover = true;
                if ((int)key.GetValue("DisableAlphaChannel", 0) != 0) _disableAlphaChannel = true;
                if ((int)key.GetValue("DisableTransparency", 0) != 0) _disableTransparency = true;
                if ((int)key.GetValue("DisableHelpers", 0) != 0) _disableHelpers = true;

                _backgroundStyle = (BackgroundStyle)key.GetValue("BackgroundStyle", 0);
                _fps = (FrameSpeedOption)key.GetValue("FPS",0);

                _updateHelperEventDisable = true;

                udX1.Value = (int)key.GetValue("HelperX1", 0);
                udX2.Value = (int)key.GetValue("HelperX2", 0);
                udY1.Value = (int)key.GetValue("HelperY1", 0);
                udY2.Value = (int)key.GetValue("HelperY2", 0);

                _updateHelperEventDisable = false;

                key.Close();
            }
        }
Example #33
0
        /// <summary>
        /// Set background style and gradient colors.
        ///
        /// Mark background as modified if any given parameter differs from original.
        /// </summary>
        /// <param name="backgroundStyle"></param>
        /// <param name="color1"></param>
        /// <param name="color2"></param>
        public void SetBackgroundData(BackgroundStyle backgroundStyle, sd.Color color1, sd.Color color2)
        {
            var mod = false;

            mod |= _cqBackground.background_fill != backgroundStyle;
            _cqBackground.background_fill = backgroundStyle;
            mod |= !_cqBackground.color1.Equals(color1);
            _cqBackground.color1 = color1;
            mod |= !_cqBackground.color2.Equals(color2);
            _cqBackground.color2 = color2;

            _cqBackground.modified |= mod;
        }
Example #34
0
        public static Rect BoxedRects(int padding, BackgroundStyle style, params Rect[] rects)
        {
            var offset = new RectOffset(padding, padding, padding, padding);

            return(BoxedRects(offset, style, rects));
        }
Example #35
0
        ///////////////////////////////////////////////////////////////////////////
        // Initialise Method
        ///////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method should be called at the end of all customisation method.
        /// This method will take all changes in to consideration and redraws tabs.
        /// </summary>
        public virtual void Initialise()
        {
            mSelectedPosition = DEFAULT_SELECTED_POSITION;
            mBottomNavigationTabs.Clear();

            if (mBottomNavigationItems.Count > 0)
            {
                mTabContainer.RemoveAllViews();
                if (mMode == Mode.MODE_DEFAULT)
                {
                    if (mBottomNavigationItems.Count <= MIN_SIZE)
                    {
                        mMode = Mode.MODE_FIXED;
                    }
                    else
                    {
                        mMode = Mode.MODE_SHIFTING;
                    }
                }
                if (mBackgroundStyle == BackgroundStyle.BACKGROUND_STYLE_DEFAULT)
                {
                    if (mMode == Mode.MODE_FIXED)
                    {
                        mBackgroundStyle = BackgroundStyle.BACKGROUND_STYLE_STATIC;
                    }
                    else
                    {
                        mBackgroundStyle = BackgroundStyle.BACKGROUND_STYLE_RIPPLE;
                    }
                }

                if (mBackgroundStyle == BackgroundStyle.BACKGROUND_STYLE_STATIC)
                {
                    mBackgroundOverlay.Visibility = ViewStates.Gone;
                    mContainer.SetBackgroundColor(new Color(mBackgroundColor));
                }

                int screenWidth = Utils.getScreenWidth(Context);

                if (mMode == Mode.MODE_FIXED)
                {
                    int[] widths    = BottomNavigationHelper.getMeasurementsForFixedMode(Context, screenWidth, mBottomNavigationItems.Count, mScrollable);
                    int   itemWidth = widths[0];

                    foreach (BottomNavigationItem currentItem in mBottomNavigationItems)
                    {
                        FixedBottomNavigationTab bottomNavigationTab = new FixedBottomNavigationTab(Context);
                        setUpTab(bottomNavigationTab, currentItem, itemWidth, itemWidth);
                    }
                }
                else if (mMode == Mode.MODE_SHIFTING)
                {
                    int[] widths = BottomNavigationHelper.getMeasurementsForShiftingMode(Context, screenWidth, mBottomNavigationItems.Count, mScrollable);

                    int itemWidth       = widths[0];
                    int itemActiveWidth = widths[1];

                    foreach (BottomNavigationItem currentItem in mBottomNavigationItems)
                    {
                        ShiftingBottomNavigationTab bottomNavigationTab = new ShiftingBottomNavigationTab(Context);
                        setUpTab(bottomNavigationTab, currentItem, itemWidth, itemActiveWidth);
                    }
                }

                if (mBottomNavigationTabs.Count > mFirstSelectedPosition)
                {
                    selectTabInternal(mFirstSelectedPosition, true, false, false);
                }
                else if (mBottomNavigationTabs.Count > 0)
                {
                    selectTabInternal(0, true, false, false);
                }
            }
        }
Example #36
0
 public static Rect BoxedRects(BackgroundStyle style, params Rect[] rects)
 {
     return(BoxedRects(BOX_PADDING, style, rects));
 }
Example #37
0
 public static Rect BoxedRect(Rect rect, BackgroundStyle style)
 {
     return(BoxedRect(rect, BOX_PADDING, style));
 }
 public void DrawBackground(SpriteBatch spriteBatch, BackgroundStyle background, Rectangle backgroundRect)
 {
     styleRenderer.DrawBackground(spriteBatch, background, backgroundRect);
 }
Example #39
0
        public override void Handle(IClient client, Tokens tokens)
        {
            string          name                = tokens.GetString(1);
            string          nickname            = tokens.GetString(2);
            int             scrollspeed         = tokens.GetInteger(3);
            Dimension       size                = tokens.GetDimension(4);
            Point           position            = tokens.GetPoint(6);
            string          background_image    = tokens.GetString(8);
            BackgroundStyle background_style    = (BackgroundStyle)tokens.GetEnum(9);
            string          unknown             = tokens.GetString(10);
            Color           foreground          = tokens.GetColor(11);
            Color           background          = tokens.GetColor(12);
            Color           channel_red         = tokens.GetColor(13);
            Color           channel_blue        = tokens.GetColor(14);
            int             font_size           = tokens.GetInteger(15);
            int             line_height         = tokens.GetInteger(16);
            int             nicklist_font_size  = tokens.GetInteger(17);
            Color           nicklist_background = tokens.GetColor(18);
            Bool            unknown2            = tokens.GetBoolean(19);
            string          combobox_value      = tokens.GetString(20);
            Bool            combobox_visible    = tokens.GetBoolean(21);
            int             message_maximum     = tokens.GetInteger(22);
            Bool            button_help         = tokens.GetBoolean(23);
            Bool            button_report       = tokens.GetBoolean(24);
            Bool            button_feedback     = tokens.GetBoolean(25);
            Bool            button_search       = tokens.GetBoolean(26);
            string          unknown3            = tokens.GetString(27);
            string          unknown4            = tokens.GetString(28);
            Bool            unknown5            = tokens.GetBoolean(29);

            Console.WriteLine("INCOMING CHANNEL FRAME");
            Console.WriteLine("\tname = " + name);
            Console.WriteLine("\tnickname = " + nickname);
            Console.WriteLine("\tscrollspeed = " + scrollspeed);
            Console.WriteLine("\tsize = " + size.ToString());
            Console.WriteLine("\tposition = " + position.ToString());
            Console.WriteLine("\tbackground_image = " + background_image);
            Console.WriteLine("\tbackground_style = " + background_style);
            Console.WriteLine("\tunknown = " + unknown);
            Console.WriteLine("\tforeground = " + foreground.ToString());
            Console.WriteLine("\tbackground = " + background.ToString());
            Console.WriteLine("\tchannel_red = " + channel_red.ToString());
            Console.WriteLine("\tchannel_blue = " + channel_blue.ToString());
            Console.WriteLine("\tfont_size = " + font_size);
            Console.WriteLine("\tline_height = " + line_height);
            Console.WriteLine("\tnicklist_font_size = " + nicklist_font_size);
            Console.WriteLine("\tnicklist_background = " + nicklist_background.ToString());
            Console.WriteLine("\tunknown2 = " + unknown2.ToString());
            Console.WriteLine("\tcombobox_value = " + combobox_value);
            Console.WriteLine("\tcombobox_visible = " + combobox_visible.ToString());
            Console.WriteLine("\tmessage_maximum = " + message_maximum);
            Console.WriteLine("\tbutton_help = " + button_help.ToString());
            Console.WriteLine("\tbutton_report = " + button_report.ToString());
            Console.WriteLine("\tbutton_feedback = " + button_feedback.ToString());
            Console.WriteLine("\tbutton_search = " + button_search.ToString());
            Console.WriteLine("\tunknown3 = " + unknown3);
            Console.WriteLine("\tunknown4 = " + unknown4);
            Console.WriteLine("\tunknown5 = " + unknown5.ToString());

            ((Client)client.GetCore()).CreateChannelFrame(name, delegate(UI.ChannelFrame window) {
                window.SetChannel(name);
                window.SetNickname(nickname);
                window.SetSize(size);
                window.SetLocation(position);
                window.SetScrollspeed(scrollspeed);
                window.SetForeground(foreground);
                window.SetBackground(background);
                window.SetBackground(background_image, background_style);
                window.SetChannelStyle(channel_red, channel_blue);
                window.SetFontSize(font_size);
                window.SetLineHeight(line_height);
                window.SetNicklist(nicklist_font_size, nicklist_background);

                window.Show();
            });
        }