This commit is contained in:
benfry
2011-01-26 19:22:19 +00:00
parent d3a18c7964
commit eb64b2d4fc
1234 changed files with 96518 additions and 0 deletions
@@ -0,0 +1,24 @@
/**
* Alpha Mask.
*
* Loads a "mask" for an image to specify the transparency
* in different parts of the image. The two images are blended
* together using the mask() method of PImage.
*/
PImage img;
PImage maskImg;
void setup() {
size(200, 200);
img = loadImage("test.jpg");
maskImg = loadImage("mask.jpg");
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);
}
@@ -0,0 +1,45 @@
import processing.core.*;
import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
import java.util.regex.*;
public class Alphamask extends PApplet {
/**
* Alpha Mask.
*
* Loads a "mask" for an image to specify the transparency
* in different parts of the image. The two images are blended
* together using the mask() method of PImage.
*/
PImage img;
PImage maskImg;
public void setup()
{
size(200,200);
img = loadImage("test.jpg");
maskImg = loadImage("mask.jpg");
img.mask(maskImg);
}
public void draw()
{
background((mouseX+mouseY)/1.5f);
image(img, 50, 50);
image(img, mouseX-50, mouseY-50);
}
static public void main(String args[]) {
PApplet.main(new String[] { "Alphamask" });
}
}
@@ -0,0 +1,25 @@
/**
* Alpha Mask.
*
* Loads a "mask" for an image to specify the transparency
* in different parts of the image. The two images are blended
* together using the mask() method of PImage.
*/
PImage img;
PImage maskImg;
void setup()
{
size(200,200);
img = loadImage("test.jpg");
maskImg = loadImage("mask.jpg");
img.mask(maskImg);
}
void draw()
{
background((mouseX+mouseY)/1.5);
image(img, 50, 50);
image(img, mouseX-50, mouseY-50);
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB