[vtkusers] How to clear canvas using vtkImageCanvasSource2D?

David Doria daviddoria+vtk at gmail.com
Thu Jul 15 02:41:55 EDT 2010


On Wed, Jul 14, 2010 at 10:48 AM, Kee Tang <ktang at profoundmedical.com> wrote:
> Hi All,
>
>
>
> I saw a couple postings on this question but no answers…Does anyone know how
> to add a drawing object (e.g. FillTube) on the vtkImageCanvasSource2D then
> remove it afterwards?  Essentially I’d like to know how to clear the canvas
> so I can redraw on it repeatedly.
>
> My current solution is to SetDrawColor(0,0,0,0) then use FillBox(0,
> m_CanvasSize-1, 0, m_CanvasSize-1) to clean the canvas but I’m worried this
> will continually add objects on the canvas without actually deleting
> previous objects.
>
> Thanks,
> K

As far as I understand, the FillBox type methods simply set pixel
values in the image object. There is no collection of objects stored,
which means you would have to do the keeping track of the hierarchy
manually if you wanted to delete an "object" from the canvas. The good
news is that this means clearing the image with FillBox is ok.

David



More information about the vtkusers mailing list