Gridarta Editor
SinglePngCommand.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.commands;
21 
22 import java.io.File;
23 import java.io.IOException;
25 import org.jetbrains.annotations.NotNull;
26 
32 @SuppressWarnings("UseOfSystemOutOrSystemErr")
33 public class SinglePngCommand implements Command {
34 
38  @NotNull
39  private final File in;
40 
44  @NotNull
45  private final File out;
46 
50  @NotNull
52 
59  public SinglePngCommand(@NotNull final File in, @NotNull final File out, @NotNull final ImageCreator<?, ?, ?> imageCreator) {
60  this.in = in;
61  this.out = out;
62  this.imageCreator = imageCreator;
63  }
64 
65  @Override
66  public int execute() {
67  try {
68  imageCreator.makeImage(in, out);
69  } catch (final IOException ex) {
70  System.err.println(out + ": " + ex.getMessage());
71  }
72  return 0;
73  }
74 
75 }
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.commands.SinglePngCommand.execute
int execute()
Executes the command.
Definition: SinglePngCommand.java:66
net.sf
net.sf.gridarta.gui.map.renderer
Definition: AbstractIsoMapRenderer.java:20
net.sf.gridarta.commands.SinglePngCommand.out
final File out
The output file.
Definition: SinglePngCommand.java:45
net.sf.gridarta.gui
Graphical User Interface of Gridarta.
net
net.sf.gridarta.commands.SinglePngCommand.SinglePngCommand
SinglePngCommand(@NotNull final File in, @NotNull final File out, @NotNull final ImageCreator<?, ?, ?> imageCreator)
Creates a new instance.
Definition: SinglePngCommand.java:59
net.sf.gridarta.gui.map.renderer.ImageCreator.makeImage
void makeImage(@NotNull final File in, @NotNull final File out)
Definition: ImageCreator.java:90
net.sf.gridarta.gui.map.renderer.ImageCreator
Creates images from map instances.
Definition: ImageCreator.java:41
net.sf.gridarta.commands.SinglePngCommand
Run in single png mode.
Definition: SinglePngCommand.java:33
net.sf.gridarta.gui.map
Base classes for rendering maps.
Definition: AbstractPerMapDialogManager.java:20
net.sf.gridarta.commands.SinglePngCommand.imageCreator
final ImageCreator<?, ?, ?> imageCreator
The ImageCreator to use.
Definition: SinglePngCommand.java:51
net.sf.gridarta.commands.SinglePngCommand.in
final File in
The input file.
Definition: SinglePngCommand.java:39
net.sf.gridarta.commands.Command
Interface for command-line commands.
Definition: Command.java:26