PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e.,...

6
PImage

Transcript of PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e.,...

Page 1: PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What about the constructor---how.

PImage

Page 2: PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What about the constructor---how.

PImage

• Let’s look at the PImage class in Processing– What are the fields (i.e., variables)?– What methods are available?– What about the constructor---how many

parameters does it have?• There are 4 constructors each with a different

number of parameters

Page 3: PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What about the constructor---how.

Using PImage’s filter() Method

PImage img;

void setup() { size(100,200); img = loadImage("forest.jpg"); image(img, 0, 0); img.filter(INVERT); image(img, 0, 100);}

Here are the images that you need as a zip file

Page 4: PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What about the constructor---how.

PImage’s mask() Method

background(255);

PImage img = loadImage("airport.jpg");

PImage maskImg = loadImage("airportmask.jpg");

img.mask(maskImg);

image(img, 0, 0);

Page 5: PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What about the constructor---how.

Modifying Pixels and HW 6

• Processing program to change Pixels• Image for the program

• HW6– Have your program do the following

• Load a png or jpg image• Using a mouse event, read and modify several pixels of the image• Using a keyboard event, modify the entire image• You must use a for loop in your program

– Grading• 10% Aesthetics• 20% documentation and comments• 20% for loop• 25% reading pixels from an array• 25% modifying pixels within an array

Page 6: PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What about the constructor---how.

PImage Revisited

• Here’s an alternative way of looking at the documentation for PImage

• This documentation is produced by Javadoc

• Processing is implemented as a set of Java classes that accompany those normally provided with Java

• Can you find the line() method?