Пример #1
0
        private static byte[] GetRGB24(Bitmap bmp, bool alpha)
        {
            var writer = new SwfWriter();
            //NOTE: The RGB data must already be multiplied by the alpha channel value.
            int w = bmp.Width;
            int h = bmp.Height;

            using (var fbmp = new FastBitmap(bmp))
            {
                for (int y = 0; y < h; ++y)
                {
                    for (int x = 0; x < w; ++x)
                    {
                        var c = fbmp[x, y];
                        if (alpha)
                        {
                            c = MulAlpha(c);
                            writer.WriteARGB(c);
                        }
                        else
                        {
                            writer.WriteUInt8(0);
                            writer.WriteUInt8(c.R);
                            writer.WriteUInt8(c.G);
                            writer.WriteUInt8(c.B);
                        }
                    }
                }
            }
            return(writer.ToByteArray());
        }