Subversion Repositories filter_foundry

Rev

Rev 217 | Rev 259 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 217 Rev 232
Line 63... Line 63...
63
}
63
}
64
 
64
 
65
/* Channel z for the input pixel at coordinates x,y.
65
/* Channel z for the input pixel at coordinates x,y.
66
 * Coordinates are relative to the input image data (pb->inData) */
66
 * Coordinates are relative to the input image data (pb->inData) */
67
static value_type rawsrc(value_type x,value_type y,value_type z){
67
static value_type rawsrc(value_type x,value_type y,value_type z){
-
 
68
        if (HAS_BIG_DOC(gpb)) {
-
 
69
                if (x < BIGDOC_IN_RECT(gpb).left)
-
 
70
                        x = BIGDOC_IN_RECT(gpb).left;
-
 
71
                else if (x >= BIGDOC_IN_RECT(gpb).right)
-
 
72
                        x = BIGDOC_IN_RECT(gpb).right - 1;
-
 
73
                if (y < BIGDOC_IN_RECT(gpb).top)
-
 
74
                        y = BIGDOC_IN_RECT(gpb).top;
-
 
75
                else if (y >= BIGDOC_IN_RECT(gpb).bottom)
-
 
76
                        y = BIGDOC_IN_RECT(gpb).bottom - 1;
-
 
77
                return ((unsigned char*)gpb->inData)[(long)gpb->inRowBytes * (y - BIGDOC_IN_RECT(gpb).top)
-
 
78
                        + (long)nplanes * (x - BIGDOC_IN_RECT(gpb).left) + z];
-
 
79
        } else {
68
        if(x < gpb->inRect.left)
80
                if (x < IN_RECT(gpb).left)
69
                x = gpb->inRect.left;
81
                        x = IN_RECT(gpb).left;
70
        else if(x >= gpb->inRect.right)
82
                else if (x >= IN_RECT(gpb).right)
71
                x = gpb->inRect.right-1;
83
                        x = IN_RECT(gpb).right - 1;
72
        if(y < gpb->inRect.top)
84
                if (y < IN_RECT(gpb).top)
73
                y = gpb->inRect.top;
85
                        y = IN_RECT(gpb).top;
74
        else if(y >= gpb->inRect.bottom)
86
                else if (y >= IN_RECT(gpb).bottom)
75
                y = gpb->inRect.bottom-1;
87
                        y = IN_RECT(gpb).bottom - 1;
76
        return ((unsigned char*)gpb->inData)[ (long)gpb->inRowBytes*(y - gpb->inRect.top)
88
                return ((unsigned char*)gpb->inData)[(long)gpb->inRowBytes * (y - IN_RECT(gpb).top)
77
                                                                                  + (long)nplanes*(x - gpb->inRect.left) + z ];
89
                        + (long)nplanes * (x - IN_RECT(gpb).left) + z];
-
 
90
        }
78
}
91
}
79
 
92
 
80
/* src(x,y,z) Channel z for the pixel at coordinates x,y.
93
/* src(x,y,z) Channel z for the pixel at coordinates x,y.
81
 * Coordinates are relative to filtered area (selection). */
94
 * Coordinates are relative to filtered area (selection). */
82
value_type ff_src(value_type x,value_type y,value_type z){
95
value_type ff_src(value_type x,value_type y,value_type z){
Line 313... Line 326...
313
{
326
{
314
#ifdef PARSERTEST
327
#ifdef PARSERTEST
315
        return 0;
328
        return 0;
316
#else
329
#else
317
        long total;
330
        long total;
-
 
331
        int x, y, z;
318
        // shift x,y from selection-relative to image relative
332
        // shift x,y from selection-relative to image relative
-
 
333
        if (HAS_BIG_DOC(gpb)) {
-
 
334
                x = var['x'] + BIGDOC_FILTER_RECT(gpb).left;
-
 
335
                y = var['y'] + BIGDOC_FILTER_RECT(gpb).top;
-
 
336
        } else {
319
        int x = var['x'] + gpb->filterRect.left,
337
                x = var['x'] + FILTER_RECT(gpb).left;
320
                y = var['y'] + gpb->filterRect.top,
338
                y = var['y'] + FILTER_RECT(gpb).top;
-
 
339
        }
321
                z = var['z'];
340
        z = var['z'];
322
 
341
 
323
        if(z >= 0 && z < var['Z'])
342
        if(z >= 0 && z < var['Z'])
324
                total = m11*rawsrc(x-1,y-1,z) + m12*rawsrc(x,y-1,z) + m13*rawsrc(x+1,y-1,z)
343
                total = m11*rawsrc(x-1,y-1,z) + m12*rawsrc(x,y-1,z) + m13*rawsrc(x+1,y-1,z)
325
                          + m21*rawsrc(x-1,y,  z) + m22*rawsrc(x,y,  z) + m23*rawsrc(x+1,y,  z)
344
                          + m21*rawsrc(x-1,y,  z) + m22*rawsrc(x,y,  z) + m23*rawsrc(x+1,y,  z)