summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/canvas.h15
-rw-r--r--libdimension/dimension/gl.h16
-rw-r--r--libdimension/dimension/png.h28
3 files changed, 26 insertions, 33 deletions
diff --git a/libdimension/dimension/canvas.h b/libdimension/dimension/canvas.h
index ba549ad..d03a37e 100644
--- a/libdimension/dimension/canvas.h
+++ b/libdimension/dimension/canvas.h
@@ -1,5 +1,5 @@
/*************************************************************************
- * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> *
+ * Copyright (C) 2009-2014 Tavian Barnes <tavianator@tavianator.com> *
* *
* This file is part of The Dimension Library. *
* *
@@ -39,8 +39,6 @@ typedef struct dmnsn_canvas {
* at (a,b) is accessible as pixels[b*width + a].
*/
dmnsn_tcolor *pixels;
-
- DMNSN_REFCOUNT; /**< Reference count. */
} dmnsn_canvas;
/**
@@ -63,17 +61,12 @@ typedef struct dmnsn_canvas_optimizer {
/**
* Allocate a new canvas.
- * @param[in] width The width of the canvas to allocate (in pixels).
+ * @param[in] pool The memory pool to allocate from.
+ * @param[in] width The width of the canvas to allocate (in pixels).
* @param[in] height The height of the canvas to allocate (in pixels).
* @return The allocated canvas.
*/
-dmnsn_canvas *dmnsn_new_canvas(size_t width, size_t height);
-
-/**
- * Delete a canvas.
- * @param[in,out] canvas The canvas to delete.
- */
-void dmnsn_delete_canvas(dmnsn_canvas *canvas);
+dmnsn_canvas *dmnsn_new_canvas(dmnsn_pool *pool, size_t width, size_t height);
/**
* Set a canvas optimizer
diff --git a/libdimension/dimension/gl.h b/libdimension/dimension/gl.h
index e276228..8e64ba6 100644
--- a/libdimension/dimension/gl.h
+++ b/libdimension/dimension/gl.h
@@ -1,5 +1,5 @@
/*************************************************************************
- * Copyright (C) 2009-2010 Tavian Barnes <tavianator@tavianator.com> *
+ * Copyright (C) 2009-2014 Tavian Barnes <tavianator@tavianator.com> *
* *
* This file is part of The Dimension Library. *
* *
@@ -32,18 +32,16 @@ int dmnsn_gl_optimize_canvas(dmnsn_canvas *canvas);
/**
* Write canvas to GL framebuffer.
- * @param[in] canvas The canvas to write.
+ * @param[in] canvas The canvas to draw.
* @return 0 on success, non-zero on failure.
*/
int dmnsn_gl_write_canvas(const dmnsn_canvas *canvas);
/**
* Read a canvas from a GL framebuffer.
- * @param[in] x0 The \a x screen coordinate to start copying from.
- * @param[in] y0 The \a y screen coordinate to start copying from.
- * @param[in] width The width of the read area.
- * @param[in] height The height of the read area.
- * @return The allocated canvas, or NULL on failure.
+ * @param[in] canvas The canvas to write to.
+ * @param[in] x0 The \a x screen coordinate to start copying from.
+ * @param[in] y0 The \a y screen coordinate to start copying from.
+ * @return 0 on success, non-zero on failure.
*/
-dmnsn_canvas *dmnsn_gl_read_canvas(size_t x0, size_t y0,
- size_t width, size_t height);
+int dmnsn_gl_read_canvas(dmnsn_canvas *canvas, size_t x0, size_t y0);
diff --git a/libdimension/dimension/png.h b/libdimension/dimension/png.h
index 244c481..c45a9bf 100644
--- a/libdimension/dimension/png.h
+++ b/libdimension/dimension/png.h
@@ -1,5 +1,5 @@
/*************************************************************************
- * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> *
+ * Copyright (C) 2009-2014 Tavian Barnes <tavianator@tavianator.com> *
* *
* This file is part of The Dimension Library. *
* *
@@ -20,7 +20,7 @@
/**
* @file
- * PNG import/export of canvases
+ * PNG import/export of canvases.
*/
#include <stdio.h>
@@ -34,16 +34,16 @@ int dmnsn_png_optimize_canvas(dmnsn_canvas *canvas);
/**
* Write a canvas to a file in PNG format.
- * @param[in] canvas The canvas to write.
- * @param[in,out] file The file to write to.
+ * @param[in] canvas The canvas to write.
+ * @param[in,out] file The file to write to.
* @return 0 on success, non-zero on failure.
*/
int dmnsn_png_write_canvas(const dmnsn_canvas *canvas, FILE *file);
/**
* Write a canvas to a PNG file in the background.
- * @param[in] canvas The canvas to write.
- * @param[in,out] file The file to write to.
+ * @param[in] canvas The canvas to write.
+ * @param[in,out] file The file to write to.
* @return A \ref dmnsn_future object, or NULL on failure.
*/
dmnsn_future *dmnsn_png_write_canvas_async(const dmnsn_canvas *canvas,
@@ -51,18 +51,20 @@ dmnsn_future *dmnsn_png_write_canvas_async(const dmnsn_canvas *canvas,
/**
* Read a canvas from a PNG file.
+ * @param[in] pool The memory pool to allocate from.
* @param[in,out] file The PNG file to read.
* @return The new canvas, or NULL on failure.
*/
-dmnsn_canvas *dmnsn_png_read_canvas(FILE *file);
+dmnsn_canvas *dmnsn_png_read_canvas(dmnsn_pool *pool, FILE *file);
/**
* Read a canvas from a PNG file in the background.
- * @param[out] canvas The address of a non-allocated canvas object. The
- * canvas object will be allocated and filled with the
- * contents of \p file. Do not read from this object
- * until the background task has finished.
- * @param[in,out] file The PNG file to read.
+ * @param[out] canvas The address of a non-allocated canvas object. The canvas
+ * object will be allocated and filled with the contents of
+ * \p file. Do not read from this object until the
+ * background task has finished.
+ * @param[in] pool The memory pool to allocate from.
+ * @param[in,out] file The PNG file to read.
* @return A \ref dmnsn_future object, or NULL on failure.
*/
-dmnsn_future *dmnsn_png_read_canvas_async(dmnsn_canvas **canvas, FILE *file);
+dmnsn_future *dmnsn_png_read_canvas_async(dmnsn_canvas **canvas, dmnsn_pool *pool, FILE *file);