Update Serbian translation from master branch
[wmaker-crm.git] / wrlib / save.c
blobeee8ce54f6a1e1bf4d6eb8ef3fb5fcc7b0325d45
1 /* save.c - save image to file
3 * Raster graphics library
5 * Copyright (c) 1998-2003 Alfredo K. Kojima
6 * Copyright (c) 2013-2023 Window Maker Team
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
21 * MA 02110-1301, USA.
24 #include <config.h>
26 #include <X11/Xlib.h>
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <unistd.h>
30 #include <fcntl.h>
31 #include <sys/stat.h>
32 #include <string.h>
34 #include "wraster.h"
35 #include "imgformat.h"
36 #include "wr_i18n.h"
38 Bool RSaveImage(RImage *image, const char *filename, const char *format)
40 return RSaveTitledImage(image, filename, format, NULL);
43 Bool RSaveTitledImage(RImage *image, const char *filename, const char *format, char *title)
45 #ifdef USE_PNG
46 if (strcasecmp(format, "PNG") == 0)
47 return RSavePNG(image, filename, title);
48 #endif
49 #ifdef USE_JPEG
50 if (strcasecmp(format, "JPG") == 0)
51 return RSaveJPEG(image, filename, title);
53 if (strcasecmp(format, "JPEG") == 0)
54 return RSaveJPEG(image, filename, title);
55 #endif
56 if (strcasecmp(format, "XPM") == 0)
57 return RSaveXPM(image, filename);
59 RErrorCode = RERR_BADFORMAT;
60 return False;