Пример #1
0
        public virtual Image createImage()
        {
#if PENDING
            Image   image = new Image(32, 32, Format.ABGR_16F);
            float[] data  = new float[image.getWidth() * image.getHeight()];
            double  max   = 0.0;

            for (int y = 0; y < image.getHeight(); y++)
            {
                for (int x = 0; x < image.getWidth(); x++)
                {
                    double x2 = (x + 0.5) / image.getWidth() - 0.5;
                    double y2 = (y + 0.5) / image.getHeight() - 0.5;
                    double a  = getValue(x2, y2);

                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1042_3"'
                    data[x + y * image.getWidth()] = (float)a;
                    max = System.Math.Max(max, a);
                }
            }
            for (int y = 0; y < image.getHeight(); y++)
            {
                for (int x = 0; x < image.getWidth(); x++)
                {
                    data[x + y * image.getWidth()] = (float)(data[x + y * image.getWidth()] / max);
                }
            }

            image.write(0, 0, image.getWidth(), image.getHeight(), data, Format.AL_32F);
            return(image);
#endif
            return(new Image());
        }
Пример #2
0
        public virtual Image createImage()
        {
            #if PENDING
            Image image = new Image(32, 32, Format.ABGR_16F);
            float[] data = new float[image.getWidth() * image.getHeight()];
            double max = 0.0;

            for (int y = 0; y < image.getHeight(); y++)
            {
                for (int x = 0; x < image.getWidth(); x++)
                {
                    double x2 = (x + 0.5) / image.getWidth() - 0.5;
                    double y2 = (y + 0.5) / image.getHeight() - 0.5;
                    double a = getValue(x2, y2);

                    //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1042_3"'
                    data[x + y * image.getWidth()] = (float) a;
                    max = System.Math.Max(max, a);
                }
            }
            for (int y = 0; y < image.getHeight(); y++)
                for (int x = 0; x < image.getWidth(); x++)
                    data[x + y * image.getWidth()] = (float) (data[x + y * image.getWidth()] / max);

            image.write(0, 0, image.getWidth(), image.getHeight(), data, Format.AL_32F);
            return image;
            #endif
            return new Image();
        }