Last change
on this file since 2694 was
2694,
checked in by Sam Hocevar, 15 years ago
|
- context.c: implement various dithering commands and Gaussian blur.
- pipi.c: add "--blur" and "--dither" commandline options.
- blur.c dither.c: remove these examples, pipi.c works a lot better:
pipi src.png --blur 10 dest.png
pipi src.png --dither dbs dest.png
(and of course combinations are possible)
|
File size:
1.3 KB
|
Line | |
---|
1 | #include "config.h" |
---|
2 | #include "common.h" |
---|
3 | |
---|
4 | #include <stdio.h> |
---|
5 | #include <stdlib.h> |
---|
6 | #include <string.h> |
---|
7 | |
---|
8 | #include <pipi.h> |
---|
9 | |
---|
10 | int main(int argc, char *argv[]) |
---|
11 | { |
---|
12 | pipi_context_t *ctx; |
---|
13 | |
---|
14 | ctx = pipi_create_context(); |
---|
15 | |
---|
16 | while(*++argv) |
---|
17 | { |
---|
18 | if(!strcmp(argv[0], "--dup")) |
---|
19 | { |
---|
20 | if(pipi_command(ctx, "dup") != 0) |
---|
21 | return EXIT_FAILURE; |
---|
22 | } |
---|
23 | else if(!strcmp(argv[0], "--dither")) |
---|
24 | { |
---|
25 | if(argv[1] == NULL) |
---|
26 | return EXIT_FAILURE; |
---|
27 | if(pipi_command(ctx, "dither", argv[1]) != 0) |
---|
28 | return EXIT_FAILURE; |
---|
29 | argv++; |
---|
30 | } |
---|
31 | else if(!strcmp(argv[0], "--blur")) |
---|
32 | { |
---|
33 | if(argv[1] == NULL) |
---|
34 | return EXIT_FAILURE; |
---|
35 | if(pipi_command(ctx, "blur", argv[1]) != 0) |
---|
36 | return EXIT_FAILURE; |
---|
37 | argv++; |
---|
38 | } |
---|
39 | else if(!strcmp(argv[0], "--output") || !strcmp(argv[0], "-o")) |
---|
40 | { |
---|
41 | if(argv[1] == NULL) |
---|
42 | return EXIT_FAILURE; |
---|
43 | if(pipi_command(ctx, "save", argv[1]) != 0) |
---|
44 | return EXIT_FAILURE; |
---|
45 | argv++; |
---|
46 | } |
---|
47 | else |
---|
48 | { |
---|
49 | if(pipi_command(ctx, "load", argv[0]) != 0) |
---|
50 | return EXIT_FAILURE; |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | pipi_destroy_context(ctx); |
---|
55 | |
---|
56 | return EXIT_SUCCESS; |
---|
57 | } |
---|
58 | |
---|
Note: See
TracBrowser
for help on using the repository browser.