AForge.Imaging.Textures.TextileTexture.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];

            for ( int y = 0; y < height; y++ )
            {
                for ( int x = 0; x < width; x++ )
                {
                    texture[y, x] =
                        Math.Max( 0.0f, Math.Min( 1.0f,
                            (
                                (float) Math.Sin( x + noise.Function2D( x + r, y + r ) ) +
                                (float) Math.Sin( y + noise.Function2D( x + r, y + r ) )
                            ) * 0.25f + 0.5f
                        ) );

                }
            }
            return texture;
        }