Beispiel #1
0
        public static uint[] UnpackPIX24(byte[] data, int width, int height, bool hasAlpha)
        {
            VGColor c = new VGColor();
            c.A = 255;

            uint[] res = new uint[width * height];
            for (int i = 0, j = 0; i < data.Length; i += 4, j++)
            {
                if (hasAlpha) c.A = data[i];
                c.R = data[i + 1];
                c.G = data[i + 2];
                c.B = data[i + 3];
                res[j] = c.PackedValue;
            }
            return res;
        }
Beispiel #2
0
        public static uint[] UnpackIndexed(byte[] data, int width, int height, int table, bool hasAlpha)
        {
            uint[] colors = new uint[table + 1];
            int j = 0;
            if (hasAlpha)
            {
                for (int i = 0; i < table; i++, j += 3)
                    colors[i] = new VGColor(data[j], data[j + 1], data[j + 2], data[j + 3]).PackedValue;
            }
            else
            {
                for (int i = 0; i < table; i++, j += 3)
                    colors[i] = new VGColor(data[j], data[j + 1], data[j + 2]).PackedValue;
            }

            uint[] res = new uint[width * height];
            int lineSize = (data.Length - j) / height;
            int pix = 0, pos = 0;
            for (; height > 0; height--, j += lineSize)
            {
                pos = j;
                for (int x = 0; x < width; x++, pix++, pos++)
                    res[pix] = colors[data[pos]];
            }
            return res;
        }
Beispiel #3
0
        public static uint[] UnpackPIX15(byte[] data, int width, int height)
        {
            VGColor c = new VGColor();
            c.A = 255;

            uint[] res = new uint[width * height];
            int lineSize = data.Length / height;
            int pix = 0, b = 0;
            for (int offset = 0; height > 0; height--, offset += lineSize)
            {
                b = offset;
                for (int x = 0; x < width; x++, pix++, b+=2)
                {
                    c.R = (byte)(data[b] >> 2);
                    c.G = (byte)(((data[b] & 0x03) << 3) | (data[b + 1] >> 5));
                    c.B = (byte)(data[b + 1] & 0x1F);
                    res[pix] = c.PackedValue;
                }
            }
            return res;
        }
Beispiel #4
0
 public VGColor[] ReadRGBAArray(int count)
 {
     VGColor[] data = new VGColor[count];
     while (count > 0)
         data[data.Length - count--] = ReadRGBA();
     return data;
 }
Beispiel #5
0
 internal VGColorPaint(VGDevice device, VGColor color)
     : base(device)
 {
     Color = color;
 }
 public void Load(SwfStream stream, uint length, byte version)
 {
     Color = stream.ReadRGB();
 }
Beispiel #7
0
 public VGColor TransformColor(VGColor color)
 {
     return this * color;
 }