Ejemplo n.º 1
0
 void snap(const int p, const prevPlanes &pp, ColorVal &min, ColorVal &max, ColorVal &v) const {
     if (p==0 || p==3) { min=bounds[p].first; max=bounds[p].second; } // optimization for special case
     else ranges->snap(p,pp,min,max,v);
     if (min < bounds[p].first) min=bounds[p].first;
     if (max > bounds[p].second) max=bounds[p].second;
     if (min>max) {
        // should happen only if alpha=0 interpolation produces YI combination for which Q range from ColorRangesYIQ is outside bounds
        min=bounds[p].first;
        max=bounds[p].second;
     }
     if(v>max) v=max;
     if(v<min) v=min;
 }
Ejemplo n.º 2
0
    bool exists(const int p, const prevPlanes &pp) const {
        if (p>0 && (pp[0] < min0 || pp[0] > ranges->max(0))) return false;
        if (p>1 && (pp[1] < min1 || pp[1] > ranges->max(1))) return false;

        ColorVal rmin, rmax;
        ColorVal v=pp[p];
        ranges->snap(p,pp,rmin,rmax,v);
        if (v != pp[p]) return false;   // bucket empty because of original range constraints

        const ColorBucket b = findBucket(p,pp);
        //if (b.min > b.max) return false;
        if (b.snapColor_slow(pp[p]) != pp[p]) return false;
        return true;
    }