Esempio n. 1
0
 public Slider()
 {
     Children = new Drawable[]
     {
         container = new BufferedContainer
         {
             CacheDrawnFrameBuffer = true,
             Children = new Drawable[]
             {
                 path = new Path
                 {
                     Blending = BlendingMode.None
                 }
             }
         }
     };
     container.Attach(RenderbufferInternalFormat.DepthComponent16);
 }
Esempio n. 2
0
            public Body(Slider s)
            {
                slider = s;

                Children = new Drawable[]
                {
                    container = new BufferedContainer
                    {
                        CacheDrawnFrameBuffer = true,
                        Children = new Drawable[]
                        {
                            path = new Path
                            {
                                Colour       = s.Colour,
                                BlendingMode = BlendingMode.None,
                            },
                        }
                    }
                };

                container.Attach(RenderbufferInternalFormat.DepthComponent16);
            }
Esempio n. 3
0
        private void load(RulesetStore rulesets)
        {
            Add(new Container
            {
                Anchor   = Anchor.Centre,
                Origin   = Anchor.Centre,
                Children = new Drawable[]
                {
                    container = new BufferedContainer
                    {
                        CacheDrawnFrameBuffer = true,
                        Width    = 400,
                        Height   = 400,
                        Position = new Vector2(-400, -600),
                        Scale    = new Vector2(2),
                        Children = new Drawable[]
                        {
                            path2 = new Path
                            {
                                Name     = "Path1",
                                Blending = BlendingMode.None,
                            },
                        }
                    },
                    path = new Path
                    {
                        Name      = "Path2",
                        Origin    = Anchor.Centre,
                        PathWidth = 25,
                    },
                },
            });

            initialTexture();

            initialPath();

            container.Attach(RenderbufferInternalFormat.DepthComponent16);
        }
Esempio n. 4
0
        public SliderBody(Slider s)
        {
            slider = s;

            Children = new Drawable[]
            {
                container = new BufferedContainer
                {
                    RelativeSizeAxes      = Axes.Both,
                    CacheDrawnFrameBuffer = true,
                    Children = new Drawable[]
                    {
                        path = new Path
                        {
                            Blending = BlendingMode.None,
                        },
                    }
                },
            };

            container.Attach(RenderbufferInternalFormat.DepthComponent16);
        }
Esempio n. 5
0
        protected override void LoadComplete()
        {
            Host.Window.Title = "FrameworkTester";
            base.LoadComplete();

            Add(new Box
            {
                Colour           = Color4.Gray,
                RelativeSizeAxes = Axes.Both,
            });
            Add(container = new BufferedContainer
            {
                CacheDrawnFrameBuffer = true,
                Child = path = new Path
                {
                    PathWidth = 50,
                    Name      = "Path1",
                    Blending  = BlendingMode.None,
                },
            });

            container.Attach(RenderbufferInternalFormat.DepthComponent16);

            populatePoints();

            int textureWidth = (int)path.PathWidth * 2;

            var texture = new Texture(textureWidth, 1);

            //initialise background
            var upload = new TextureUpload(textureWidth * 4);
            var bytes  = upload.Data;

            const float aa_portion     = .75f;
            const float border_portion = .75f;

            for (int i = 0; i < textureWidth; i++)
            {
                float progress = (float)i / (textureWidth - 1);

                if (progress <= border_portion)
                {
                    bytes[i * 4]     = (byte)(255 - 255 * progress);
                    bytes[i * 4 + 1] = (byte)(255 - 255 * progress);
                    bytes[i * 4 + 2] = (byte)(255 - 255 * progress);
                    bytes[i * 4 + 3] = (byte)(Math.Min(progress / aa_portion, 1) * 255);
                }
                else
                {
                    bytes[i * 4]     = (byte)(255 - 255 * progress);
                    bytes[i * 4 + 1] = (byte)(255 - 255 * progress);
                    bytes[i * 4 + 2] = (byte)(255 - 255 * progress);
                    bytes[i * 4 + 3] = 255;
                }
            }

            texture.SetData(upload);
            path.Texture = texture;

            newPoints();
            container.Size = path.Size;
        }