PImage. Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e.,...
-
Upload
gyles-randall -
Category
Documents
-
view
213 -
download
0
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.](https://reader036.fdocuments.us/reader036/viewer/2022082818/56649f1b5503460f94c308cb/html5/thumbnails/1.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022082818/56649f1b5503460f94c308cb/html5/thumbnails/2.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022082818/56649f1b5503460f94c308cb/html5/thumbnails/3.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022082818/56649f1b5503460f94c308cb/html5/thumbnails/4.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022082818/56649f1b5503460f94c308cb/html5/thumbnails/5.jpg)
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.](https://reader036.fdocuments.us/reader036/viewer/2022082818/56649f1b5503460f94c308cb/html5/thumbnails/6.jpg)
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?