[vtkusers] how to _ color_ write on a vtkImageCanvasSource2D ?
Sebastien_MARAUX
maraux at ondim.fr
Wed Jun 5 07:49:48 EDT 2002
I would like to draw lines, etc. on a (jpeg read) image data.
I use a vtkimageCanvasSource2D to gain access to the
image data , but when I read the re exported image as a
jpeg file, I can only see white drawings.
What do I do wrong ?
snippet :
/*==============================================*/
vtkImageData *fond = vtkImageData::New();
fond->SetDimensions(2048,2048,1);
fond->SetImageData(jpgReader->GetOutput());
fond->SetScalarTypeToUnsignedChar();
fond->SetNumberOfScalarComponents(3);
fond->SetExtent(jpgReader->GetOutput()->GetExtent());
vtkImageCanvasSource2D *vicsSIG = vtkImageCanvasSource2D::New();
vicsSIG->SetScalarTypeToUnsignedChar();
vicsSIG->SetNumberOfScalarComponents(3);
vicsSIG->SetExtent(fond->GetExtent());
vicsSIG->SetDrawColor(0.0,0.0,0.0);
vicsSIG->FillBox(0,texSize[0],0,texSize[1]);
vicsSIG->SetDrawColor(255.0,0.0,0.0);
vicsSIG->FillBox(100,500,100,500);
vicsSIG->SetDrawColor(255.0,255.0,0,0);
vicsSIG->DrawSegment(0,0,1024,1024);
vicsSIG->Update();
vtkJPEGWriter *jpgWriter2=vtkJPEGWriter::New();
jpgWriter2->SetInput(vicsSIG->GetOutput());
jpgWriter2->SetFileName("sortie2048.jpg");
jpgWriter2->SetQuality(95);
jpgWriter2->ProgressiveOn();
tPrint("\toutputing texture : sorti2048.jpg\n");
/*==============================================*/
Sebastien MARAUX
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020605/68792b23/attachment.htm>
More information about the vtkusers
mailing list