anthony | 25247ae | 2013-03-18 05:05:40 +0000 | [diff] [blame] | 1 | /* |
| 2 | Make direct calls to process the various CLI option handling groups |
| 3 | as defined in "MagickWand/operators.c" which uses a special |
| 4 | MagickCLI type of 'wand'. |
| 5 | |
| 6 | This is essentually the calls 'ProcessCommandOptions()' make |
| 7 | though without as many error and sanity checks. |
| 8 | |
| 9 | Compile with ImageMagick-devlop installed... |
| 10 | |
| 11 | gcc -lMagickWand -lMagickCore cli_operators.c -o cli_operators |
| 12 | |
Anthony Thyssen | 5b7198d | 2016-12-20 11:05:09 +1000 | [diff] [blame] | 13 | Compile and run directly from Source Directory... |
anthony | 25247ae | 2013-03-18 05:05:40 +0000 | [diff] [blame] | 14 | |
| 15 | IM_PROG=api_examples/cli_operators |
| 16 | gcc -I`pwd` -LMagickWand/.libs -LMagickCore/.libs \ |
| 17 | -lMagickWand -lMagickCore $IM_PROG.c -o $IM_PROG |
| 18 | |
Anthony Thyssen | 5b7198d | 2016-12-20 11:05:09 +1000 | [diff] [blame] | 19 | sh ./magick.sh $IM_PROG |
anthony | 25247ae | 2013-03-18 05:05:40 +0000 | [diff] [blame] | 20 | |
| 21 | |
| 22 | */ |
| 23 | #include <stdio.h> |
| 24 | #include "MagickCore/studio.h" |
| 25 | #include "MagickWand/MagickWand.h" |
| 26 | #include "MagickWand/operation.h" |
| 27 | |
| 28 | int main(int argc, char **argv) |
| 29 | { |
| 30 | MagickCLI |
| 31 | *cli_wand; |
| 32 | |
| 33 | MagickCoreGenesis(argv[0],MagickFalse); |
| 34 | |
cristy | f432c63 | 2014-12-07 15:11:28 +0000 | [diff] [blame] | 35 | cli_wand = AcquireMagickCLI((ImageInfo *) NULL,(ExceptionInfo *) NULL); |
anthony | 25247ae | 2013-03-18 05:05:40 +0000 | [diff] [blame] | 36 | |
| 37 | CLISettingOptionInfo (cli_wand, "-size", "100x100"); |
| 38 | CLISpecialOperator (cli_wand, "-read", "xc:red"); |
| 39 | CLISpecialOperator (cli_wand, "(", NULL); |
| 40 | CLISpecialOperator (cli_wand, "-read", "rose:"); |
| 41 | CLISimpleOperatorImages (cli_wand, "-rotate", "-90", NULL); |
| 42 | CLISpecialOperator (cli_wand, ")", NULL); |
| 43 | CLIListOperatorImages (cli_wand, "+append", NULL, NULL); |
| 44 | CLIListOperatorImages (cli_wand, "-write", "show:", NULL); |
| 45 | |
| 46 | /* Note use of 'True' to report all exceptions - including fatals */ |
| 47 | if ( CLICatchException(cli_wand,MagickTrue) != MagickFalse ) |
| 48 | fprintf(stderr, "Major Error Detected\n"); |
| 49 | |
| 50 | cli_wand = DestroyMagickCLI(cli_wand); |
| 51 | |
| 52 | MagickCoreTerminus(); |
| 53 | } |