Esempio n. 1
0
        protected unsafe override void OnRender(Rectangle[] rois, int startIndex, int length)
        {
            Surface dst  = DstArgs.Surface;
            int     maxX = dst.Width - 1;
            int     maxY = dst.Height - 1;

            for (int r = startIndex; r < startIndex + length; ++r)
            {
                Rectangle rect = rois[r];

                for (int y = rect.Top; y < rect.Bottom; ++y)
                {
                    ColorBgra *dstPtr = dst.GetPointAddressUnchecked(rect.Left, y);

                    float brightness = (float)y / maxY;

                    for (int x = rect.Left; x < rect.Right; ++x)
                    {
                        float hue = x * 360.0f / maxX;

                        *dstPtr++ = ColorBgraExt.FromAhsl(1.0f, hue, 0.5f, brightness);
                    }
                }
            }
        }
Esempio n. 2
0
        protected unsafe override void OnRender(Rectangle[] rois, int startIndex, int length)
        {
            Surface dst   = DstArgs.Surface;
            int     maxX  = dst.Width - 1;
            int     maxY  = dst.Height - 1;
            int     bands = 8;

            for (int r = startIndex; r < startIndex + length; ++r)
            {
                Rectangle rect = rois[r];

                for (int y = rect.Top; y < rect.Bottom; ++y)
                {
                    ColorBgra *dstPtr     = dst.GetPointAddressUnchecked(rect.Left, y);
                    int        band       = Math.DivRem(y * bands + maxY - 1, maxY, out int rem);
                    float      saturation = (float)rem / maxY;

                    for (int x = rect.Left; x < rect.Right; ++x)
                    {
                        float hue = x * 360.0f / maxX;

                        *dstPtr++ = ColorBgraExt.FromAhsl(1.0f, hue, 1.0f - saturation, (float)band / bands);
                    }
                }
            }
        }