Пример #1
0
        public IEnumerable <Particle> GenerateParticles(Size screenBounds)
        {
            var bitmapGenerator = new StringBitmapGenerator(_displayString, BitmapPixelFormat, _fontFamily);

            var bitmap          = bitmapGenerator.CreateBitmap(screenBounds);
            var stringRectangle = bitmapGenerator.StringRectangle;

            var particleLocations = new BitmapToParticlePositionConverter()
                                    .GenerateParticlePositions(bitmap, BytesPerPixel, stringRectangle, (int)_particleRadius);

            return(particleLocations.Select(location =>
                                            new Particle(
                                                new Vector3D(
                                                    (double)(location.X + stringRectangle.X) / screenBounds.Width,
                                                    (double)(location.Y + stringRectangle.Y) / screenBounds.Height,
                                                    0), _particleRadius)));
        }
        public IEnumerable<Particle> GenerateParticles(Size screenBounds)
        {
            var bitmapGenerator = new StringBitmapGenerator(_displayString, BitmapPixelFormat, _fontFamily);

            var bitmap = bitmapGenerator.CreateBitmap(screenBounds);
            var stringRectangle = bitmapGenerator.StringRectangle;

            var particleLocations = new BitmapToParticlePositionConverter()
                .GenerateParticlePositions(bitmap, BytesPerPixel, stringRectangle, (int)_particleRadius);

            return particleLocations.Select(location =>
                new Particle(
                    new Vector3D(
                        (double)(location.X + stringRectangle.X) / screenBounds.Width,
                        (double)(location.Y + stringRectangle.Y) / screenBounds.Height,
                        0), _particleRadius));
        }