aboutsummaryrefslogtreecommitdiff
path: root/layer.c
diff options
context:
space:
mode:
Diffstat (limited to 'layer.c')
-rw-r--r--layer.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/layer.c b/layer.c
index 5673183..d238b99 100644
--- a/layer.c
+++ b/layer.c
@@ -2,4 +2,30 @@
#include <libc.h>
#include <draw.h>
#include <geometry.h>
+#include "dat.h"
+#include "fns.h"
+Layer*
+newlayer(Canvas *c)
+{
+ Layer *l;
+
+ l = emalloc(sizeof(Layer));
+ l->p = Pt2(0,0,1);
+ l->bx = c->bx;
+ l->by = c->by;
+ l->image = eallocimage(display, c->image->r, c->image->chan, 0, DNofill);
+ l->prev = c->layers.prev;
+ l->next = &c->layers;
+ c->layers.prev->next = l;
+ c->layers.prev = l;
+}
+
+void
+rmlayer(Layer *l)
+{
+ l->prev->next = l->next;
+ l->next->prev = l->prev;
+ freeimage(l->image);
+ free(l);
+}