Ejemplo n.º 1
0
        public void SetData(PixelFormatDecoder.OutputPixel *Pixels, int Width, int Height)
        {
            Bind();
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, Width, Height, 0, PixelFormat.Rgba, PixelType.UnsignedInt8888Reversed, new IntPtr(Pixels));

            //glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE, 1.0); // 2.0 in scale_2x
            //GL.TexEnv(TextureEnvTarget.TextureEnv, GL_TEXTURE_ENV_MODE, TextureEnvModeTranslate[state.texture.effect]);
        }
Ejemplo n.º 2
0
        static public void Decode(GuPixelFormats PixelFormat, void *Input, OutputPixel *Output, int Width, int Height, void *Palette = null, GuPixelFormats PaletteType = GuPixelFormats.NONE, int PaletteCount = 0, int PaletteStart = 0, int PaletteShift = 0, int PaletteMask = 0xFF, int StrideWidth = -1)
        {
            if (StrideWidth == -1)
            {
                StrideWidth = GetPixelsSize(PixelFormat, Width);
            }
            var PixelFormatInt     = (int)PixelFormat;
            var PixelFormatDecoder = new PixelFormatDecoder()
            {
                _Input       = Input,
                InputByte    = (byte *)Input,
                InputShort   = (ushort *)Input,
                InputInt     = (uint *)Input,
                Output       = Output,
                StrideWidth  = StrideWidth,
                Width        = Width,
                Height       = Height,
                Palette      = Palette,
                PaletteType  = PaletteType,
                PaletteCount = PaletteCount,
                PaletteStart = PaletteStart,
                PaletteShift = PaletteShift,
                PaletteMask  = PaletteMask,
            };

            //Console.WriteLine(PixelFormat);
            switch (PixelFormat)
            {
            case GuPixelFormats.RGBA_5650: PixelFormatDecoder.Decode_RGBA_5650(); break;

            case GuPixelFormats.RGBA_5551: PixelFormatDecoder.Decode_RGBA_5551(); break;

            case GuPixelFormats.RGBA_4444: PixelFormatDecoder.Decode_RGBA_4444(); break;

            case GuPixelFormats.RGBA_8888: PixelFormatDecoder.Decode_RGBA_8888(); break;

            case GuPixelFormats.PALETTE_T4: PixelFormatDecoder.Decode_PALETTE_T4(); break;

            case GuPixelFormats.PALETTE_T8: PixelFormatDecoder.Decode_PALETTE_T8(); break;

            case GuPixelFormats.PALETTE_T16: PixelFormatDecoder.Decode_PALETTE_T16(); break;

            case GuPixelFormats.PALETTE_T32: PixelFormatDecoder.Decode_PALETTE_T32(); break;

            case GuPixelFormats.COMPRESSED_DXT1: PixelFormatDecoder.Decode_COMPRESSED_DXT1(); break;

            case GuPixelFormats.COMPRESSED_DXT3: PixelFormatDecoder.Decode_COMPRESSED_DXT3(); break;

            case GuPixelFormats.COMPRESSED_DXT5: PixelFormatDecoder.Decode_COMPRESSED_DXT5(); break;

            default: throw(new InvalidOperationException());
            }
            //DecoderCallbackTable[PixelFormatInt](Input, Output, PixelCount, Width, Palette, PaletteType, PaletteCount, PaletteStart, PaletteShift, PaletteMask);
        }
Ejemplo n.º 3
0
 public static void Decode(GuPixelFormats PixelFormat, void* Input, OutputPixel* Output, int Width, int Height, void* Palette = null, GuPixelFormats PaletteType = GuPixelFormats.NONE, int PaletteCount = 0, int PaletteStart = 0, int PaletteShift = 0, int PaletteMask = 0xFF, int StrideWidth = -1)
 {
     if (StrideWidth == -1) StrideWidth = GetPixelsSize(PixelFormat, Width);
     var PixelFormatInt = (int)PixelFormat;
     var PixelFormatDecoder = new PixelFormatDecoder()
     {
         _Input = Input,
         InputByte = (byte *)Input,
         InputShort = (ushort*)Input,
         InputInt = (uint*)Input,
         Output = Output,
         StrideWidth = StrideWidth,
         Width = Width,
         Height = Height,
         Palette = Palette,
         PaletteType = PaletteType,
         PaletteCount = PaletteCount,
         PaletteStart = PaletteStart,
         PaletteShift = PaletteShift,
         PaletteMask = PaletteMask,
     };
     //Console.WriteLine(PixelFormat);
     switch (PixelFormat)
     {
         case GuPixelFormats.RGBA_5650: PixelFormatDecoder.Decode_RGBA_5650(); break;
         case GuPixelFormats.RGBA_5551: PixelFormatDecoder.Decode_RGBA_5551(); break;
         case GuPixelFormats.RGBA_4444: PixelFormatDecoder.Decode_RGBA_4444(); break;
         case GuPixelFormats.RGBA_8888: PixelFormatDecoder.Decode_RGBA_8888(); break;
         case GuPixelFormats.PALETTE_T4: PixelFormatDecoder.Decode_PALETTE_T4(); break;
         case GuPixelFormats.PALETTE_T8: PixelFormatDecoder.Decode_PALETTE_T8(); break;
         case GuPixelFormats.PALETTE_T16: PixelFormatDecoder.Decode_PALETTE_T16(); break;
         case GuPixelFormats.PALETTE_T32: PixelFormatDecoder.Decode_PALETTE_T32(); break;
         case GuPixelFormats.COMPRESSED_DXT1: PixelFormatDecoder.Decode_COMPRESSED_DXT1(); break;
         case GuPixelFormats.COMPRESSED_DXT3: PixelFormatDecoder.Decode_COMPRESSED_DXT3(); break;
         case GuPixelFormats.COMPRESSED_DXT5: PixelFormatDecoder.Decode_COMPRESSED_DXT5(); break;
         default: throw(new InvalidOperationException());
     }
     //DecoderCallbackTable[PixelFormatInt](Input, Output, PixelCount, Width, Palette, PaletteType, PaletteCount, PaletteStart, PaletteShift, PaletteMask);
 }
Ejemplo n.º 4
0
 protected void _SetVertexInfoColor(PixelFormatDecoder.OutputPixel Color)
 {
     VertexInfo->R = (float)(Color.R) / 255.0f;
     VertexInfo->G = (float)(Color.G) / 255.0f;
     VertexInfo->B = (float)(Color.B) / 255.0f;
     VertexInfo->A = (float)(Color.A) / 255.0f;
 }