# blendMode support on Android

**URL:** <https://discourse.processing.org/t/blendmode-support-on-android/25645>\
**Category:** Processing for Android\
**Created:** [November 23, 2020, 9:43pm UTC](https://discourse.processing.org/t/blendmode-support-on-android/25645 "2020-11-23T21:43:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasperamorgan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jasperamorgan/32/11176_2.png) [@jasperamorgan](https://discourse.processing.org/u/jasperamorgan)\
**Post date:** [November 23, 2020, 9:43pm UTC](https://discourse.processing.org/t/blendmode-support-on-android/25645/1 "2020-11-23T21:43:12Z")

</div>

Which blendMode types are supported on Android?

I’ve been looking at this documentation: [https://processing.org/reference/blendMode\_.html](https://processing.org/reference/blendMode_.html)

When running using blendMode(MULTIPLY) I get the warning:

`blendMode(), or this particular variation of it, is not available with this renderer.`

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [November 25, 2020, 10:47am UTC](https://discourse.processing.org/t/blendmode-support-on-android/25645/2 "2020-11-25T10:47:43Z")

</div>

I have tested the code below on an Android 10 device with APDE using images below, and I did not get any error. The blendMode() function didn’t give any error as well on my device.

```auto
PImage c1, c2;
PGraphics pg;
int mode;

int[] modes = {
    BLEND,
    ADD,
    SUBTRACT,
    DARKEST,
    LIGHTEST,
    DIFFERENCE,
    EXCLUSION,
    MULTIPLY,
    SCREEN,
    OVERLAY,
    HARD_LIGHT,
    SOFT_LIGHT,
    DODGE,
    BURN};

void setup() {
  size (600, 400);
  c1 = loadImage("1.jpg");
  c2 = loadImage("2.jpg"); 
}

void draw() {
  background(255);
  try {
  c1.blend(c2, 0, 0, 200, 400, 400, 0, 200, 400, modes[mode]); 
  } catch(Exception e) {
    println("mode "+mode+" not possible");
  }
  image(c1, 0, 0); 
  image(c2, 0, 0); 
}

void mousePressed() {
  mode++;
  println(mode);
  if (mode == 14) mode = 0;
}

```

![1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/92fdb0a9e51dd182e70e1da495ba10733fc78f91.jpeg)  
 ![2](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8aee75197d14c79b78fabeeaf4324d361927b5dd.jpeg)

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [November 25, 2020, 11:37am UTC](https://discourse.processing.org/t/blendmode-support-on-android/25645/3 "2020-11-25T11:37:10Z")

</div>

> [@noel](#):
>
> The blendMode() function didn’t give any error as well on my device.

Isn’t that code testing `blend()`?! `blendMode()` works differently across all the renderers.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [November 25, 2020, 2:04pm UTC](https://discourse.processing.org/t/blendmode-support-on-android/25645/4 "2020-11-25T14:04:40Z")

</div>

> [@neilcsmith](#):
>
> Isn’t that code testing `blend()` ?! `blendMode()` works differently across all the renderers.

True, the best renderer I think is P2D.  
The code below testing the blendMode() method gives me same results on PC and Android without errors, but I don’f get the expected results; Some seem to have no effect at all.  
Or maybe I am testing this the wrong way?

Edit: actually I do get warnings in P2D renderer on PC, not on Android.  
and also not with the default or FX2D renderer.

blendMode(DIFFERENCE) is not supported by this renderer  
blendMode(OVERLAY) is not supported by this renderer  
blendMode(HARD\_LIGHT) is not supported by this renderer  
blendMode(SOFT\_LIGHT) is not supported by this renderer  
blendMode(DODGE) is not supported by this renderer  
blendMode(BURN) is not supported by this renderer

Anyways also in P2D it doesn’t look right.

```auto
int mode; 
String[] txt = {"BLEND", "ADD", "SUBTRACT", "DARKEST", "LIGHTEST", "DIFFERENCE", "EXCLUSION", "MULTIPLY", "SCREEN", "OVERLAY", "HARD_LIGHT", "SOFT_LIGHT", "DODGE", "BURN"}; 
int[] modes = {BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN}; 

void setup() { 
  size (600, 600, P2D); 
  textSize(30);
  println(mode+" "+txt[mode]); 
} 

void draw() { 
  push();
  blendMode(modes[mode]); 
  fill(255, 0, 0); 
  rect(0, 0, 200, 600); 
  rect(0, 0, 600, 200); 
  fill(0, 255, 0); 
  rect(200, 0, 200, 600); 
  rect(0, 200, 600, 200); 
  fill(0, 0, 255); 
  rect(400, 0, 200, 600); 
  rect(0, 400, 600, 200); 
  pop();
  fill(0); 
  text(txt[mode], 10, 50);
  fill(255);
  text(txt[mode], 230, 50);
} 

void mousePressed() { 
  mode++; 
  if (mode == 14) mode = 0;
  println(mode+" "+txt[mode]); 
}

```

---

<div class="post-metadata">

**Author:** ![jasperamorgan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jasperamorgan/32/11176_2.png) [@jasperamorgan](https://discourse.processing.org/u/jasperamorgan)\
**Post date:** [November 26, 2020, 2:45pm UTC](https://discourse.processing.org/t/blendmode-support-on-android/25645/5 "2020-11-26T14:45:31Z")

</div>

Thanks guys - I’ll give P2D a go and see how that goes!
