Ejemplo n.º 1
0
        protected override void OnCreateDeviceResources(WindowRenderTarget renderTarget)
        {
            base.OnCreateDeviceResources(renderTarget);
            // Create an array of gradient stops to put in the gradient stop
            // collection that will be used in the gradient brush.
            GradientStop[] stops = new GradientStop[] {
                new GradientStop(0, Color.FromKnown(Colors.Gold, 1)),
                new GradientStop(0.85f, Color.FromKnown(Colors.Orange, 1)),
                new GradientStop(1, Color.FromKnown(Colors.OrangeRed, 1))
            };

            using (GradientStopCollection gradiendStops = renderTarget.CreateGradientStopCollection(stops, Gamma.Gamma22, ExtendMode.Clamp))
            {
                // The center of the gradient is in the center of the box.
                // The gradient origin offset was set to zero(0, 0) or center in this case.
                this._radialGradientBrush = renderTarget.CreateRadialGradientBrush(
                    new RadialGradientBrushProperties(
                        new PointF(330, 330),
                        new PointF(140, 140),
                        140,
                        140),
                    BrushProperties.Default,
                    gradiendStops);
            }

            this._sceneBrush       = renderTarget.CreateSolidColorBrush(Color.FromKnown(Colors.Black, 1));
            this._gridPatternBrush = renderTarget.CreateGridPatternBrush(new SizeF(10, 10), Color.FromRGB(0.93f, 0.94f, 0.96f));
        }
Ejemplo n.º 2
0
        protected override void OnCreateDeviceResources(WindowRenderTarget renderTarget)
        {
            base.OnCreateDeviceResources(renderTarget);
            this._blackBrush       = renderTarget.CreateSolidColorBrush(Color.FromKnown(Colors.Black, 1));
            this._yellowGreenBrush = renderTarget.CreateSolidColorBrush(Color.FromKnown(0x9ACD32, 1));

            GradientStop[] stops = new GradientStop[] {
                new GradientStop(0, Color.FromKnown(Colors.Yellow, 1)),
                new GradientStop(1, Color.FromKnown(Colors.ForestGreen, 1))
            };

            using (GradientStopCollection collection = renderTarget.CreateGradientStopCollection(stops, Gamma.Gamma22, ExtendMode.Clamp))
            {
                this._linearGradientBrush = renderTarget.CreateLinearGradientBrush(
                    new LinearGradientBrushProperties(new PointF(0, 0), new PointF(150, 150)),
                    BrushProperties.Default,
                    collection);
                this._radialGradientBrush = renderTarget.CreateRadialGradientBrush(
                    new RadialGradientBrushProperties(new PointF(75, 75), new PointF(0, 0), 75, 75),
                    BrushProperties.Default,
                    collection);
            }

            using (Bitmap bitmap = RenderTarget.CreateBitmap(this.GetType(), "fern.jpg"))
            {
                this._bitmapBrush = renderTarget.CreateBitmapBrush(bitmap,
                                                                   new BitmapBrushProperties(ExtendMode.Wrap, ExtendMode.Wrap, BitmapInterpolationMode.Linear),
                                                                   BrushProperties.Default);
            }

            this._gridPatternBrush = renderTarget.CreateGridPatternBrush(new SizeF(10, 10), Color.FromRGB(0.93f, 0.94f, 0.96f));
        }
Ejemplo n.º 3
0
        private Brush CreateEllipseBrush(Ellipse ellipse)
        {
            RectF bounds = ellipse.Bounds;

            RadialGradientBrushProperties properties = new RadialGradientBrushProperties(bounds.Center,
                                                                                         new PointF(),
                                                                                         ellipse.RadiusX,
                                                                                         ellipse.RadiusY);

            using (GradientStopCollection collection = _renderTarget.CreateGradientStopCollection(new GradientStop[] {
                new GradientStop(0, Color.FromKnown(Colors.Blue, 1)),
                new GradientStop(0.5f, Color.FromKnown(Colors.Green, 1)),
                new GradientStop(1, Color.FromKnown(Colors.Blue, 1))
            }))
            {
                Brush brush = _renderTarget.CreateRadialGradientBrush(properties, BrushProperties.Default, collection);
                brush.Transform = Matrix3x2.Rotation(_angle, bounds.Center);
                return(brush);
            }
        }
Ejemplo n.º 4
0
        protected override void OnCreateDeviceResources(WindowRenderTarget renderTarget)
        {
            base.OnCreateDeviceResources(renderTarget);
            // Create an array of gradient stops to put in the gradient stop
            // collection that will be used in the gradient brush.
            GradientStop[] stops = new GradientStop[] {
                new GradientStop(0, Color.FromARGB(Colors.Gold, 1)),
                new GradientStop(0.85f, Color.FromARGB(Colors.Orange, 1)),
                new GradientStop(1, Color.FromARGB(Colors.OrangeRed, 1))
            };

            using (GradientStopCollection gradiendStops = renderTarget.CreateGradientStopCollection(stops, Gamma.Gamma22, ExtendMode.Clamp))
            {
                // The center of the gradient is in the center of the box.
                // The gradient origin offset was set to zero(0, 0) or center in this case.
                this._radialGradientBrush = renderTarget.CreateRadialGradientBrush(
                    new RadialGradientBrushProperties(
                        new PointF(330, 330),
                        new PointF(140, 140),
                        140,
                        140),
                        BrushProperties.Default,
                        gradiendStops);
            }

            this._sceneBrush = renderTarget.CreateSolidColorBrush(Color.FromARGB(Colors.Black, 1));
            this._gridPatternBrush = renderTarget.CreateGridPatternBrush(new SizeF(10, 10), Color.FromARGB(1, 0.93f, 0.94f, 0.96f));
        }
Ejemplo n.º 5
0
        protected override void OnCreateDeviceResources(WindowRenderTarget renderTarget)
        {
            base.OnCreateDeviceResources(renderTarget);
            this._blackBrush = renderTarget.CreateSolidColorBrush(Color.FromARGB(Colors.Black, 1));
            this._yellowGreenBrush = renderTarget.CreateSolidColorBrush(Color.FromARGB(0x9ACD32, 1));

            GradientStop[] stops = new GradientStop[] {
                new GradientStop(0, Color.FromARGB(Colors.Yellow, 1)),
                new GradientStop(1, Color.FromARGB(Colors.ForestGreen, 1))
            };

            using (GradientStopCollection collection = renderTarget.CreateGradientStopCollection(stops, Gamma.Gamma22, ExtendMode.Clamp))
            {
                this._linearGradientBrush = renderTarget.CreateLinearGradientBrush(
                    new LinearGradientBrushProperties(new PointF(0, 0), new PointF(150, 150)),
                    BrushProperties.Default,
                    collection);
                this._radialGradientBrush = renderTarget.CreateRadialGradientBrush(
                    new RadialGradientBrushProperties(new PointF(75, 75), new PointF(0, 0), 75, 75),
                    BrushProperties.Default,
                    collection);
            }

            using (Bitmap bitmap = RenderTarget.CreateBitmap(this.GetType(), "fern.jpg"))
            {
                this._bitmapBrush = renderTarget.CreateBitmapBrush(bitmap,
                    new BitmapBrushProperties(ExtendMode.Wrap, ExtendMode.Wrap, BitmapInterpolationMode.Linear),
                    BrushProperties.Default);
            }

            this._gridPatternBrush = renderTarget.CreateGridPatternBrush(new SizeF(10, 10), Color.FromARGB(1, 0.93f, 0.94f, 0.96f));
        }