0.6 processing.js: if it aint broke don’t fix it


To put it in simple terms: I am stuck.

I have a test for pimage, pimage.get(), and pimage.set() working in processing on java and a test for blend() and copy() working as well.

The problem is they both require pimage and pimage.get() working

For some reason I cannot get a prototype for get() to work at all

something as simple and short as:

p.PImage = function PImage(aWidth, aHeight, aFormat) {
this.get = function get(x, y, w, h) {
Accompanied by the following pjs code
PImage pim = loadImage(“metamorphosis.jpg”);
pim.get(464, 200);
gives me an error in the console
Error: pim.get is not a function
Line: 4531
I’ve simplified the function down as small as I can get it and it just will not work.
I also tried the p.PImage.prototype.get = function get() {};  method and it doesn’t work either
This prototype problem is causing the following problems:
  • cant work on loadImage() and createImage() to get them passing back pixel arrays for pimage to use
  • can’t test my pimage unit test just to see if get and set work
  • as a result i cant test blend()
  • as a result i cant test copy()
  • as a result i cant test blit_resize() which implements the ability to use bilinear interpolation and nearest neighbour interpolation for image resizing
  • blit_resize also tests intersect(), peg(), min(), filter_new_scanline(), and filter_bilinear()
  • all of that blocks work on filter() and mask()
On top of all that im still going to have a huge problem when I try to wrap pimage.get to use p.get() because p.get() works with the main canvas and I want to just apply get() to my pimage object.
I either need to write 2 versions of every method or I need to change p.get(), p.set(), etc etc to take an optional parameter of the pixel array I want them to work with instead of the main canvas.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s