pushparaj muthu wrote:
> Assume it there were image in boxes 1, 2, 3 (just like paint drawing drawn
> by using mouse event X and Y co -ordinates - fl_lines).
> 
> Now I want to copy the image content  of box A1, A2, A3 under tab Aaa
> group to B1, B2, and B3 under tab Bbb while change the tab.

        There's three approaches I can think of, the first being
        the easiest:

                If the A1/A2/A3 draw functions are algorithmic,
                simply make the B1/B2/B3 draw() functions use
                the same algorithm that the A1/A2/A3 widgets use.

        The other two involve keeping an image buffer snapshot
        of the contents of the A[123] boxes, which is updated
        whenever their contents is changed, the way a 'paint program'
        would.

        The second way is to use fl_read_image() to take screenshots
        of the A[123] widgets whenever they're displayed/changed
        and save the screenshot into a memory buffer that is later
        drawn with fl_draw_image() by the B[123] box's draw() routine.

        Problem with that is fl_read_image() will take *literal*
        screenshots, which means if your Aaa window is obscured
        by another window manager window, you'll get garbage in
        your buffer, or other 'interference' from the window manager.

        The third, cleaner way, involves some work. You have to do
        what a normal paint program does, where they draw directly
        into the ram buffer (instead of using fl_line(), etc), then
        regularly 'blit' that ram buffer to the screen using a
        function like fl_draw_image().

        To do this, you would do all drawing operations directly to
        a ram buffer using line drawing functions you supply
        (bresenham algorithm, etc) and then configure both the A[123]
        and B[123] widget's draw() functions to blit that buffer to
        the screen using fl_draw_image();

        Most all paint programs do something like this; whenever you
        draw a paint stroke, that stroke is first 'drawn' directly
        into ram using the paint program's own drawing functions,
        then that ram buffer is 'blitted' to the screen to show
        the paint stroke. This way lines can be composited over each
        other, such that antialiasing functions work correctly,
        and you can zoom/pan around, even while the window is obscured
        by other window manager windows.

        But that's hard work.. might be more than you're ready for,
        unless you're up for writing a "paint program"..

> My doubt is while moving to tab Bbb. 

        Shouldn't be a problem if you keep the Aaa pixels that were
        drawn in an image buffer, so that whenever the Aaa widgets
        are changed, the image buffer copy is updated, and the Bbb
        widgets simply draw that buffer to the screen while the Aaa
        widgets are hidden.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to