PImage foto;//deklariert die Variable foto; float [] [] grau;
void setup() { size(400, 400); grau = new float [400] [400]; //hier wird ein zweidimensionales Array deklariert foto = loadImage("blume.jpg");//weist der Variablen foto die datei blume.jpg zu foto.loadPixels(); //sollte man aufrufen, bevor man die einzelen Pixel bearbeitet //foto.pixels=sort(foto.pixels);//wird diese Funktion aktiviert, werden die Farben sortiert ausgegeben for (int gridX = 0; gridX < foto.width; gridX++) { for (int gridY = 0; gridY < foto.height; gridY++) { // überträgt die Farbinfo eines Pixels auf die Variable farbe //color farbe = foto.pixels[gridY*foto.width+gridX]; color farbe = foto.get(gridX,gridY); // wandelt die Farbinfo in einen Grauwert um float grauwert =red(farbe)*0.222+green(farbe)*0.707+blue(farbe)*0.071; // println(grauwert); grau [gridX] [gridY] = grauwert;//speichert den Grauwert in unser Array grau } } }
void draw() { background(0); //image(foto,0,0);// gibt einen netten Überlagerungseffekt //jetzt wird nur für jedes 10 Pixel der Helligkeitswert ausgelesen. for (int gridX = 0; gridX < foto.width; gridX+=10) { for (int gridY = 0; gridY < foto.height; gridY+=10) { fill(grau [gridX] [gridY]);//gibt den Grauwert aus unserem Array aus ellipse (gridX,gridY,9,9); } } }
I am working on a sketch, based on the flocking algorithm from daniel shiffman. I extended the code to work in 3D. Thats all working fine, so far. I wanted to make a sketch with a swarm of fish, and fish don't swim with their stomachs up. My fish do. So i really can not figure out, how to rotate the model to avoid the "dead fish" behavior.
i have the following problem: i want to create a sketch, where i can zoom in (with scale) and while i zoomed in, i would like to save the whole picture (with its high scaled resolution) to a file.
can anyone help me out with some code that makes it possible to resume a processing sketch on android, which has been put to onPause()?
my problem: if i hit the home button (get to the desktop of the device) and then hold down the home-button, i get a list running apps (onPause, i, guess). when i select the processing-app then, my phone just shows a black screen!
at processing.android.test.edittext.edittext.setup(edittext.java:23) at processing.core.PApplet.handleDraw(PApplet.java:1779) at processing.core.PGraphicsAndroid2D.requestDraw(PGraphicsAndroid2D.java:161) at processing.core.PApplet.run(PApplet.java:1670) at java.lang.Thread.run(Thread.java:1096)
processing.app.debug.RunnerException?: java.lang.NoClassDefFoundError?: apwidgets.PWidgetContainer at processing.app.Sketch.placeException(Sketch.java:1628) at processing.app.tools.android.AndroidMode?.stackTrace(Unknown Source) at processing.app.tools.android.AndroidDevice?.reportStackTrace(Unknown Source) at processing.app.tools.android.AndroidDevice?.access$400(Unknown Source) at processing.app.tools.android.AndroidDevice?$LogLineProcessor?.handleCrash(Unknown Source) at processing.app.tools.android.AndroidDevice?$LogLineProcessor?.processLine(Unknown Source) at processing.app.exec.StreamPump?.run(StreamPump?.java:75) at java.util.concurrent.ThreadPoolExecutor?$Worker.runTask(ThreadPoolExecutor?.java:886) at java.util.concurrent.ThreadPoolExecutor?$Worker.run(ThreadPoolExecutor?.java:908) at java.lang.Thread.run(Thread.java:662)
I already tried to copy the library into the sketch-folder. nothing changed.
i made up a very simple facebook app-site-skeleton with a login-button. this works well an i am able to display the name and uid in the browser window.
hello!
when i try to run the apwidgets example edit text on my ubuntu10.10 64bit processing 0192 i get the following error after the android emulator starts: