public void Blend(byte[] backBuffer, byte[] backClutBuffer, byte[] frontBuffer, byte[] frontClutBuffer, ref byte[] output, Pixel background = null, byte backBufferAlphaMulitplier = 0xFF, byte frontBufferAlphaMultiplayer = 0xFF)
 {
     if (background == null)
     {
         background = new Pixel(0x00, 0x00, 0x00, 0x00);
     }
     blender(backBuffer, backClutBuffer, frontBuffer, frontClutBuffer, ref output, background, backBufferAlphaMulitplier, frontBufferAlphaMultiplayer);
 }
 public void Blend(byte[] backBuffer, byte[] frontBuffer, ref byte[] output, Pixel background = null, byte backBufferAlphaMulitplier = 0xFF, byte frontBufferAlphaMultiplayer = 0xFF)
 {
     Blend(backBuffer, null, frontBuffer, null, ref output, background, backBufferAlphaMulitplier, frontBufferAlphaMultiplayer);
 }
 public void Blend(byte[] backBuffer, byte[] backClutBuffer, byte[] frontBuffer, byte[] frontClutBuffer, ref byte[] output, Pixel background = null, byte backBufferAlphaMultiplier = 0xFF, PixelBlendingMode backgroundBlendingMode = PixelBlendingMode.Multiply, byte frontBufferAlphaMultiplayer = 0xFF, PixelBlendingMode foregroundBlendingMode = PixelBlendingMode.Multiply)
 {
     if (background == null)
     {
         background = new Pixel(0x00, 0x00, 0x00, 0x00);
     }
     blender(backBuffer, backClutBuffer, frontBuffer, frontClutBuffer, ref output, background, backBufferAlphaMultiplier, backgroundBlendingMode, frontBufferAlphaMultiplayer, foregroundBlendingMode);
 }
 public void Blend(byte[] backBuffer, byte[] frontBuffer, ref byte[] output, Pixel background = null, byte backBufferAlphaMultiplier = 0xFF, PixelBlendingMode backgroundBlendingMode = PixelBlendingMode.Multiply, byte frontBufferAlphaMultiplayer = 0xFF, PixelBlendingMode foregroundBlendingMode = PixelBlendingMode.Multiply)
 {
     Blend(backBuffer, null, frontBuffer, null, ref output, background, backBufferAlphaMultiplier, backgroundBlendingMode, frontBufferAlphaMultiplayer, foregroundBlendingMode);
 }
        public static IPixelBlender GetBlender(PixelFormat backBuffer, Endianess backBufferEndianess, PixelFormat frontBuffer, Endianess frontBufferEndianes, PixelFormat output, Endianess outputEndianess, PixelFormat?clutForegroundFormat = null, PixelFormat?clutBackgroundFormat = null, Pixel bgFixedColor = null, Pixel fgFixedColor = null)
        {
            var blenderConfiguration = Tuple.Create(backBuffer, backBufferEndianess, frontBuffer, frontBufferEndianes, output, outputEndianess, bgFixedColor, fgFixedColor);

            return(blendersCache.GetOrAdd(blenderConfiguration, (_) =>
                                          new PixelBlender(backBuffer, frontBuffer, output, GenerateBlendMethod(
                                                               new BufferDescriptor
            {
                ColorFormat = backBuffer,
                ClutColorFormat = clutBackgroundFormat,
                FixedColor = bgFixedColor,
                DataEndianness = backBufferEndianess
            },
                                                               new BufferDescriptor
            {
                ColorFormat = frontBuffer,
                FixedColor = fgFixedColor,
                ClutColorFormat = clutForegroundFormat,
                DataEndianness = frontBufferEndianes
            },
                                                               new BufferDescriptor
            {
                ColorFormat = output,
                DataEndianness = outputEndianess
            }))));
        }
        public static IPixelConverter GetConverter(PixelFormat inputFormat, Endianess inputEndianess, PixelFormat outputFormat, Endianess outputEndianess, PixelFormat?clutInputFormat = null, Pixel inputFixedColor = null /* fixed color for A4 and A8 mode */)
        {
            var converterConfiguration = Tuple.Create(inputFormat, inputEndianess, outputFormat, outputEndianess, clutInputFormat, inputFixedColor);

            return(convertersCache.GetOrAdd(converterConfiguration, (_) =>
                                            new PixelConverter(inputFormat, outputFormat, GenerateConvertMethod(
                                                                   new BufferDescriptor
            {
                ColorFormat = inputFormat,
                ClutColorFormat = clutInputFormat,
                FixedColor = inputFixedColor,
                DataEndianness = inputEndianess
            },
                                                                   new BufferDescriptor
            {
                ColorFormat = outputFormat,
                DataEndianness = outputEndianess
            }))));
        }