Not sure if it's what you want, but there's already an Image class built
into .NET, in System.Drawing. It obviously won't have a channel for bump
mapping, but it has everything else associated with an image/bitmap.

On 7/17/07, Jedediah Smith <[EMAIL PROTECTED]> wrote:

I think it's come time for a proper class for decoded images. I really
need it for baking as manipulating interleaved byte arrays is becoming
too messy and error prone.

Attached is an initial proposal. This would be used:

- by Encode and Decode in OpenJPEGNet
- as a member of AssetTexture
- for Baking
- anywhere else decoded images are used (where?)

using System;

namespace libsecondlife
{
    public class Image
    {
        [Flags]
        public enum Components
        {
            Red = 1,
            Green = 2,
            Blue = 4,
            Bump = 8,
            Alpha = 16
        };

        public int Width;
        public int Height;

        public byte[] Red;
        public byte[] Green;
        public byte[] Blue;
        public byte[] Bump;
        public byte[] Alpha;

        public Image(int width, int height, Components components)
        {
            int n = width * height;
            if ((components & Components.Red) != 0) Red = new byte[n];
            if ((components & Components.Green) != 0) Green = new byte[n];
            if ((components & Components.Blue) != 0) Blue = new byte[n];
            if ((components & Components.Bump) != 0) Bump = new byte[n];
            if ((components & Components.Alpha) != 0) Alpha = new byte[n];
        }
    }
}

_______________________________________________
libsl-dev mailing list
libsl-dev@opensecondlife.org
http://opensecondlife.org/cgi-bin/mailman/listinfo/libsl-dev


_______________________________________________
libsl-dev mailing list
libsl-dev@opensecondlife.org
http://opensecondlife.org/cgi-bin/mailman/listinfo/libsl-dev

Reply via email to