Monday, 13 August 2012

Setting up processing

Introduction to Processing


  1. Using Windows Explorer, navigate to folder of   \processing-1.5.1 and check out the folder in explorer.
    • If you cannot get the public directory, then you can download (http:/processing.org )the ZIP file and unpack this onto your desktop.
  2. You will find the following:
    • lib - Contains the Jar files that make up processing.
    • modes - Shows that processing can be based on pure java or android-flavour
    • modes/java/applet/ - Contains applet stubs that are used when you create a processing applet
    • modes/java/application/ - Contains MAC-style stubs for applications
    • modes/java/examples/ - Example code that you can access from a menu (see belos)
    • modes/java/libraries/ - Extension libraries. You will notice these are all third-party
    • modes/java/reference/ - Help
    • modes/java/theme/ - Processing.exe's Skin. Change theme.txt to change the GUI colors.

    Finally 'processing.exe'. This program is known as a 'class=loader' program and is the equivalent of 'appletviewer'. Other class-loaders include eclipse and netbeans (of course they do a lot more besides, but this is one thing they do. Appletviewer provides a Frame object, which is the equivalent of what a browser provides for applets. Processing provides a more complex object (Processing). Appletviewer does very little beyond the basic, and things like class-paths are set outside of it. Processing does all of this internally, and has reasonable defaults so that it more or less runs out-of-the-box. A lot of care has gone into this aspect, making it more straightorward to use by newbies.
  3. * By the way, the file processing-1.5.1-windows-expert.zip is all of it. You can copy and expand this onto your memory stick and just move it with you. You can also download it or Mac/Linux versions from processing.org's Download page.
  4. Now run the program 'processing.exe' - either from the network where you are now, from your memory stick (it would be faster from there - it is 75MB in size.
  5. Finally, browse to Getting Started and start playing. In the File menu, you will find 'examples'. Click it, and you are away. Try some of the programs. Look at the code. Try to figure out how it works.....

Some questions

Look up the documentation to find out some of the answers to these questions.
  1. Go to the examples, and load Topics/Image Processing/Brightness.
    • The loadPixels() method is called twice. Why? How are the calls different?
    • loadPixels() is called only within setup(). Why?
    • The code inside draw() describes a Point operation on the image pixels. How can you tell?
    • What is the purpose of the variable loc?
    • The image looks monochrome. Which color is being used? Change the code to use all colors
  2. Now save this file as an Applet on your webpage. Check the permissions, and see if you can run the code as an Applet on your browser.