add layer detection while drawing (upper layer transparent; lower layer dark)

Signed-off-by: anti-freak <antifreak2011@gmail.com>