Changeset 17807 for trunk/psLib/src/imageops/psImageConvolve.c
- Timestamp:
- May 24, 2008, 12:23:14 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageConvolve.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageConvolve.c
r17726 r17807 7 7 /// @author Eugene Magnier, IfA 8 8 /// 9 /// @version $Revision: 1.6 7$ $Name: not supported by cvs2svn $10 /// @date $Date: 2008-05- 17 01:38:20$9 /// @version $Revision: 1.68 $ $Name: not supported by cvs2svn $ 10 /// @date $Date: 2008-05-24 22:23:14 $ 11 11 /// 12 12 /// Copyright 2004-2007 Institute for Astronomy, University of Hawaii … … 795 795 int numCols = mask->numCols; // Number of columns 796 796 797 if (!out) { 798 // Propagate the non-masked values 799 out = (psImage*)psBinaryOp(NULL, (const psPtr)mask, "&", psScalarAlloc(~maskVal, PS_TYPE_MASK)); 800 } 797 // Propagate the non-masked values 798 out = (psImage*)psBinaryOp(out, (const psPtr)mask, "&", psScalarAlloc(~setVal, PS_TYPE_MASK)); 801 799 802 800 if (!setVal) { … … 804 802 } 805 803 804 psImage *conv = psImageAlloc(numCols, numRows, PS_TYPE_MASK); // Temporary convolved image 805 psImageInit(conv, 0); 806 806 807 // Dereference mask images 807 808 psMaskType **maskData = mask->data.PS_TYPE_MASK_DATA; 809 psMaskType **convData = conv->data.PS_TYPE_MASK_DATA; 808 810 psMaskType **outData = out->data.PS_TYPE_MASK_DATA; 809 811 … … 826 828 min = PS_MAX(0, min); 827 829 max = PS_MIN(numCols - 1, max); 828 for (int i = min; i < max; i++) { 829 outData[y][i] |= setVal; 830 } 830 memset(&convData[y][min], 0xff, (max - min + 1) * PSELEMTYPE_SIZEOF(PS_TYPE_MASK)); 831 831 } 832 832 } … … 836 836 bool masking = false; // Currently masking? 837 837 for (int y = 0; y < numRows; y++) { 838 if ( maskData[y][x] & maskVal) {838 if (convData[y][x]) { 839 839 if (!masking) { 840 840 masking = true; … … 849 849 min = PS_MAX(0, min); 850 850 max = PS_MIN(numRows - 1, max); 851 for (int i = min; i < max; i++) {851 for (int i = min; i <= max; i++) { 852 852 outData[i][x] |= setVal; 853 853 } … … 856 856 } 857 857 858 psFree(conv); 859 858 860 return out; 859 861 }
Note:
See TracChangeset
for help on using the changeset viewer.
