public DrawVisible_Cache(IDrawVisible <IGraphics> next, IDimension cbcol, IDimension cbrow)
        {
            _cache[0] = new cimg();
            _cache[1] = new cimg();

            _next  = next;
            _cbcol = cbcol;
            _cbrow = cbrow;

            _next.changed  += on_chained_change;
            _cbcol.changed += on_columnwidth_change;
            _cbrow.changed += on_rowheight_change;
        }
            public void get_image(cimg prev, IDrawVisible <IGraphics> next, CellRange viz, IBoxGetter box, IGraphics gr)
            {
                range = viz;

                double width = 0;

                for (int i = range.col_first; i <= range.col_last; i++)
                {
                    double cx;
                    double cy;
                    double cwidth;
                    double cheight;
                    box.GetBox(i, 0,
                               out cx,
                               out cy,
                               out cwidth,
                               out cheight
                               );
                    if (i == range.col_first)
                    {
                        xorigin = cx;
                    }
                    width += cwidth;
                }

                double height = 0;

                for (int i = range.row_first; i <= range.row_last; i++)
                {
                    double cx;
                    double cy;
                    double cwidth;
                    double cheight;
                    box.GetBox(0, i,
                               out cx,
                               out cy,
                               out cwidth,
                               out cheight
                               );
                    if (i == range.row_first)
                    {
                        yorigin = cy;
                    }
                    height += cheight;
                }

                //destroy ();
                gr.BeginOffscreen((float)width, (float)height, img);
                if (
                    (prev == null) ||
                    (null == prev.range) ||
                    (null == prev.range.Intersect(range))
                    )
                {
                    next.func_draw(-xorigin, -yorigin, range, box, gr);
                }
                else
                {
                    prev.draw(-xorigin, -yorigin, gr);
                    List <CellRange> missing = range.Subtract(prev.range);
                    foreach (CellRange mv in missing)
                    {
                        next.func_draw(-xorigin, -yorigin, mv, box, gr);
                    }
                }
                img = gr.EndOffscreen();
            }