This site requires JavaScript, please enable it in your browser!
Greenfoot back
Back to discussions
Tritos
Tritos wrote ...

2017/8/12

setting drawing transparency

Tritos Tritos

2017/8/12

#
Hey, I just have a quick question. I am currently trying to create a method that "creates" lights. For this I need to set the transparency of what I am currently drawing. I tried using
getImage().setTransparency(_t_);
But this sets the transparency of the whole Image. What I want is to set the transparency of the shape I am drawingg next, similar to the
getImage().setColor(_color_);
method. Is there a way to do this? Or atleast a way to get around this? Thanks for helping, Tritos
danpost danpost

2017/8/12

#
Tritos wrote...
Hey, What I want is to set the transparency of the shape I am drawingg next, similar to the
getImage().setColor(_color_);
method. Is there a way to do this? Or atleast a way to get around this?
You will need to zero the alpha of each pixel individually. This can be done by using the 'setColorAt' method within for loops.
You need to login to post a reply.