>
> > Yes, I called drawline outside draw() function, now I know if=20
> > I put the drawline() into override draw() function will has=20
> > no such issue. But I still has question, because I use=20
> > drawline() function to implement a painter application, so if=20
> > I put the drawline() into draw() function, then it will call=20
> > lots of drawline() at each redarw(). So does fltk has a=20
> > better solution to implement a painter application? Thanks.
>
>
> If you want to "build up" an image over many interactions, you basically
> have two options...
>
> A) You can keep a record of all the drawn lines and replay them every
> time you draw() your widget.
> You can just store them in a linked list (e.g. via the STL, or make your
> own, or etc.)
> The actual drawing doesn't usually take all that long, so you might find
> this works very well.
> Note that this way makes it *very easy* to implement an undo function -
> you can simply delete the last few entries off the end of the
> linked-list and redraw, and that's the edit undone!
>
> Also, this approach makes it very easy to store your drawing in a vector
> format, since you have all the individual line vectors available to
> store.
>
>
> B) Use an offscreen to do the drawing. This will not be cleared between
> redraws, so you can build up a drawing over time in the offscreen
> surface, then blit that to the onscreen window for the operator to see.
>
> This is maybe more like what you had in mind, where the drawing is built
> up over time, and only the changes are actually drawn in each redraw
> (not the whole thing.)
>
> But this makes it very hard to implement an undo function, and can
> usually only be stored in a pixel format, not a vector format.
>
>
> Anyhow, either way works, so you can easily try both then see which
> suits your way of working best.
>
> --=20
> Ian
>
>
> SELEX Galileo Ltd
> Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS=
> 14 3EL
> A company registered in England & Wales. Company no. 02426132
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************
>
Dear sir,
Thanks for your answers, I do some test find.
1.I put drawline() into my overrided draw(), and run any widgets' redraw
function of the window(Widget p->redraw()) before push buttons, then find it
will save my draw pictures. But there is another problem, if run drawline() in
override draw(), it draws slowly and some points lost own to somewhere is
blocked, so is there any good method, that can draw fastly and save the picture
itself??
2. I also tryed your A method, it draw fastly, but it is complicated,
because we have different size pen and eraser, the classification is not easy.
Best regards,
shuiyingzi515
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk