Example #1
0
        public virtual Canvas Rotate(TranslateCharacter translate = null)
        {
            var mc = new MemoryCanvas(new Size(Height, Width));

            for (int y = 0; y < mc.Height; y++)
            {
                for (int x = 0; x < mc.Width; x++)
                {
                    var val = this[y, x];
                    if (translate != null)
                    {
                        val.Character = translate(val.Character);
                    }
                    mc[mc.Width - x - 1, y] = val;
                }
            }
            return(mc);
        }
Example #2
0
 public virtual void FlipY(TranslateCharacter translate = null)
 {
     for (int y = 0; y < (Height + 0) / 2; y++)
     {
         int bottom = Height - y - 1;
         for (int x = 0; x < Width; x++)
         {
             var valt = this[x, y];
             var valb = this[x, bottom];
             if (translate != null)
             {
                 valt.Character = translate(valt.Character);
                 valb.Character = translate(valb.Character);
             }
             this[x, y]      = valb;
             this[x, bottom] = valt;
         }
     }
 }
Example #3
0
 public virtual void FlipX(TranslateCharacter translate = null)
 {
     for (int y = 0; y < Height; y++)
     {
         for (int x = 0; x < Width / 2; x++)
         {
             int right = Width - x - 1;
             var vall  = this[x, y];
             var valr  = this[right, y];
             if (translate != null)
             {
                 vall.Character = translate(vall.Character);
                 valr.Character = translate(valr.Character);
             }
             this[x, y]     = valr;
             this[right, y] = vall;
         }
     }
 }