new ImageMagick() {{
option("-rotate", "90");
option("-resize", width + "x");
}}.run(in, out);
This still requires external variables, such as
width
, need to be declared final. So to wrap up, here's three different ways to invoke the DSL:Standard:
ImageMagick convert = new ImageMagick();
convert.option("-rotate", "90");
convert.option("-resize", width + "x");
convert.run(in, out);
Method Chaining:
new ImageMagick().option("-rotate", "90").option("-resize", width + "x").run(in, out);
Initializer Block:
new ImageMagick() {{
option("-rotate", "90");
option("-resize", width + "x");
}}.run(in, out);
1 comment:
Post a Comment