AForge.Imaging.Textures.WoodTexture.Generate C# (CSharp) Метод

Generate() публичный Метод

Generate texture.
Generates new texture of the specified size.
public Generate ( int width, int height ) : ].float[
width int Texture's width.
height int Texture's height.
Результат ].float[
        public float[,] Generate( int width, int height )
        {
            float[,]	texture = new float[height, width];
            int			w2 = width / 2;
            int			h2 = height / 2;

            for ( int y = 0; y < height; y++ )
            {
                for ( int x = 0; x < width; x++ )
                {
                    double xv = (double) ( x - w2 ) / width;
                    double yv = (double) ( y - h2 ) / height;

                    texture[y, x] =
                        Math.Min( 1.0f, (float)
                        Math.Abs( Math.Sin(
                            ( Math.Sqrt( xv * xv + yv * yv ) + noise.Function2D( x + r, y + r ) )
                                * Math.PI * 2 * rings
                        ) )
                        );
                }
            }
            return texture;
        }