AlbLib.Imaging.GraphicPlane.ApplyBake C# (CSharp) Méthode

ApplyBake() private méthode

private ApplyBake ( byte tobake ) : void
tobake byte
Résultat void
        private void ApplyBake(byte[] tobake)
        {
            int width = Background.GetWidth();
            int height = Background.GetHeight();
            TransparencyTable trans = TransparencyTable;
            foreach(GraphicObject obj in Objects)
            {
                if(obj == null || obj.Image == null)continue;
                for(int y = 0; y < obj.Image.GetHeight(); y++)
                for(int x = 0; x < obj.Image.GetWidth(); x++)
                {
                    if(x+obj.Location.X >= 0 && y+obj.Location.Y >= 0 && x+obj.Location.X < width && y+obj.Location.Y < height)
                    {
                        byte color = obj.Image.ImageData[obj.Image.GetWidth()*y+x];
                        if(color == obj.TransparentIndex)continue;
                        int index = width*(y+obj.Location.Y)+obj.Location.X+x;
                        if(trans == null || obj.Transparency == TransparencyType.None)
                        {
                            tobake[index] = color;
                        }else{
                            tobake[index] = trans.GetResultingColorIndex(color, tobake[index], obj.Transparency);
                        }
                    }
                }
            }
        }