PImage

As I stated in my revised .02 schedule, I am working on PImage. I have been playing around with it but unfortunately I haven’t been able to get the image on the screen. Here is a run down of PImage:

It is a JavaScript class that holds attributes of an image: it’s width, height, format, and an array of each pixel it is made up of. It also has methods like: get(), set(), loadPixels(), updatePixels(), save(), blend(), copy(), mask(), filter(), resize(). You can check out the Java reference to read more on PImage.

My firs task if the constructor. The constructor either excepts: 0 parameters, the height and width, the height and width and format, or an image.   I decided to tackle the constructor that accepts and image.  This seemed simple enough as the image being passed in already has the width, height, format, and pixel array. Now here is the hard part, how do you get the pixel array? From all of the references I have read I get the impression that before you can load any pixels, you first have to use the loadPixels() which actually takes the pixels on the screen and stores them in an array. From this perspective though, the image should already be displayed on the screen. So i am following these steps;

  • load image using loadImage(“name.ext”) this returns a var img
  • create PImage by passing it the var img created above
  • display the image on the screen image(img,0,0)
  • calling the PImage loadPixels()
  • display the PImage on the screen

Unfortunately, I get nothing. I will let everyone know once its finally working though.

Advertisements

One thought on “PImage

  1. Pingback: 0.2 Release & PImage Revision « Anna on Stuff (Processing.js/Open Source)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s