aboutsummaryrefslogtreecommitdiff
path: root/layer.c
diff options
context:
space:
mode:
Diffstat (limited to 'layer.c')
-rw-r--r--layer.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/layer.c b/layer.c
index b8a2742..e3a389d 100644
--- a/layer.c
+++ b/layer.c
@@ -5,6 +5,15 @@
#include "dat.h"
#include "fns.h"
+static int
+alphachan(ulong chan)
+{
+ for(; chan; chan >>= 8)
+ if(TYPE(chan) == CAlpha)
+ return 1;
+ return 0;
+}
+
Layer*
newlayer(Canvas *c)
{
@@ -14,7 +23,7 @@ newlayer(Canvas *c)
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->image = eallocimage(display, c->image->r, c->image->chan, 0, alphachan(c->image->chan)? DTransparent: DNofill);
l->prev = c->layers.prev;
l->next = &c->layers;
c->layers.prev->next = l;