@@ -1416,15 +1416,12 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info,
1416
1416
}
1417
1417
if (LocaleCompare ("type" ,option ) == 0 )
1418
1418
{
1419
- if (* argv [0 ] == '+' )
1420
- {
1421
- image_info -> type = UndefinedType ;
1422
- (void ) SetImageOption (image_info ,option ,"undefined" );
1423
- break ;
1424
- }
1425
- image_info -> type = (ImageType ) ParseCommandOption (MagickTypeOptions ,
1426
- MagickFalse ,argv [1 ]);
1427
- (void ) SetImageOption (image_info ,option ,argv [1 ]);
1419
+ (void ) SetImageOption (image_info ,option ,
1420
+ IfSetOption ? argv [1 ] : (char ) NULL );
1421
+ image_info -> type = UndefinedType ;
1422
+ if (IfSetOption )
1423
+ image_info -> type = (ImageType ) ParseCommandOption (MagickTypeOptions ,
1424
+ MagickFalse ,argv [1 ]);
1428
1425
break ;
1429
1426
}
1430
1427
break ;
@@ -1433,25 +1430,23 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info,
1433
1430
{
1434
1431
if (LocaleCompare ("undercolor" ,option ) == 0 )
1435
1432
{
1436
- if (* argv [0 ] == '+' )
1437
- {
1438
- (void ) DeleteImageOption (image_info ,option );
1439
- break ;
1440
- }
1441
- (void ) SetImageOption (image_info ,option ,argv [1 ]);
1433
+ (void ) SetImageOption (image_info ,option ,
1434
+ IfSetOption ? argv [1 ] : (char ) NULL );
1435
+ (void ) QueryColorCompliance (argv [1 ],AllCompliance ,
1436
+ draw_info -> undercolor ,exception );
1442
1437
break ;
1443
1438
}
1444
1439
if (LocaleCompare ("units" ,option ) == 0 )
1445
1440
{
1446
- if ( * argv [ 0 ] == '+' )
1447
- {
1448
- image_info -> units = UndefinedResolution ;
1449
- (void ) SetImageOption (image_info ,option ,"undefined" );
1450
- break ;
1451
- }
1452
- image_info -> units = ( ResolutionType ) ParseCommandOption (
1453
- MagickResolutionOptions , MagickFalse , argv [ 1 ]);
1454
- ( void ) SetImageOption ( image_info , option ,argv [1 ]);
1441
+ /* Set in images via SyncImageSettings() */
1442
+ /* Should this effect draw_info X and Y resolution? */
1443
+ /* FUTURE: this probably should be part of the density setting */
1444
+ (void ) SetImageOption (image_info ,option ,
1445
+ IfSetOption ? argv [ 1 ] : ( char ) NULL ) ;
1446
+ image_info -> units = UndefinedResolution ;
1447
+ if ( IfSetOption )
1448
+ image_info -> units = ( ResolutionType ) ParseCommandOption (
1449
+ MagickResolutionOptions , MagickFalse ,argv [1 ]);
1455
1450
break ;
1456
1451
}
1457
1452
break ;
@@ -1460,43 +1455,57 @@ WandExport MagickBooleanType ApplySettingsOption(ImageInfo *image_info,
1460
1455
{
1461
1456
if (LocaleCompare ("verbose" ,option ) == 0 )
1462
1457
{
1463
- if (* argv [0 ] == '+' )
1464
- {
1465
- image_info -> verbose = MagickFalse ;
1466
- break ;
1467
- }
1468
- image_info -> verbose = MagickTrue ;
1469
- image_info -> ping = MagickFalse ;
1458
+ /* FUTURE: Also an image artifact, set in Simple Operators.
1459
+ But artifact is only used in verbose output.
1460
+ */
1461
+ image_info -> verbose = IfSetOption ? MagickTrue : MagickFalse ;
1462
+ image_info -> ping = MagickFalse ; /* verbose can't be a ping */
1470
1463
break ;
1471
1464
}
1472
1465
if (LocaleCompare ("view" ,option ) == 0 )
1473
1466
{
1474
- if (* argv [0 ] == '+' )
1475
- {
1476
- if (image_info -> view != (char * ) NULL )
1477
- image_info -> view = DestroyString (image_info -> view );
1478
- break ;
1479
- }
1480
- (void ) CloneString (& image_info -> view ,argv [1 ]);
1467
+ /* FUTURE: Convert from image_info to Option
1468
+ Only used by coder FPX
1469
+ */
1470
+ (void ) CloneString (& image_info -> view ,
1471
+ IfSetOption ? argv [1 ] : (char ) NULL );
1481
1472
break ;
1482
1473
}
1483
1474
if (LocaleCompare ("virtual-pixel" ,option ) == 0 )
1484
1475
{
1485
- if (* argv [0 ] == '+' )
1486
- {
1487
- image_info -> virtual_pixel_method = UndefinedVirtualPixelMethod ;
1488
- (void ) SetImageOption (image_info ,option ,"undefined" );
1489
- break ;
1490
- }
1476
+ /* Also used as a 'image' option deep in image structure */
1477
+ const char
1478
+ * value = IfSetOption ? argv [1 ] : "undefined" ;
1479
+
1480
+ (void ) SetImageOption (image_info ,option ,value );
1491
1481
image_info -> virtual_pixel_method = (VirtualPixelMethod )
1492
- ParseCommandOption (MagickVirtualPixelOptions ,MagickFalse ,argv [1 ]);
1493
- (void ) SetImageOption (image_info ,option ,argv [1 ]);
1482
+ ParseCommandOption (MagickVirtualPixelOptions ,MagickFalse ,value );
1494
1483
break ;
1495
1484
}
1496
1485
break ;
1497
1486
}
1498
1487
case 'w' :
1499
1488
{
1489
+ if (LocaleCompare ("weight" ,argv [0 ]+ 1 ) == 0 )
1490
+ {
1491
+ /* FUTURE: relative weights not sensical due to first assignment!
1492
+ Also just what is actually using font 'weight' ???
1493
+ */
1494
+ draw_info -> weight = StringToUnsignedLong (argv [1 ]);
1495
+ if (LocaleCompare (argv [1 ],"all" ) == 0 )
1496
+ draw_info -> weight = 0 ;
1497
+ if (LocaleCompare (argv [1 ],"bold" ) == 0 )
1498
+ draw_info -> weight = 700 ;
1499
+ if (LocaleCompare (argv [1 ],"bolder" ) == 0 )
1500
+ if (draw_info -> weight <= 800 )
1501
+ draw_info -> weight += 100 ;
1502
+ if (LocaleCompare (argv [1 ],"lighter" ) == 0 )
1503
+ if (draw_info -> weight >= 100 )
1504
+ draw_info -> weight -= 100 ;
1505
+ if (LocaleCompare (argv [1 ],"normal" ) == 0 )
1506
+ draw_info -> weight = 400 ;
1507
+ break ;
1508
+ }
1500
1509
if (LocaleCompare ("white-point" ,option ) == 0 )
1501
1510
{
1502
1511
if (* argv [0 ] == '+' )
@@ -3527,29 +3536,15 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
3527
3536
}
3528
3537
if (LocaleCompare ("type" ,argv [0 ]+ 1 ) == 0 )
3529
3538
{
3530
- ImageType
3531
- type ;
3532
-
3539
+ /* Note that "type" setting should have already been defined */
3533
3540
(void ) SyncImageSettings (image_info ,* image ,exception );
3534
- if (* argv [0 ] == '+' )
3535
- type = UndefinedType ;
3536
- else
3537
- type = (ImageType ) ParseCommandOption (MagickTypeOptions ,MagickFalse ,
3538
- argv [1 ]);
3539
- (* image )-> type = UndefinedType ;
3540
3541
(void ) SetImageType (* image ,type ,exception );
3541
3542
break ;
3542
3543
}
3543
3544
break ;
3544
3545
}
3545
3546
case 'u' :
3546
3547
{
3547
- if (LocaleCompare ("undercolor" ,argv [0 ]+ 1 ) == 0 )
3548
- {
3549
- (void ) QueryColorCompliance (argv [1 ],AllCompliance ,& draw_info -> undercolor ,
3550
- exception );
3551
- break ;
3552
- }
3553
3548
if (LocaleCompare ("unique" ,argv [0 ]+ 1 ) == 0 )
3554
3549
{
3555
3550
if (* argv [0 ] == '+' )
@@ -3563,18 +3558,12 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
3563
3558
}
3564
3559
if (LocaleCompare ("unique-colors" ,argv [0 ]+ 1 ) == 0 )
3565
3560
{
3566
- /*
3567
- Unique image colors.
3568
- */
3569
3561
(void ) SyncImageSettings (image_info ,* image ,exception );
3570
3562
new_image = UniqueImageColors (* image ,exception );
3571
3563
break ;
3572
3564
}
3573
3565
if (LocaleCompare ("unsharp" ,argv [0 ]+ 1 ) == 0 )
3574
3566
{
3575
- /*
3576
- Unsharp mask image.
3577
- */
3578
3567
(void ) SyncImageSettings (image_info ,* image ,exception );
3579
3568
flags = ParseGeometry (argv [1 ],& geometry_info );
3580
3569
if ((flags & SigmaValue ) == 0 )
@@ -3594,7 +3583,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
3594
3583
if (LocaleCompare ("verbose" ,argv [0 ]+ 1 ) == 0 )
3595
3584
{
3596
3585
(void ) SetImageArtifact (* image ,argv [0 ]+ 1 ,
3597
- * argv [0 ] == '+' ? "false" : "true" );
3586
+ * argv [0 ] == '+' ? "false" : "true" );
3598
3587
break ;
3599
3588
}
3600
3589
if (LocaleCompare ("vignette" ,argv [0 ]+ 1 ) == 0 )
@@ -3617,15 +3606,8 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
3617
3606
}
3618
3607
if (LocaleCompare ("virtual-pixel" ,argv [0 ]+ 1 ) == 0 )
3619
3608
{
3620
- if (* argv [0 ] == '+' )
3621
- {
3622
- (void ) SetImageVirtualPixelMethod (* image ,
3623
- UndefinedVirtualPixelMethod );
3624
- break ;
3625
- }
3626
- (void ) SetImageVirtualPixelMethod (* image ,(VirtualPixelMethod )
3627
- ParseCommandOption (MagickVirtualPixelOptions ,MagickFalse ,
3628
- argv [1 ]));
3609
+ /* setting already defined in image_info structure */
3610
+ SetImageVirtualPixelMethod (* image , image_info -> virtual_pixel_method );
3629
3611
break ;
3630
3612
}
3631
3613
break ;
@@ -3634,9 +3616,6 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
3634
3616
{
3635
3617
if (LocaleCompare ("wave" ,argv [0 ]+ 1 ) == 0 )
3636
3618
{
3637
- /*
3638
- Wave image.
3639
- */
3640
3619
(void ) SyncImageSettings (image_info ,* image ,exception );
3641
3620
flags = ParseGeometry (argv [1 ],& geometry_info );
3642
3621
if ((flags & SigmaValue ) == 0 )
@@ -3645,28 +3624,8 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand,
3645
3624
geometry_info .sigma ,interpolate_method ,exception );
3646
3625
break ;
3647
3626
}
3648
- if (LocaleCompare ("weight" ,argv [0 ]+ 1 ) == 0 )
3649
- {
3650
- draw_info -> weight = StringToUnsignedLong (argv [1 ]);
3651
- if (LocaleCompare (argv [1 ],"all" ) == 0 )
3652
- draw_info -> weight = 0 ;
3653
- if (LocaleCompare (argv [1 ],"bold" ) == 0 )
3654
- draw_info -> weight = 700 ;
3655
- if (LocaleCompare (argv [1 ],"bolder" ) == 0 )
3656
- if (draw_info -> weight <= 800 )
3657
- draw_info -> weight += 100 ;
3658
- if (LocaleCompare (argv [1 ],"lighter" ) == 0 )
3659
- if (draw_info -> weight >= 100 )
3660
- draw_info -> weight -= 100 ;
3661
- if (LocaleCompare (argv [1 ],"normal" ) == 0 )
3662
- draw_info -> weight = 400 ;
3663
- break ;
3664
- }
3665
3627
if (LocaleCompare ("white-threshold" ,argv [0 ]+ 1 ) == 0 )
3666
3628
{
3667
- /*
3668
- White threshold image.
3669
- */
3670
3629
(void ) SyncImageSettings (image_info ,* image ,exception );
3671
3630
(void ) WhiteThresholdImage (* image ,argv [1 ],exception );
3672
3631
break ;
0 commit comments