You are previewing Learning Processing.
O'Reilly logo
Learning Processing

Book Description

The free, open-source Processing programming language environment was created at MIT for people who want to develop images, animation, and sound. Based on the ubiquitous Java, it provides an alternative to daunting languages and expensive proprietary software.

This book gives graphic designers, artists and illustrators of all stripes a jump start to working with processing by providing detailed information on the basic principles of programming with the language, followed by careful, step-by-step explanations of select advanced techniques.

The author teaches computer graphics at NYU's Tisch School of the Arts, and his book has been developed with a supportive learning experience at its core. From algorithms and data mining to rendering and debugging, it teaches object-oriented programming from the ground up within the fascinating context of interactive visual media.

Previously announced as "Pixels, Patterns, and Processing"

*A guided journey from the very basics of computer programming through to creating custom interactive 3D graphics
*Step-by-step examples, approachable language, exercises, and LOTS of sample code support the reader's learning curve
*Includes lessons on how to program live video, animated images and interactive sound

Table of Contents

  1. Copyright
  2. The Morgan Kaufmann Series in Computer Graphics
  3. Acknowledgments
  4. Introduction
    1. What is this book?
    2. Who is this book for?
    3. What is Processing?
    4. But shouldn’t I be Learning __________ ?
    5. Write in this book!
    6. How should I read this book?
    7. Is this a textbook?
    8. Will this be on the test?
    9. Do you have a web site?
    10. Take It One Step at a Time
      1. The Philosophy of Incremental Development
    11. Algorithms
  5. One. The Beginning
    1. 1. Pixels
      1. 1.1. Graph Paper
      2. 1.2. Simple Shapes
      3. 1.3. Grayscale Color
      4. 1.4. RGB Color
      5. 1.5. Color Transparency
      6. 1.6. Custom Color Ranges
    2. 2. Processing
      1. 2.1. Processing to the Rescue
      2. 2.2. How do I get Processing?
      3. 2.3. The Processing Application
      4. 2.4. The Sketchbook
      5. 2.5. Coding in Processing
      6. 2.6. Errors
      7. 2.7. The Processing Reference
      8. 2.8. The “Play” Button
      9. 2.9. Your First Sketch
      10. 2.10. Publishing Your Program
    3. 3. Interaction
      1. 3.1. Go with the flow
      2. 3.2. Our Good Friends, setup( ) and draw( )
      3. 3.3. Variation with the Mouse
      4. 3.4. Mouse Clicks and Key Presses
  6. Two. Everything You Need to Know
    1. 4. Variables
      1. 4.1. What is a Variable?
      2. 4.2. Variable Declaration and Initialization
      3. 4.3. Using a Variable
      4. 4.4. Many Variables
      5. 4.5. System Variables
      6. 4.6. Random: Variety is the spice of life
      7. 4.7. Variable Zoog
    2. 5. Conditionals
      1. 5.1. Boolean Expressions
      2. 5.2. Conditionals: If, Else, Else If
      3. 5.3. Conditionals in a Sketch
      4. 5.4. Logical Operators
      5. 5.5. Multiple Rollovers
      6. 5.6. Boolean Variables
      7. 5.7. A Bouncing Ball
      8. 5.8. Physics 101
    3. 6. Loops
      1. 6.1. What is iteration? I mean, what is iteration? Seriously, what is iteration?
      2. 6.2. “WHILE” Loop, the Only Loop You Really Need
      3. 6.3. “Exit” Conditions
      4. 6.4. “FOR” Loop
      5. 6.5. Local vs. Global Variables (AKA “Variable Scope”)
      6. 6.6. Loop Inside the Main Loop
      7. 6.7. Zoog grows arms
  7. Three. Organization
    1. 7. Functions
      1. 7.1. Break it down
      2. 7.2. “User Defined” Functions
      3. 7.3. Defining a Function
      4. 7.4. Simple modularity
      5. 7.5. Arguments
      6. 7.6. Passing a copy
      7. 7.7. Return type
      8. 7.8. Zoog reorganization
    2. 8. Objects
      1. 8.1. I’m down with OOP
      2. 8.2. Using an Object
      3. 8.3. Writing the Cookie Cutter
      4. 8.4. Using an Object: The Details
      5. 8.5. Putting it Together with a Tab
      6. 8.6. Constructor Arguments
      7. 8.7. Objects are data types too!
      8. 8.8. Object-Oriented Zoog
  8. Four. More of the same
    1. 9. Arrays
      1. 9.1. Arrays, why do we care?
      2. 9.2. What is an array?
      3. 9.3. Declaring and Creating an Array
      4. 9.4. Initializing an Array
      5. 9.5. Array Operations
      6. 9.6. Simple Array Example: The Snake
      7. 9.7. Arrays of Objects
      8. 9.8. Interactive Objects
      9. 9.9. Processing’s Array Functions
      10. 9.10. One Thousand and One Zoogs
  9. Five. Putting It All Together
    1. 10. Algorithms
      1. 10.1. Where have we been? Where are we going?
      2. 10.2. Algorithm: Dance to the beat of your own drum
      3. 10.3. From Idea to Parts
      4. 10.4. Part 1: The Catcher
      5. 10.5. Part 2: Intersection
      6. 10.6. Part 3: The Timer
      7. 10.7. Part 4: Raindrops
      8. 10.8. Integration: Puttin’ on the Ritz
      9. 10.9. Getting Ready for Act II
    2. 11. Debugging
      1. 11.1. Tip #1: Take a break
      2. 11.2. Tip #2: Get another human being involved
      3. 11.3. Tip #3: Simplify
      4. 11.4. Tip #4: println( ) is your friend
    3. 12. Libraries
      1. 12.1. Libraries
      2. 12.2. Built-in Libraries
      3. 12.3. Contributed Libraries
  10. Six. The World Revolves Around You
    1. 13. Mathematics
      1. 13.1. Mathematics and Programming
      2. 13.2. Modulus
      3. 13.3. Random Numbers
      4. 13.4. Probability Review
      5. 13.5. Event Probability in Code
      6. 13.6. Perlin Noise
      7. 13.7. Angles
      8. 13.8. Trigonometry
      9. 13.9. Oscillation
      10. 13.10. Recursion
      11. 13.11. Two-Dimensional Arrays
    2. 14. Translation and Rotation (in 3D!)
      1. 14.1. The Z-Axis
      2. 14.2. P3D vs. OPENGL
      3. 14.3. Vertex Shapes
      4. 14.4. Custom 3D Shapes
      5. 14.5. Simple Rotation
      6. 14.6. Rotation Around Different Axes
      7. 14.7. Scale
      8. 14.8. The Matrix: Pushing and Popping
      9. 14.9. A Processing Solar System
  11. Seven. Pixels Under a Microscope
    1. 15. Images
      1. 15.1. Getting Started with Images
      2. 15.2. Animation with an Image
      3. 15.3. My Very First Image Processing Filter
      4. 15.4. An Array of Images
      5. 15.5. Pixels, Pixels, and More Pixels
      6. 15.6. Intro to Image Processing
      7. 15.7. Our Second Image Processing Filter, Making Our Own Tint()
      8. 15.8. Writing to Another PImage Object’s Pixels
      9. 15.9. Level II: Pixel Group Processing
      10. 15.10. Creative Visualization
    2. 16. Video
      1. 16.1. Before Processing
      2. 16.2. Live Video 101
      3. 16.3. Recorded Video
      4. 16.4. Software Mirrors
      5. 16.5. Video as Sensor, Computer Vision
      6. 16.6. Background Removal
      7. 16.7. Motion Detection
      8. 16.8. Computer Vision Libraries
      9. 16.9. The Sandbox
  12. Eight. The Outside World
    1. 17. Text
      1. 17.1. Where do Strings come from?
      2. 17.2. What is a String?
      3. 17.3. Displaying Text
      4. 17.4. Text Animation
      5. 17.5. Text Mosaic
      6. 17.6. Rotating Text
      7. 17.7. Display text character by character.
    2. 18. Data Input
      1. 18.1. Manipulating Strings
      2. 18.2. Splitting and Joining
      3. 18.3. Reading and Writing Text Files
      4. 18.4. Text Parsing
      5. 18.5. Text Analysis
      6. 18.6. Asynchronous Requests
      7. 18.7. Beginner XML
      8. 18.8. Using the Processing XML Library
      9. 18.9. The Yahoo API
      10. 18.10. Sandbox
    3. 19. Data Streams
      1. 19.1. Synchronous vs. Asynchronous
      2. 19.2. Creating a Server
      3. 19.3. Creating a Client
      4. 19.4. Broadcasting
      5. 19.5. Multi-user communication, part 1: the server
      6. 19.6. Multi-user communication, part 2: the client
      7. 19.7. Multi-user communication, part 3: all together now
      8. 19.8. Serial communication
      9. 19.9. Serial communication with handshaking
      10. 19.10. Serial communication with strings
  13. Nine. Making Noise
    1. 20. Sound
      1. 20.1. Really Simple Sound
      2. 20.2. Getting Started with Sonia and Minim
      3. 20.3. Basic Sound Playback
      4. 20.4. A Bit Fancier Sound Playback
      5. 20.5. Live input
      6. 20.6. Sound Thresholding
    2. 21. Exporting
      1. 21.1. Web applets
      2. 21.2. Stand-Alone applications
      3. 21.3. High-resolution PDFs
      4. 21.4. Images/saveframe()
      5. 21.5. Moviemaker
  14. Ten. Beyond Processing
    1. 22. Advanced Object-Oriented Programming
      1. 22.1. Encapsulation
      2. 22.2. Inheritance
      3. 22.3. An Inheritance Example: SHAPES
      4. 22.4. Polymorphism
      5. 22.5. Overloading
    2. 23. Java
      1. 23.1. Revealing the Wizard
      2. 23.2. If we did not have Processing, what would our code look like?
      3. 23.3. Exploring the Java API
      4. 23.4. Other Useful Java Classes: ArrayList
      5. 23.5. Other Useful Java Classes: Rectangle
      6. 23.6. Exception (error) Handling
      7. 23.7. Java Outside of Processing
  15. Common Errors