aboutsummaryrefslogtreecommitdiffstats
path: root/src/kern.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/kern.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/kern.h')
-rw-r--r--src/kern.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/kern.h b/src/kern.h
index 45f692a..8c2adf0 100644
--- a/src/kern.h
+++ b/src/kern.h
@@ -16,6 +16,15 @@
* 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
+
/**
@@ -65,6 +74,24 @@ int measure (int fbno, char *restrict fbpath, long *restrict width, long *restri
* pixel is encoded.
* @return Zero on success, -1 on error.
*/
-int convert_fb (FILE *restrict file, const char *restrict buf,
- size_t n, size_t *restrict adjustment);
+int convert_fb_to_pnm (FILE *restrict file, const char *restrict buf,
+ size_t n, size_t *restrict adjustment);
+
+/**
+ * Convert read data from a framebuffer to PNG pixel data.
+ *
+ * @param file The output image file.
+ * @param buf Buffer with read data.
+ * @param n The number of read characters.
+ * @param width3 The width of the image multipled by 3.
+ * @param adjustment Set to zero if all bytes were converted
+ * (a whole number of pixels where available,)
+ * otherwise, set to the number of bytes a
+ * pixel is encoded.
+ * @param state Use this to keep track of where in the you
+ * stopped. It will be 0 on the first call.
+ * @return Zero on success, -1 on error.
+ */
+int convert_fb_to_png (png_struct *pngbuf, png_byte *restrict pixbuf, const char *restrict buf,
+ size_t n, long width3, size_t *restrict adjustment, long *restrict state);