aboutsummaryrefslogtreecommitdiffstats
path: root/src/png.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-11 13:47:18 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-11 13:47:18 +0100
commit1f1184d7a63f94f809fd3a9e807f9f36a3e39dd7 (patch)
tree89b4d0bcfa9e7cdb76f3c8bac3662f8dadf770b9 /src/png.h
parentm doc (diff)
downloadscrotty-1f1184d7a63f94f809fd3a9e807f9f36a3e39dd7.tar.gz
scrotty-1f1184d7a63f94f809fd3a9e807f9f36a3e39dd7.tar.bz2
scrotty-1f1184d7a63f94f809fd3a9e807f9f36a3e39dd7.tar.xz
png conversion is no longer done in a separate process.
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/png.h')
-rw-r--r--src/png.h46
1 files changed, 41 insertions, 5 deletions
diff --git a/src/png.h b/src/png.h
index 02a6223..b621234 100644
--- a/src/png.h
+++ b/src/png.h
@@ -16,14 +16,50 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wpadded"
+#endif
+#include <png.h>
+#ifdef __GNUC__
+# pragma GCC diagnostic pop
+#endif
+
+
+
+/**
+ * Store a pixel to a PNG row buffer.
+ *
+ * @param PIXBUF:png_byte * The pixel buffer for the row.
+ * @param X3:long The column of the pixel multipled by 3.
+ * @param R:int The [0, 255]-value on the red subpixel.
+ * @param G:int The [0, 255]-value on the green subpixel.
+ * @param B:int The [0, 255]-value on the blue subpixel.
+ */
+#define SAVE_PNG_PIXEL(PIXBUF, X3, R, G, B) \
+ ((PIXBUF)[(X3) + 0] = (png_byte)(R), \
+ (PIXBUF)[(X3) + 1] = (png_byte)(G), \
+ (PIXBUF)[(X3) + 2] = (png_byte)(B))
+
+/**
+ * Store a row to a PNG image.
+ *
+ * @param PNGBUF:png_struct * The PNG image structure.
+ * @param PIXBUF:png_byte * The pixel buffer for the row.
+ */
+#define SAVE_PNG_ROW(PNGBUF, PIXBUF) \
+ png_write_row (PNGBUF, PIXBUF)
/**
- * Convert an image from PNM to PNG.
+ * Create an PNG file.
*
- * @param fdin The file descriptor for the image to convert (PNM).
- * @param fdout The file descriptor for the output image (PNG).
- * @return Zero on success, -1 on error.
+ * @param fbfd The file descriptor connected to framebuffer device.
+ * @param width The width of the image.
+ * @param height The height of the image.
+ * @param imgfd The file descriptor connected to conversion process's stdin.
+ * @return Zero on success, -1 on error.
*/
-int convert (int fdin, int fdout);
+int
+save_png (int fbfd, long width, long height, int imgfd);