Beispiel #1
0
        public Channels( Size size, byte[] reddata, byte[] greendata, byte[] bluedata )
        {
            channels = new Channel[3];
            mask = -1;
            alpha = -1;
            red = 0;
            green = 1;
            blue = 2;

            channels[red] = new Channel( ChannelType.Red, "", size, reddata );
            channels[green] = new Channel( ChannelType.Green, "", size, greendata );
            channels[blue] = new Channel( ChannelType.Blue, "", size, bluedata );
        }
Beispiel #2
0
        public Channels( Size size, byte[] alphadata, byte[] reddata, byte[] greendata, byte[] bluedata )
        {
            channels = new Channel[4];
            mask = -1;
            alpha = 0;
            red = 1;
            green = 2;
            blue = 3;

            channels[alpha] = new Channel( ChannelType.Alpha, "", size, alphadata );
            channels[red] = new Channel( ChannelType.Red, "", size, reddata );
            channels[green] = new Channel( ChannelType.Green, "", size, greendata );
            channels[blue] = new Channel( ChannelType.Blue, "", size, bluedata );
        }
Beispiel #3
0
        public void ReadFrom( BinaryReader reader )
        {
            int count = IPAddress.NetworkToHostOrder( reader.ReadInt16() );

            // Reset channels
            mask = alpha = red = green = blue = -1;

            // read channels
            channels = new Channel[count];
            for ( int i=0; i<count; ++i ) {
                channels[i] = new Channel( reader );
                switch ( channels[i].Type ) {
                    case ChannelType.Mask: mask = i; break;
                    case ChannelType.Alpha: alpha = i; break;
                    case ChannelType.Red: red = i; break;
                    case ChannelType.Green: green = i; break;
                    case ChannelType.Blue: blue = i; break;
                    default:
                        throw new InvalidChannelTypeException( channels[i].Type );
                }
            }
        }