Пример #1
0
        public void Visualize(ISimpleBitmap surface)
        {
            int w = surface.PixelWidth;
            int h = surface.PixelHeight;
            int[] pixels = surface.Pixels;
            YCbCrColor min = Min;
            YCbCrColor max = Max;
            int i;
            float xf, yf, cb, cr;

            // Use constant Y
            float v = min.Y + (max.Y - min.Y)*YFactor;

            // Interpolate between min and max and set pixel
            for (int y = 0; y < h; y++)
            {
                for (int x = 0; x < w; x++)
                {
                    i = y*w + x;
                    xf = (float) x/w;
                    yf = (float) y/h;
                    cb = min.Cb + (max.Cb - min.Cb)*xf;
                    cr = min.Cr + (max.Cr - min.Cr)*yf;
                    pixels[y*w + x] = new YCbCrColor(v, cb, cr).ToArgbColori();
                }
            }
        }
Пример #2
0
 public YCbCrColor Interpolate(YCbCrColor c2, float amount)
 {
     return new YCbCrColor(Y + (c2.Y - Y)*amount,
                           Cb + (c2.Cb - Cb)*amount,
                           Cr + (c2.Cr - Cr)*amount);
 }