<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Answer : </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I Just did not know that it was needed to set
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>vtkImageData::SetNumberOfScalarComponents(3);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>in addition to </FONT></DIV>
<DIV><FONT face=Arial
size=2>vtkImageData::SetScalarTypeToUnsignedChar();</FONT></DIV>
<DIV><FONT face=Arial size=2>to be able to set rgb values (0-255
range)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Does 4 components allow transparency when exported
as PNG ?</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=maraux@ondim.fr href="mailto:maraux@ondim.fr">Sebastien_MARAUX</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@public.kitware.com
href="mailto:vtkusers@public.kitware.com">vtk mailing list</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, June 05, 2002 1:49
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [vtkusers] how to _ color_ write
on a vtkImageCanvasSource2D ?</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>I would like to draw lines, etc. on a (jpeg read)
image data.</FONT></DIV>
<DIV><FONT face=Arial size=2>I use a vtkimageCanvasSource2D to gain access to
the </FONT></DIV>
<DIV><FONT face=Arial size=2>image data , but when I read the re exported
image as a </FONT></DIV>
<DIV><FONT face=Arial size=2>jpeg </FONT><FONT face=Arial size=2>file, I can
only see white drawings.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>What do I do wrong ?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>snippet : </FONT></DIV>
<DIV><FONT face=Arial
size=2>/*==============================================*/</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> vtkImageData *fond =
vtkImageData::New();<BR> fond->SetDimensions(2048,2048,1);</FONT></DIV>
<DIV><FONT face=Arial
size=2> fond->SetImageData(jpgReader->GetOutput());<BR> fond->SetScalarTypeToUnsignedChar();<BR> fond->SetNumberOfScalarComponents(3);<BR> fond->SetExtent(jpgReader->GetOutput()->GetExtent());</FONT></DIV><FONT
face=Arial size=2>
<DIV><BR> vtkImageCanvasSource2D *vicsSIG =
vtkImageCanvasSource2D::New();<BR> vicsSIG->SetScalarTypeToUnsignedChar();<BR> vicsSIG->SetNumberOfScalarComponents(3);<BR> vicsSIG->SetExtent(fond->GetExtent());<BR> vicsSIG->SetDrawColor(0.0,0.0,0.0);<BR> vicsSIG->FillBox(0,texSize[0],0,texSize[1]);<BR> vicsSIG->SetDrawColor(255.0,0.0,0.0);<BR> vicsSIG->FillBox(100,500,100,500);<BR> <BR> vicsSIG->SetDrawColor(255.0,255.0,0,0);<BR> vicsSIG->DrawSegment(0,0,1024,1024);</DIV>
<DIV> vicsSIG->Update();<BR></DIV>
<DIV> vtkJPEGWriter
*jpgWriter2=vtkJPEGWriter::New();<BR> jpgWriter2->SetInput(vicsSIG->GetOutput());<BR> jpgWriter2->SetFileName("sortie2048.jpg");<BR> jpgWriter2->SetQuality(95);<BR> jpgWriter2->ProgressiveOn();<BR> tPrint("\toutputing
texture : sorti2048.jpg\n");</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>/*==============================================*/</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Sebastien
MARAUX</FONT></DIV></BLOCKQUOTE></BODY></HTML>