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

void javamorph::CPolygonDecorator::fill (  )  [inline, private]

Fill the inner of the polygon with ratio 1.0.

Definition at line 284 of file CPolygonDecorator.java.

References clip().

Referenced by genClip().

                       {
        int state, min = 0, max = 0;
        boolean set;
        /* Scan line state machine. */
        for(int x = 0; x < clip.length - 1; ++x){
            state = 0;
            for(int y = 0; y < clip[0].length - 1; ++y){
                set = 0.0 < clip[x][y];
                /* Seek pattern: 1-0-1. */
                switch(state){
                    case 0: if(set)state = 1; break;
                    case 1: 
                        if(!set){
                            state = 2;
                            min = max = y;
                        }
                        break;
                    case 2: 
                        if(set){
                            state = 3;
                        }else{
                            max = y;
                        }
                        break;
                    default: break;
                }
            }
            /* Fill line when pattern of the state machine has been detected. */
            for(int y = min; y <= max && 3 == state; ++y){
                clip[x][y] = 1.0;
            }
        }
    }


Generated by  Doxygen 1.6.0   Back to index