Syphon / Processing

Syphon Implementation for Processing
Other
137 stars 33 forks source link

No alpha when trying to show entire frame contents #6

Closed computersarecool closed 10 years ago

computersarecool commented 10 years ago

What steps will reproduce the problem?

  1. Launch Simple Server
  2. Use server.sendImage(g) to send entire contents of processing frame,
  3. No alpha.

What is the expected output? What do you see instead? Alpha! No alpha.

//Code example

import codeanticode.syphon.*;

PGraphics canvas;
SyphonServer server;

void setup() {
  size(400,400, P3D);
  canvas = createGraphics(400, 400, P3D);

  server = new SyphonServer(this, "Processing Syphon");
}

void draw() {  
  background(80,0,0,80);
  stroke(0,255,0);
  line(mouseX,mouseY,pmouseX,pmouseY);
  server.sendImage(g);
}
codeanticode commented 10 years ago

1.0-RC2 (available under releases) should solve this problem. Use the following client/server sketches for better testing:

import codeanticode.syphon.*;

PGraphics canvas;
SyphonClient client;

public void setup() {
  size(400, 400, P2D);
  client = new SyphonClient(this, "AlphaServer");
  canvas = createGraphics(400, 400, P2D);
}

public void draw() {
  if (client.available()) {
    background(150);
    fill(0);
    ellipse(width/2, height/2, 200, 200); 
    canvas = client.getGraphics(canvas);
    image(canvas, 0, 0, width, height);    
  }  
}
import codeanticode.syphon.*;

PGraphics canvas;
SyphonServer server;

void setup() {
  size(400,400, P2D);
  canvas = createGraphics(400, 400, P2D);
  server = new SyphonServer(this, "Alpha Test");
}

void draw() {
  stroke(0);
  line(0, 200, 400, 200);
  line(200, 0, 200, 400);
  canvas.beginDraw();
  canvas.background(255, 0, 0, map(mouseX, 0, width, 0, 255));  
  canvas.endDraw();
  image(canvas, 0, 0);
  server.sendImage(canvas);
}

I'm closing this issue now, but re-open it if you find other problems with the handling of the alpha channel.