Changeset 11611

Show
Ignore:
Timestamp:
07/10/08 16:23:13 (7 weeks ago)
Author:
cristy
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ImageMagick/trunk/magick/fx.c

    r11602 r11611  
    10011001{ 
    10021002  char 
     1003    key[MaxTextExtent], 
    10031004    *q, 
    10041005    subexpression[MaxTextExtent], 
     1006    statistic[MaxTextExtent], 
    10051007    symbol[MaxTextExtent]; 
    10061008 
     
    10781080            p++; 
    10791081        } 
    1080       if (*p == 'p') 
     1082      if ((isalpha((int) *(p+1)) == 0) && (*p == 'p')) 
    10811083        { 
    10821084          p++; 
     
    12451247      break; 
    12461248    } 
     1249    case 'D': 
     1250    case 'd': 
     1251    { 
     1252      if (LocaleCompare(symbol,"depth") == 0) 
     1253        { 
     1254          unsigned long 
     1255            depth; 
     1256 
     1257          (void) FormatMagickString(key,MaxTextExtent,"%s.%p.%ld",symbol,image, 
     1258            (long) channel); 
     1259          value=(const char *) GetValueFromSplayTree(fx_info->symbols,key); 
     1260          if (value != (const char *) NULL) 
     1261            return(QuantumScale*atof(value)); 
     1262          (void) DeleteNodeFromSplayTree(fx_info->symbols,key); 
     1263          depth=GetImageChannelDepth(image,channel,exception); 
     1264          (void) FormatMagickString(statistic,MaxTextExtent,"%lu",depth); 
     1265          (void) AddValueToSplayTree(fx_info->symbols,ConstantString(key), 
     1266            ConstantString(statistic)); 
     1267          return(QuantumScale*atof(statistic)); 
     1268        } 
     1269      break; 
     1270    } 
    12471271    case 'G': 
    12481272    case 'g': 
     
    12951319          (LocaleCompare(symbol,"image.standard_deviation") == 0)) 
    12961320        { 
    1297           char 
    1298             key[MaxTextExtent], 
    1299             statistic[MaxTextExtent]; 
    1300  
     1321          /* 
     1322            Deprecated. 
     1323          */ 
    13011324          (void) FormatMagickString(key,MaxTextExtent,"%s.%p.%ld",symbol,image, 
    13021325            (long) channel); 
     
    13461369          return(QuantumScale*atof(statistic)); 
    13471370        } 
    1348       if (LocaleCompare(symbol,"image.page.height") == 0) 
    1349         return(image->page.height); 
    1350       if (LocaleCompare(symbol,"image.page.width") == 0) 
    1351         return(image->page.width); 
    1352       if (LocaleCompare(symbol,"image.page.x") == 0) 
    1353         return(image->page.x); 
    1354       if (LocaleCompare(symbol,"image.page.y") == 0) 
    1355         return(image->page.y); 
    13561371      if (LocaleCompare(symbol,"image.resolution.x") == 0) 
    13571372        return(image->x_resolution); 
     
    13981413    case 'm': 
    13991414    { 
     1415      if (LocaleCompare(symbol,"maxima") == 0) 
     1416        { 
     1417          double 
     1418            maxima, 
     1419            minima; 
     1420 
     1421          (void) FormatMagickString(key,MaxTextExtent,"%s.%p.%ld",symbol,image, 
     1422            (long) channel); 
     1423          value=(const char *) GetValueFromSplayTree(fx_info->symbols,key); 
     1424          if (value != (const char *) NULL) 
     1425            return(QuantumScale*atof(value)); 
     1426          (void) DeleteNodeFromSplayTree(fx_info->symbols,key); 
     1427          (void) GetImageChannelRange(image,channel,&minima,&maxima,exception); 
     1428          (void) FormatMagickString(statistic,MaxTextExtent,"%g",maxima); 
     1429          (void) AddValueToSplayTree(fx_info->symbols,ConstantString(key), 
     1430            ConstantString(statistic)); 
     1431          return(QuantumScale*atof(statistic)); 
     1432        } 
     1433      if (LocaleCompare(symbol,"mean") == 0) 
     1434        { 
     1435          double 
     1436            mean, 
     1437            standard_deviation; 
     1438 
     1439          (void) FormatMagickString(key,MaxTextExtent,"%s.%p.%ld",symbol,image, 
     1440            (long) channel); 
     1441          value=(const char *) GetValueFromSplayTree(fx_info->symbols,key); 
     1442          if (value != (const char *) NULL) 
     1443            return(QuantumScale*atof(value)); 
     1444          (void) DeleteNodeFromSplayTree(fx_info->symbols,key); 
     1445          (void) GetImageChannelMean(image,channel,&mean,&standard_deviation, 
     1446            exception); 
     1447          (void) FormatMagickString(statistic,MaxTextExtent,"%g",mean); 
     1448          (void) AddValueToSplayTree(fx_info->symbols,ConstantString(key), 
     1449            ConstantString(statistic)); 
     1450          return(QuantumScale*atof(statistic)); 
     1451        } 
     1452      if (LocaleCompare(symbol,"minima") == 0) 
     1453        { 
     1454          double 
     1455            maxima, 
     1456            minima; 
     1457 
     1458          (void) FormatMagickString(key,MaxTextExtent,"%s.%p.%ld",symbol,image, 
     1459            (long) channel); 
     1460          value=(const char *) GetValueFromSplayTree(fx_info->symbols,key); 
     1461          if (value != (const char *) NULL) 
     1462            return(QuantumScale*atof(value)); 
     1463          (void) DeleteNodeFromSplayTree(fx_info->symbols,key); 
     1464          (void) GetImageChannelRange(image,channel,&minima,&maxima,exception); 
     1465          (void) FormatMagickString(statistic,MaxTextExtent,"%g",minima); 
     1466          (void) AddValueToSplayTree(fx_info->symbols,ConstantString(key), 
     1467            ConstantString(statistic)); 
     1468          return(QuantumScale*atof(statistic)); 
     1469        } 
    14001470      if (LocaleCompare(symbol,"m") == 0) 
    14011471        return(QuantumScale*pixel.blue); 
     
    14161486      break; 
    14171487    } 
     1488    case 'P': 
     1489    case 'p': 
     1490    { 
     1491      if (LocaleCompare(symbol,"page.height") == 0) 
     1492        return((MagickRealType) image->page.height); 
     1493      if (LocaleCompare(symbol,"page.width") == 0) 
     1494        return((MagickRealType) image->page.width); 
     1495      if (LocaleCompare(symbol,"page.x") == 0) 
     1496        return((MagickRealType) image->page.x); 
     1497      if (LocaleCompare(symbol,"page.y") == 0) 
     1498        return((MagickRealType) image->page.y); 
     1499      break; 
     1500    } 
    14181501    case 'R': 
    14191502    case 'r': 
    14201503    { 
     1504      if (LocaleCompare(symbol,"resolution.x") == 0) 
     1505        return(image->x_resolution); 
     1506      if (LocaleCompare(symbol,"resolution.y") == 0) 
     1507        return(image->y_resolution); 
    14211508      if (LocaleCompare(symbol,"r") == 0) 
    14221509        return(QuantumScale*pixel.red); 
     
    14361523            RoundToQuantum(pixel.blue),&hue,&saturation,&lightness); 
    14371524          return(saturation); 
     1525        } 
     1526      if (LocaleCompare(symbol,"standard_deviation") == 0) 
     1527        { 
     1528          double 
     1529            mean, 
     1530            standard_deviation; 
     1531 
     1532          (void) FormatMagickString(key,MaxTextExtent,"%s.%p.%ld",symbol,image, 
     1533            (long) channel); 
     1534          value=(const char *) GetValueFromSplayTree(fx_info->symbols,key); 
     1535          if (value != (const char *) NULL) 
     1536            return(QuantumScale*atof(value)); 
     1537          (void) DeleteNodeFromSplayTree(fx_info->symbols,key); 
     1538          (void) GetImageChannelMean(image,channel,&mean,&standard_deviation, 
     1539            exception); 
     1540          (void) FormatMagickString(statistic,MaxTextExtent,"%g", 
     1541            standard_deviation); 
     1542          (void) AddValueToSplayTree(fx_info->symbols,ConstantString(key), 
     1543            ConstantString(statistic)); 
     1544          return(QuantumScale*atof(statistic)); 
    14381545        } 
    14391546      break;