Changeset 5224 for trunk/psLib/test/imageops/tst_psImagePixelManip.c
- Timestamp:
- Oct 4, 2005, 5:51:43 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/imageops/tst_psImagePixelManip.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/imageops/tst_psImagePixelManip.c
r4547 r5224 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2005- 07-13 02:47:00$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-10-05 03:51:43 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 29 29 static psS32 testImageClipComplexRegion(void); 30 30 static psS32 testImageOverlay(void); 31 static psS32 testImageKeepMask(void); 31 32 32 33 testDescription tests[] = { … … 35 36 {testImageClipComplexRegion,673,"psImageClipComplexRegion",0,false}, 36 37 {testImageOverlay,573,"psImageOverlay",0,false}, 38 {testImageKeepMask,574,"psImageKeep and Mask",0,false}, 37 39 {NULL} 38 40 }; … … 796 798 return 0; 797 799 } 800 801 psS32 testImageKeepMask(void) 802 { 803 //psImageMaskRegion 804 //psImageKeepRegion 805 //psImageMaskCircle 806 //psImageKeepCircle 807 psImage *in = psImageAlloc(3,3,PS_TYPE_MASK); 808 psRegion reg; 809 reg.x0 = 0; 810 reg.x1 = 1; 811 reg.y0 = 0; 812 reg.y1 = 1; 813 psMaskType mask = 2; 814 in->data.PS_TYPE_MASK_DATA[0][0] = 2; 815 in->data.PS_TYPE_MASK_DATA[0][1] = 0; 816 in->data.PS_TYPE_MASK_DATA[0][2] = 1; 817 in->data.PS_TYPE_MASK_DATA[1][0] = 4; 818 in->data.PS_TYPE_MASK_DATA[1][1] = 0; 819 in->data.PS_TYPE_MASK_DATA[1][2] = 3; 820 in->data.PS_TYPE_MASK_DATA[2][0] = 2; 821 in->data.PS_TYPE_MASK_DATA[2][1] = 1; 822 in->data.PS_TYPE_MASK_DATA[2][2] = 2; 823 824 printf("\n Mask Region------"); 825 psImageMaskRegion(in, reg, "|", mask); 826 for(int i = 0; i < 3; i++) { 827 for (int j = 0; j < 3; j++) { 828 printf("\nin->data.u8 [i][j] i=%d, j=%d = %u", i, j, in->data.PS_TYPE_MASK_DATA[i][j]); 829 } 830 } 831 832 in->data.PS_TYPE_MASK_DATA[0][0] = 2; 833 in->data.PS_TYPE_MASK_DATA[0][1] = 0; 834 in->data.PS_TYPE_MASK_DATA[0][2] = 1; 835 in->data.PS_TYPE_MASK_DATA[1][0] = 4; 836 in->data.PS_TYPE_MASK_DATA[1][1] = 0; 837 in->data.PS_TYPE_MASK_DATA[1][2] = 3; 838 in->data.PS_TYPE_MASK_DATA[2][0] = 2; 839 in->data.PS_TYPE_MASK_DATA[2][1] = 1; 840 in->data.PS_TYPE_MASK_DATA[2][2] = 2; 841 psImageKeepRegion(in, reg, "AND", mask); 842 printf("\n Keep Region------"); 843 for(int i = 0; i < 3; i++) { 844 for (int j = 0; j < 3; j++) { 845 printf("\nin->data.u8 [i][j] i=%d, j=%d = %u", i, j, in->data.PS_TYPE_MASK_DATA[i][j]); 846 } 847 } 848 849 //Mask Circle and Keep Circle Functions 850 in->data.PS_TYPE_MASK_DATA[0][0] = 2; 851 in->data.PS_TYPE_MASK_DATA[0][1] = 0; 852 in->data.PS_TYPE_MASK_DATA[0][2] = 1; 853 in->data.PS_TYPE_MASK_DATA[1][0] = 4; 854 in->data.PS_TYPE_MASK_DATA[1][1] = 0; 855 in->data.PS_TYPE_MASK_DATA[1][2] = 3; 856 in->data.PS_TYPE_MASK_DATA[2][0] = 2; 857 in->data.PS_TYPE_MASK_DATA[2][1] = 1; 858 in->data.PS_TYPE_MASK_DATA[2][2] = 2; 859 psImageMaskCircle(in, 1, 1, 1, "XOR", mask); 860 printf("\n Mask Circle------"); 861 for(int i = 0; i < 3; i++) { 862 for (int j = 0; j < 3; j++) { 863 printf("\nin->data.u8 [i][j] i=%d, j=%d = %u", i, j, in->data.PS_TYPE_MASK_DATA[i][j]); 864 } 865 } 866 867 in->data.PS_TYPE_MASK_DATA[0][0] = 2; 868 in->data.PS_TYPE_MASK_DATA[0][1] = 0; 869 in->data.PS_TYPE_MASK_DATA[0][2] = 1; 870 in->data.PS_TYPE_MASK_DATA[1][0] = 4; 871 in->data.PS_TYPE_MASK_DATA[1][1] = 0; 872 in->data.PS_TYPE_MASK_DATA[1][2] = 3; 873 in->data.PS_TYPE_MASK_DATA[2][0] = 2; 874 in->data.PS_TYPE_MASK_DATA[2][1] = 1; 875 in->data.PS_TYPE_MASK_DATA[2][2] = 2; 876 psImageKeepCircle(in, 1, 1, 1, "=", mask); 877 printf("\n Keep Circle------"); 878 for(int i = 0; i < 3; i++) { 879 for (int j = 0; j < 3; j++) { 880 printf("\nin->data.u8 [i][j] i=%d, j=%d = %u", i, j, in->data.PS_TYPE_MASK_DATA[i][j]); 881 } 882 } 883 fflush(stdout); 884 885 //Error Checks 886 //incorrect logical operation 887 printf("\n"); 888 psImageKeepRegion(in, reg, "+", mask); 889 //null image 890 psImage *none = NULL; 891 psImageMaskCircle(none, 1, 1, 1, "&", mask); 892 893 psFree(in); 894 return 0; 895 } 896
Note:
See TracChangeset
for help on using the changeset viewer.
