// シームレス画像生成用のグラデーションの変化をグラフっぽく表示 /* @pjs preload="seamless_parts_gimp.png"; */ PImage img; int y; void setup() { size(512, 512); img = loadImage("seamless_parts_gimp.png"); y = 0; } void draw() { background(0); image(img, 0, 0); int w = img.width; int h = img.height; strokeWeight(1); stroke(0, 255, 0, 92); line(0, y, w - 1, y); stroke(255, 0, 0, 92); img.loadPixels(); for (int x =0; x < w; x++) { float v = red(img.pixels[y * w + x]); float y0 = height * v / 255; line(x, y0, x, height - 1); } y++; if (y >= h) y = 0; }