]> Creatis software - creaVtk.git/commitdiff
#3233 creaVtk Feature New Normal - GetCameraInfo SetCameraInfo ScreenShot master
authorEduardo DAVILA <davila@localhost.localdomain>
Fri, 30 Nov 2018 14:00:49 +0000 (15:00 +0100)
committerEduardo DAVILA <davila@localhost.localdomain>
Fri, 30 Nov 2018 14:00:49 +0000 (15:00 +0100)
bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbg
bbtk_creaVtk_PKG/bbs/appli/exampleScreenShot.bbs
bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.cxx
bbtk_creaVtk_PKG/src/bbcreaVtkScreenShot.h

index 90ba0a53069c0b858c875639cfbda39a1eccd948..0958f47ee951c2bd0256e816f906a77766ee5750 100644 (file)
@@ -17,6 +17,8 @@ ISEXEC:FALSE
 7.157864:7.257698:-900.000000
 PORT
 FileName:"ScreenShot.png"
+PORT
+Scale:"2 2"
 FIN_BOX
 BOX
 vtk:LoadHola:Box01
index 34ea539763f02dcaed9905b51ad2583bf50330cf..062ab0448529830192dd9d5eb6f1520457465bb3 100644 (file)
@@ -19,6 +19,7 @@ category "<VOID>"
 
 new creaVtk:ScreenShot Box00
   set Box00.FileName "ScreenShot.png"
+  set Box00.Scale "2 2"
 
 new vtk:LoadHola Box01
 
index 35a5998a0f05ec31e1987ada7cd368b4336bc4f8..4ee0b66d14a1f495628ec992f58eeed6e97ac13c 100644 (file)
@@ -37,17 +37,21 @@ void ScreenShot::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
   
-      vtkWindowToImageFilter *wif = vtkWindowToImageFilter::New();
+       vtkWindowToImageFilter *wif = vtkWindowToImageFilter::New();
+               if (bbGetInputSize().size()==2) 
+               {
+                       bbGetInputvtkRenderer()->GetVTKWindow()->SetSize( bbGetInputSize()[0], bbGetInputSize()[1] );
+               }
        wif->SetInput( bbGetInputvtkRenderer()->GetVTKWindow() );
        wif->SetMagnification( bbGetInputScale()[0] );
 //             wif->SetScale( bbGetInputScale()[0], bbGetInputScale()[1] );
        wif->SetInputBufferTypeToRGB();
        wif->ReadFrontBufferOff();
        wif->Update();
-      vtkPNGWriter *writer = vtkPNGWriter::New();
-       writer->SetFileName( bbGetInputFileName().c_str() );
-       writer->SetInput(wif->GetOutput());
-       writer->Write();        
+       vtkPNGWriter *writer = vtkPNGWriter::New();
+               writer->SetFileName( bbGetInputFileName().c_str() );
+               writer->SetInput(wif->GetOutput());
+               writer->Write();        
 
 /*
        vtkFFMPEGWriter *writer2 = vtkFFMPEGWriter::New();
index 307d8f79e96aa81eab34701d668e19070a6c676b..3f37cfb1f48e0630f56738112e84474608d5462d 100644 (file)
@@ -21,6 +21,7 @@ class bbcreaVtk_EXPORT ScreenShot
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
   BBTK_DECLARE_INPUT(FileName,std::string);
+  BBTK_DECLARE_INPUT(Size,std::vector<int>);
   BBTK_DECLARE_INPUT(Scale,std::vector<int>);
   BBTK_DECLARE_INPUT(vtkRenderer,vtkRenderer*);
 //  BBTK_DECLARE_OUTPUT(Out,double);
@@ -36,6 +37,7 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ScreenShot,bbtk::AtomicBlackBox);
   BBTK_AUTHOR("InfoDev");
   BBTK_DESCRIPTION("No Description.");
   BBTK_CATEGORY("empty");
+  BBTK_INPUT(ScreenShot,Size,"[sX,sY] size of the render window.  Default [actual window sX,  actual window sY]",std::vector<int>,"");
   BBTK_INPUT(ScreenShot,Scale,"[scaleX,scaleY]  default [1,1]",std::vector<int>,"");
   BBTK_INPUT(ScreenShot,FileName,"File Name Default:ScreenShot-BBTK.png",std::string,"");
   BBTK_INPUT(ScreenShot,vtkRenderer,"First input",vtkRenderer*,"");