当前位置: 首页>>代码示例>>C#>>正文


C# ImageBrush.GetHashCode方法代码示例

本文整理汇总了C#中System.Windows.Media.ImageBrush.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# ImageBrush.GetHashCode方法的具体用法?C# ImageBrush.GetHashCode怎么用?C# ImageBrush.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.ImageBrush的用法示例。


在下文中一共展示了ImageBrush.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParticleSystem

        public ParticleSystem(int maxCount, System.Windows.Media.Color color, Uri source)
        {
            this.maxParticleCount = maxCount;

            this.particleList = new List<Particle>();

            this.particleModel = new GeometryModel3D();
            this.particleModel.Geometry = new MeshGeometry3D();

            Image e = new Image();
            e.Source = new BitmapImage( source);

              //  Ellipse e = new Ellipse();

            e.Width = 32.0;
            e.Height = 32.0;
               // RadialGradientBrush b = new RadialGradientBrush();
               // b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0xFF, color.R, color.G, color.B), 0.25));
               // b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0x00, color.R, color.G, color.B), 1.0));

               // e.Fill = b;

            e.Measure(new System.Windows.Size(32, 32));
            e.Arrange(new Rect(0, 0, 32, 32));

            System.Windows.Media.Brush brush = null;

            #if USE_VISUALBRUSH
            brush = new VisualBrush(e);
            #else
            RenderTargetBitmap renderTarget = new RenderTargetBitmap(32, 32, 96, 96, PixelFormats.Pbgra32);
            renderTarget.Render(e);
            renderTarget.Freeze();
            brush = new ImageBrush(renderTarget);
            #endif

            DiffuseMaterial material = new DiffuseMaterial(brush);

            this.particleModel.Material = material;

            this.rand = new Random(brush.GetHashCode());
        }
开发者ID:luiseduardohdbackup,项目名称:dotnet-1,代码行数:42,代码来源:ParticleSystem.cs

示例2: ParticleSystem

        public ParticleSystem(int maxCount, Color color)
        {
            MaxParticleCount = maxCount;

            _particleList = new List<Particle>();

            _particleModel = new GeometryModel3D {Geometry = new MeshGeometry3D()};

            var e = new Ellipse
            {
                Width = 32.0,
                Height = 32.0
            };
            var b = new RadialGradientBrush();
            b.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, color.R, color.G, color.B), 0.25));
            b.GradientStops.Add(new GradientStop(Color.FromArgb(0x00, color.R, color.G, color.B), 1.0));
            e.Fill = b;
            e.Measure(new Size(32, 32));
            e.Arrange(new Rect(0, 0, 32, 32));

            Brush brush = null;

#if USE_VISUALBRUSH
            brush = new VisualBrush(e);
#else
            var renderTarget = new RenderTargetBitmap(32, 32, 96, 96, PixelFormats.Pbgra32);
            renderTarget.Render(e);
            renderTarget.Freeze();
            brush = new ImageBrush(renderTarget);
#endif

            var material = new DiffuseMaterial(brush);

            _particleModel.Material = material;

            _rand = new Random(brush.GetHashCode());
        }
开发者ID:ClemensT,项目名称:WPF-Samples,代码行数:37,代码来源:ParticleSystem.cs

示例3: ApplyMaterialToBrush

        public void ApplyMaterialToBrush(Ellipse ellipse)
        {
            #if USE_VISUALBRUSH  //--------------------------------------------------------------

            brush = new VisualBrush(e);

            #else

            var renderTarget = new RenderTargetBitmap(32, 32, 96, 96, PixelFormats.Pbgra32);
            renderTarget.Render(ellipse);
            renderTarget.Freeze();
            Brush brush = new ImageBrush(renderTarget);

            #endif  //---------------------------------------------------------------------------

            var material = new DiffuseMaterial(brush);

            // #FELO: EmissiveMaterial is more radiating. Could actually be a good alternative.
            //var material = new EmissiveMaterial(brush);

            _particleModel.Material = material;

            _random = new Random(brush.GetHashCode());
        }
开发者ID:smalice,项目名称:SurfaceWPFApp,代码行数:24,代码来源:ParticleSystemManager.xaml.cs


注:本文中的System.Windows.Media.ImageBrush.GetHashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。