Logo Search packages:      
Sourcecode: inkscape version File versions

void IntLigne::Copy ( BitLigne *  a  ) 

Transform a line of bits into pixel coverage values.

This is where you go from supersampled data to alpha values.

See also:
IntLigne::Copy(int nbSub,BitLigne* *a).

Definition at line 442 of file int-line.cpp.

{
    if ( a->curMax <= a->curMin ) {
        Reset();
        return;
    }
    
    if ( a->curMin < a->st ) {
        a->curMin = a->st;
    }
    
    if ( a->curMax < a->st ) {
        Reset();
        return;
    }
    
    if ( a->curMin > a->en ) {
        Reset();
        return;
    }
    
    if ( a->curMax > a->en ) {
        a->curMax=a->en;
    }
    
    nbBord = 0;
    nbRun = 0;

    int lastVal = 0;
    int lastStart = 0;
    bool startExists = false;

    int masks[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };

    uint32_t c_full = a->fullB[(a->curMin-a->st) >> 3];
    uint32_t c_part = a->partB[(a->curMin-a->st) >> 3];
    c_full <<= 4 * ((a->curMin - a->st) & 0x00000007);
    c_part <<= 4 * ((a->curMin - a->st) & 0x00000007);
    for (int i = a->curMin; i <= a->curMax; i++) {
        int nbBit = masks[c_full >> 28] + masks[c_part >> 28];

        if ( nbBit > 0 ) {
            if ( startExists ) {
                if ( lastVal == nbBit ) {
                    // on continue le run
                } else {
                    AddRun(lastStart, i, ((float) lastVal) / 4, ((float) lastVal) / 4);
                    lastStart = i;
                    lastVal = nbBit;
                }
            } else {
                lastStart = i;
                lastVal = nbBit;
                startExists = true;
            }
        } else {
            if ( startExists ) {
                AddRun(lastStart, i, ((float) lastVal) / 4, ((float) lastVal) / 4);
            }
            startExists = false;
        }
        int chg = (i + 1 - a->st) & 0x00000007;
        if ( chg == 0 ) {
            c_full = a->fullB[(i + 1 - a->st) >> 3];
            c_part = a->partB[(i + 1 - a->st) >> 3];
        } else {
            c_full <<= 4;
            c_part <<= 4;
        }
    }
    if ( startExists ) {
        AddRun(lastStart, a->curMax + 1, ((float) lastVal) / 4, ((float) lastVal) / 4);
    }
}


Generated by  Doxygen 1.6.0   Back to index