Beispiel #1
0
        public void func_draw(double xoff, double yoff, CellRange viz, IBoxGetter box, TGraphics gr)
        {
            foreach (var dh in draw_handlers)
            {
                // TODO could do xoff/yoff here and pass zeroes down to the layers

                dh.func_draw(xoff, yoff, viz, box, gr);
            }
        }
        public void func_draw(double xoff, double yoff, CellRange viz, IBoxGetter box, IGraphics gr)
        {
            if (_cache [0].is_usable(viz))
            {
                _cur = 0;
            }
            else if (_cache [1].is_usable(viz))
            {
                _cur = 1;
            }
            else
            {
                get_image(_next, viz, box, gr);
            }

            _cache[_cur].draw(xoff, yoff, gr);
        }
        private void get_image(IDrawVisible <IGraphics> next, CellRange viz, IBoxGetter box, IGraphics gr)
        {
                        #if true
            const int extra_cols = 2;
            const int extra_rows = 2;

            // TODO we don't want to alloc here
            CellRange newrange = new CellRange(
                Math.Max(viz.col_first - extra_cols, 0),
                viz.col_last + extra_cols,                // TODO constrain
                Math.Max(viz.row_first - extra_rows, 0),
                viz.row_last + extra_rows                 // TODO constrain
                );
                        #endif

            int newcur = (_cur + 1) % 2;
            _cache[newcur].get_image(_cache[_cur], next, newrange, box, gr);
            _cur = newcur;
        }
Beispiel #4
0
 public void func_draw(double xoff, double yoff, CellRange viz, IBoxGetter box, TGraphics gr)
 {
     _cd.func_begin_update(viz);
     for (int row = viz.row_first; row <= viz.row_last; row++)
     {
         for (int col = viz.col_first; col <= viz.col_last; col++)
         {
             double cx;
             double cy;
             double cwidth;
             double cheight;
             box.GetBox(col, row,
                        out cx,
                        out cy,
                        out cwidth,
                        out cheight
                        );
             _cd.func_cell_draw(col, row, xoff + cx, yoff + cy, cwidth, cheight, gr);
         }
     }
     _cd.func_end_update();
 }
            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();
            }