3
* Copyright (C) 2013 The ManaPlus Developers
5
* This file is part of The ManaPlus Client.
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
#include "graphicsmanager.h"
24
#include "sdlshared.h"
26
#include "resources/image.h"
27
#include "resources/imagehelper.h"
28
#include "resources/imagewriter.h"
29
#include "resources/resourcemanager.h"
30
#include "resources/sdlimagehelper.h"
33
#include "resources/surfaceimagehelper.h"
36
#include "utils/gettext.h"
37
#include "utils/physfstools.h"
45
int serverVersion = 0;
47
static void printHelp()
49
std::cout << _("dyecmd srcfile dyestring dstfile") << std::endl;
50
std::cout << _("or") << std::endl;
51
std::cout << _("dyecmd srcdyestring dstfile") << std::endl;
54
int main(int argc, char **argv)
56
if (argc < 3 || argc > 4)
63
logger->setLogToStandardOut(false);
65
PhysFs::init(argv[0]);
66
SDL_Init(SDL_INIT_VIDEO);
68
graphicsManager.createWindow(10, 10, 0, SDL_ANYFORMAT);
71
imageHelper = new SurfaceImageHelper;
73
imageHelper = new SDLImageHelper;
76
ResourceManager *resman = new ResourceManager;
77
resman->setWriteDir(".");
78
resman->addToSearchPath(".", false);
79
resman->addToSearchPath("/", false);
80
std::string src = argv[1];
84
src.append("|").append(argv[2]);
92
Image *image = resman->getImage(src);
95
printf("Error loading image\n");
98
ImageWriter::writePNG(image->getSDLSurface(), dst);