Logo Search packages:      
Sourcecode: javamorph version File versions  Download package

void javamorph::CMorphOperator::run (  )  [inline]

Thread API. Starts morph batch for a number of intermediate pictures with increasing ratio value.

Definition at line 82 of file CMorphOperator.java.

References javamorph::CProgress::close(), f_break, genResultTriangles(), parent, progress, ratio, javamorph::CProgress::setProgress(), t_idx, and triangle().

                     {
        f_break = false;
        try{
            for(int i = 0;
                (i <= CConfig.NUM_OF_MORPH_STEPS) && (!f_break); 
                ++i){
                /* Clear result picture.*/
                for(int x = 0; x < CConfig.result_image.getWidth(); ++x){
                    for(int y = 0; y < CConfig.result_image.getHeight(); ++ y){
                        CConfig.result_image.setRGB(x, y, 0x0);
                    }
                }
                /* Calculate ratio. */
                ratio = ((double)i / CConfig.NUM_OF_MORPH_STEPS);
                /* Depends on current ratio. */
                genResultTriangles();
                /* Iterate through the triangles. */
                for(t_idx = 0; 
                    t_idx < CConfig.result_triangles.size(); 
                    ++t_idx){
                    triangle();
                }
                File f = new File(CStrings.getOutput(i));
                /* Save image into workdir. */
                ImageIO.write(CConfig.result_image, "jpg",f);
                /* Show progress. */
                progress.setProgress(i, 0, CConfig.NUM_OF_MORPH_STEPS);
                Thread.sleep(1);
            }
            progress.close();
        }catch(Exception e){
            System.err.println(e.getMessage());
            e.printStackTrace();
            JOptionPane.showMessageDialog(parent, 
                    "Can't save result. Please see console output!");
            
        }
    }


Generated by  Doxygen 1.6.0   Back to index