Gives access to the pixels of a WriteableBitmap given an IBuffer exposed by Pixels property.
Note that creating this object copies the pixels buffer into the Bytes byte array for quick pixel access and the array needs to be copied back to the pixels buffer to update the bitmap with a call to UpdateFromBytes(). This is acceptable for convenience and possibly best for performance in some scenarios, but it does add some upfront overhead as well overhead to update the bitmap at the end. This is only a theory and for better performance it might be good to test different approaches. The goal of this approach is code simplicity. For best performance using native code and/or DirectX is recommended.
        private static void RenderColorPickerHueRingCore(
            int innerRingRadius, int outerRingRadius, int pw, int ph, IBufferExtensions.PixelBufferInfo pixels)
        {
            var pch = pw / 2;
            var pcv = ph / 2;

            if (outerRingRadius == 0)
            {
                outerRingRadius = Math.Min(pw, ph) / 2;
            }
            if (innerRingRadius == 0)
            {
                innerRingRadius = outerRingRadius * 2 / 3;
            }

            // Outer ring radius square
            var orr2 = outerRingRadius * outerRingRadius;

            // Inner ring radius square
            var irr2 = innerRingRadius * innerRingRadius;

            //var orr22 = (outerRingRadius - 5) * (outerRingRadius - 5);
            //var irr22 = (innerRingRadius + 5) * (innerRingRadius + 5);
            const double piInv = 1.0 / Math.PI;

            for (int y = 0; y < ph; y++)
            {
                for (int x = 0; x < pw; x++)
                {
                    // Radius square
                    var r2 = (x - pch) * (x - pch) + (y - pcv) * (y - pcv);

                    if (r2 >= irr2 &&
                        r2 <= orr2)
                    {
                        var angleRadians = Math.Atan2(y - pcv, x - pch);
                        var angleDegrees = (angleRadians * 180 * piInv + 90 + 360) % 360;
                        //var alpha = (r2 - irr22 < 5) || (orr22 - r2 < 5) ? 0.5 : 1;
                        //var c = ColorExtensions.FromHsl(angleDegrees, 1.0 * alpha, 0.5 * alpha, alpha);
                        var c = ColorExtensions.FromHsl(angleDegrees, 1.0, 0.5);
                        pixels[pw * y + x] = c.AsInt();
                    }
                    //else
                    //{
                    //    pixels[pw * y + x] = int.MaxValue;
                    //}
                }
            }
        }
        private static void RenderColorPickerRGBBlueBarCore(
            double red, double green, int pw, int ph, IBufferExtensions.PixelBufferInfo pixels)
        {
            var xmax = pw - 1;

            for (int x = 0; x < pw; x++)
            {
                double blue = (double)x / xmax;
                var    c    = ColorExtensions.FromRgb(red, green, blue);

                for (int y = 0; y < ph; y++)
                {
                    pixels[pw * y + x] = c.AsInt();
                }
            }
        }
        private static void RenderColorPickerHSLLightnessBarCore(
            double hue, double saturation, int pw, int ph, IBufferExtensions.PixelBufferInfo pixels)
        {
            var xmax = pw - 1;

            for (int x = 0; x < pw; x++)
            {
                double lightness = (double)x / xmax;
                var    c         = ColorExtensions.FromHsl(hue, saturation, lightness);

                for (int y = 0; y < ph; y++)
                {
                    pixels[pw * y + x] = c.AsInt();
                }
            }
        }
        private static void RenderColorPickerHSVHueBarCore(
            double saturation, double value, int pw, int ph, IBufferExtensions.PixelBufferInfo pixels)
        {
            var xmax = pw - 1;

            for (int x = 0; x < pw; x++)
            {
                double hue = 360.0 * x / xmax;
                var    c   = ColorExtensions.FromHsv(hue, saturation, value);

                for (int y = 0; y < ph; y++)
                {
                    pixels[pw * y + x] = c.AsInt();
                }
            }
        }
        private static void RenderColorPickerSaturationLightnessRectCore(
            double hue, int pw, int ph, IBufferExtensions.PixelBufferInfo pixels)
        {
            var xmax = pw - 1;
            var ymax = ph - 1;

            for (int y = 0; y < ph; y++)
            {
                double lightness = 1.0 * (ph - 1 - y) / ymax;

                for (int x = 0; x < pw; x++)
                {
                    var saturation = (double)x / xmax;
                    var c          = ColorExtensions.FromHsl(hue, saturation, lightness);
                    pixels[pw * y + x] = c.AsInt();
                }
            }
        }
        private static void RenderColorPickerSaturationValueTriangleCore(
            double hue, int ph, int hw, double invPh, int pw, IBufferExtensions.PixelBufferInfo pixels)
        {
            for (int y = 0; y < ph; y++)
            {
                double value = 1 - 1.0 * (ph - 1 - y) / ph;

                var xmin = (int)(hw * (1 - invPh * y));
                var xmax = pw - xmin;

                for (int x = xmin; x < xmax; x++)
                {
                    //var saturation = (double)x / pw;
                    var saturation = 1 - (double)(x + xmax - pw) / pw;
                    var c          = ColorExtensions.FromHsv(hue, saturation, value);
                    pixels[pw * y + x] = c.AsInt();
                }
            }
        }
        private static void RenderColorPickerSaturationLightnessTriangleCore(
            double hue, int pw, int ph, IBufferExtensions.PixelBufferInfo pixels)
        {
            var hw    = pw / 2;
            var invPh = 1.0 / ph;

            for (int y = 0; y < ph; y++)
            {
                double lightness = 1 - 1.0 * (ph - 1 - y) / ph;

                var xmin = (int)(hw * (1 - invPh * y));
                var xmax = pw - xmin;

                for (int x = xmin; x < xmax; x++)
                {
                    //var saturation = (double)x / xmax;
                    var saturation = 1 - (double)(x + xmax - pw) / pw;
                    var c          = ColorExtensions.FromHsl(hue, saturation, lightness);
                    pixels[pw * y + x] = c.AsInt();
                }
            }
        }