# Alpha transparency causing crazy rainbow glitches - Galaxy S8

**URL:** https://discourse.processing.org/t/alpha-transparency-causing-crazy-rainbow-glitches-galaxy-s8/11383
**Category:** Processing for Android
**Created:** [May 19, 2019, 2:31pm UTC](https://discourse.processing.org/t/alpha-transparency-causing-crazy-rainbow-glitches-galaxy-s8/11383 "2019-05-19T14:31:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dsvid](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@dsvid](https://discourse.processing.org/u/dsvid)
#### Post date: [May 19, 2019, 2:31pm UTC](https://discourse.processing.org/t/alpha-transparency-causing-crazy-rainbow-glitches-galaxy-s8/11383/1 "2019-05-19T14:31:06Z")

</div>

Hi everyone, I’m trying to apply an alpha mask to an image in Processing for Android simply using the .mask method, e.g. img.mask(alpha) and I’m getting seriously wild glitches.

I also tried compiling the basic Alphamask example file for Android and had the same glitching (see screenshots attached).

Just wondering if this is a known issue with Processing for Android, and if there is any way around it?

My device is a Samsung Galaxy S8

This is the code of the alphamask example (straight from the Processing example file, just the size changed) which has the output in the screenshot when run on my android device.

```auto
PImage img;
PImage maskImg;

void setup() {
  size(800, 800);
  img = loadImage("test.jpg");
  maskImg = loadImage("mask.jpg");
  img.resize(height/2,0);
  maskImg.resize(height/2,0);
  img.mask(maskImg);
  imageMode(CENTER);
}

void draw() {
  background(map(mouseX+mouseY, 0, width+height, 0, 255));
  image(img, width/2, height/2);
  image(img, mouseX, mouseY);
}

```

Thanks

 ![20190520_002219](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/638dbb2dc6af5b07d13ccf521235cd04203b1b05.jpeg)

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [May 20, 2019, 5:07am UTC](https://discourse.processing.org/t/alpha-transparency-causing-crazy-rainbow-glitches-galaxy-s8/11383/2 "2019-05-20T05:07:30Z")

</div>

Try using the P2D renderer and let us know if that fixes the issue:

`fullScreen(P2D);`

Kf

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [May 20, 2019, 5:42am UTC](https://discourse.processing.org/t/alpha-transparency-causing-crazy-rainbow-glitches-galaxy-s8/11383/3 "2019-05-20T05:42:36Z")

</div>

I confirm the solution is to use the P2D renderer. I could not find a prev reported issue so I created one for you [here](https://github.com/processing/processing-android/issues/530).

Kf

---

<div class="post-metadata">

### Author: ![dsvid](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@dsvid](https://discourse.processing.org/u/dsvid)
#### Post date: [May 20, 2019, 9:02am UTC](https://discourse.processing.org/t/alpha-transparency-causing-crazy-rainbow-glitches-galaxy-s8/11383/4 "2019-05-20T09:02:18Z")

</div>

thanks so much, your solution worked! 😃
