OurSonic.Level.Objects.LevelObjectAssetFrame.GetCache C# (CSharp) Method

GetCache() public method

public GetCache ( bool showOutline, bool showCollideMap, bool showHurtMap ) : CanvasInformation
showOutline bool
showCollideMap bool
showHurtMap bool
return OurSonic.Utility.CanvasInformation
        public CanvasInformation GetCache(bool showOutline, bool showCollideMap, bool showHurtMap)
        {
            var m =
                    Image[
                            (((showOutline ? 1 : 0) + 2) * 7) ^ (((showCollideMap ? 1 : 0) + 2) * 89) ^
                            (((showHurtMap ? 1 : 0) + 2) * 79)];


            if (m == null)
            {
                var mj = CanvasInformation.Create(Width, Height, false);
                var canvas = mj.Context;

                canvas.Save();

                canvas.StrokeStyle = "#000000";
                canvas.LineWidth = 1;



                for (var x = 0; x < Width; x++)
                {
                    for (var y = 0; y < Height; y++)
                    {
                        var ex = x;
                        var ey = y;
                        var d = ColorMap[ex][ey];

                        var color = Palette[d];
                        if (color == TransparentColor)
                        {
                            canvas.FillStyle = "rgba(0,0,0,0)";
                        }
                        else
                        {
                            //  var negative = _H.negateColor(color);
                            canvas.FillStyle = "#" + color;
                        }


                        //if (canvas.strokeStyle != "#" + negative)
                        //    canvas.strokeStyle = "#" + negative; 

                        canvas.FillRect(ex, ey, 1, 1);
                        //  if (showOutline)
                        //    canvas.strokeRect(ex, ey, 1, 1);

                        if (showCollideMap)
                        {
                            if (CollisionMap[ex][ey] > 0)
                            {
                                canvas.FillStyle = "rgba(30,34,255,0.6)";
                                canvas.FillRect(ex, ey, 1, 1);
                            }
                        }

                        if (showHurtMap)
                        {
                            if (HurtSonicMap[ex][ey] > 0)
                            {
                                canvas.FillStyle = "rgba(211,12,55,0.6)";
                                canvas.FillRect(ex, ey, 1, 1);
                            }
                        }
                    }
                }

                canvas.Restore();
                m = mj;
                SetCache(mj, showOutline, showCollideMap, showHurtMap);
            }

            return m;
        }