Website may be up and down over next few months. I'm currently doing a complete overhaul of everything. Going back to simple individual .htm pages, new overall site theme, sanitizing and cleaning up html of all pages and blog posts, attempting to implement a new tooling and publishing system etc etc.

Takes in an array of floats representing pixels ordered left to right top to bottom. Width & height arguments specify the image dimensions.

        /// <summary>
        /// Smoothens out the image.
        /// </summary>
        /// <param name="image">The source image.</param>
        /// <exception cref="ArgumentNullException"><paramref name="getPixel"/> or <paramref name="setPixel"/> is <see langword="null" />.</exception>
        public static void Smoothen(this float[] image, int width, int height, Func<int, int, float> getPixel, Action<int, int, float> setPixel, float smoothinValue = 9f)
        {
            if (getPixel == null)
            {
                throw new ArgumentNullException("getPixel");
            }

            if (setPixel == null)
            {
                throw new ArgumentNullException("setPixel");
            }

            for (var x = 1; x < width - 1; ++x)
            {
                for (var y = 1; y < height - 1; ++y)
                {
                    var total = 0f;
                    for (var u = -1; u <= 1; u++)
                    {
                        for (var v = -1; v <= 1; v++)
                        {
                            total += getPixel(x + u, y + v);
                        }
                    }

                    setPixel(x, y, total / smoothinValue);
                }
            }
        }

It’s not something people think about these days. Back in the 90’s when MS-DOS was king, alerting the user to a problem involved both a visual alert as well as a auditory alert in the form of a “beep”. It’s actually something I miss from those days. Luckily the unity editor has an API to alert the user and wouldn't you know it, it’s called “Beep”!


Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume