Tuesday, 15 February 2011

processing - ProcessingJS fails to draw images produced by PImage.get -


Here are some code that works great in Java and Android mode but does not work in Javascript mode. It uses PImage.get to remove a new PImage in the sub-region of the original image. I can attract the original image and any sub images in java and android mode, but javascript mode drawing fails all the image. Here's a very basic demo of the problem, replace your own image file or just download a zip of sketch.

  // Announce two images PImage fullImage, subImage; Zero setup () {size (640, 480); // Load an image from a file Full image = Load image ("smurf_sprite.png"); // Load a new image to the upper left queue of the original image in all image = full image (0, 0, full image. Width / 4, full image .hit / 4); } Zero draw () {background (0); ImageMode (middle); // Drag the entire image into the background image (full image, width / 2, height / 2); // Draw the sub image where the mouse is the image (all the image, mousex, mousse); } I tried to keep it simple I know if you know how it works for JavaScript mode  

Thank you,

~ Chuck

I realize It is necessary that ProcessingJS.org has different content in their context than the .org.If you can see, then you can see that you have to include it as a command:

  / * @ Pjs preload = "yourimagename.jog, yourimagename2.png"; * /   

so that the images can be preloaded. In my case, I believe I Image sub-rules before loading pixels Ratilipi was made.

No comments:

Post a Comment