Пример #1
0
        public void Rasterize(ref Color4[] pixels)
        {
            if (Count == 0)
            {
                for (int j = 0; j < pixels.Length; j++)
                {
                    pixels[j] = Color4.White;
                }
                return;
            }

            var pixelCount = pixels.Length;
            var i          = 0;
            var sorted     = Ordered().ToList();

            for (var j = 0; j < Count - 1; j++)
            {
                var lastPixel = (j + 1 < Count) ? sorted[j + 1].Position * pixelCount : pixelCount;
                while (i < lastPixel)
                {
                    var start = sorted[j].Position * pixelCount;
                    var ratio = (i - start) / (lastPixel - start);
                    ratio       = double.IsInfinity(ratio) ? 0f : ratio.Clamp(0f, 1f);
                    pixels[i++] = Color4.Lerp(ratio, sorted[j].Color, sorted[j + 1].Color);
                }
            }

            while (i < pixelCount - 1)
            {
                pixels[i++] = sorted[Count - 1].Color;
            }
        }
Пример #2
0
 public override void Blend(float factor)
 {
     widget.Position = Vector2.Lerp(factor, position, wantedPosition);
     widget.Rotation = Interpolate2DRotation(factor, rotation, wantedRotation);
     widget.Scale    = Vector2.Lerp(factor, scale, wantedScale);
     widget.Size     = Vector2.Lerp(factor, size, wantedSize);
     widget.Color    = Color4.Lerp(factor, color, wantedColor);
     widget.Visible  = visible || wantedVisible;
 }
Пример #3
0
 public override void Blend(float factor)
 {
     point.Position = Vector2.Lerp(factor, position, wantedPosition);
     point.Color    = Color4.Lerp(factor, color, wantedColor);
 }