mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-19 17:23:33 +01:00
WRaster: add function to save image in memory
This patch adds the RSaveRawImage() function to the WRaster lib to be able to save image structure in memory. The WRaster lib version is bumped.
This commit is contained in:
committed by
Carlos R. Mafra
parent
72942267aa
commit
7cfdf6bd68
21
wrlib/save.c
21
wrlib/save.c
@@ -3,7 +3,7 @@
|
||||
* Raster graphics library
|
||||
*
|
||||
* Copyright (c) 1998-2003 Alfredo K. Kojima
|
||||
* Copyright (c) 2013-2023 Window Maker Team
|
||||
* Copyright (c) 2013-2025 Window Maker Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@@ -40,6 +40,25 @@ Bool RSaveImage(RImage *image, const char *filename, const char *format)
|
||||
return RSaveTitledImage(image, filename, format, NULL);
|
||||
}
|
||||
|
||||
Bool RSaveRawImage(RImage *image, const char *format, unsigned char **out_buf, size_t *out_size)
|
||||
{
|
||||
#ifdef USE_PNG
|
||||
if (strcasecmp(format, "PNG") == 0)
|
||||
return RSaveRawPNG(image, NULL, out_buf, out_size);
|
||||
#endif
|
||||
|
||||
#ifdef USE_JPEG
|
||||
if (strcasecmp(format, "JPG") == 0)
|
||||
return RSaveRawJPEG(image, NULL, out_buf, out_size);
|
||||
|
||||
if (strcasecmp(format, "JPEG") == 0)
|
||||
return RSaveRawJPEG(image, NULL, out_buf, out_size);
|
||||
#endif
|
||||
|
||||
RErrorCode = RERR_BADFORMAT;
|
||||
return False;
|
||||
}
|
||||
|
||||
Bool RSaveTitledImage(RImage *image, const char *filename, const char *format, char *title)
|
||||
{
|
||||
#ifdef USE_PNG
|
||||
|
||||
Reference in New Issue
Block a user