0
From last time…
• translate(), rotateX(), rotateY(), rotateZ()
• scale(), pushMatrix(), popMatrix()
Demo!
Directional Light
Demo!
MovieMaker
CAP
Images I
Processing Classes
PShape
PFont
PVector
PGraphics
PImage
PImage Class
• A subclass of PGraphics
• We declare and initialize a PImage just like any
other class:!
PImage img;
img = ...
loadImage()
• loadImage() calls the constructor for us!
• createImage() creates a blank image (all 0’s)!
• Don’t use it in...
Demo!
loadImage()
tint()
• tint() changes the brightness and opacity of
pixels in an image!
tint(155); // affects overall brightness
tint(15...
Demo!
tint()
The pixels[] Array
• We can load the pixels array of our sketch
window with loadPixels()
• We can load the pixels of any i...
Demo!
The pixels[] Array
Locating Pixels
• Linear pixel location:!
int location = X + Y * WIDTH;
• This can be used to get or set pixels
Demo!
Locating Pixels
For next time…
• Read Shiffman, pp. 264–274 (Images II)!
• Homework 4, due Monday
(Mathematics, Translation, & Rotation)
T...
25. Images I
Upcoming SlideShare
Loading in...5
×

25. Images I

39

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
39
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "25. Images I"

  1. 1. From last time… • translate(), rotateX(), rotateY(), rotateZ() • scale(), pushMatrix(), popMatrix()
  2. 2. Demo! Directional Light
  3. 3. Demo! MovieMaker
  4. 4. CAP Images I
  5. 5. Processing Classes PShape PFont PVector PGraphics PImage
  6. 6. PImage Class • A subclass of PGraphics • We declare and initialize a PImage just like any other class:! PImage img; img = loadImage(“filename.png”); PImage img = loadImage(“filename.png”);
  7. 7. loadImage() • loadImage() calls the constructor for us! • createImage() creates a blank image (all 0’s)! • Don’t use it in the draw loop (use it in setup)! • Like any other class, you can store many images in a PImage[] • You must provide a filename or URL
  8. 8. Demo! loadImage()
  9. 9. tint() • tint() changes the brightness and opacity of pixels in an image! tint(155); // affects overall brightness tint(155, 132); // affects brightness & opacity tint(0, 25, 255); // affects RGB brightness tint(0, 25, 255, 132); // affects RGB & opacity
  10. 10. Demo! tint()
  11. 11. The pixels[] Array • We can load the pixels array of our sketch window with loadPixels() • We can load the pixels of any image with img.loadPixels() • We can manipulate those pixels, and then save them with updatePixels() img.updatePixels()
  12. 12. Demo! The pixels[] Array
  13. 13. Locating Pixels • Linear pixel location:! int location = X + Y * WIDTH; • This can be used to get or set pixels
  14. 14. Demo! Locating Pixels
  15. 15. For next time… • Read Shiffman, pp. 264–274 (Images II)! • Homework 4, due Monday (Mathematics, Translation, & Rotation) This may be tough—start early!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×