Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- void setup() {
- size(500, 500);
- colorMode(HSB, 360, 100, 100);
- img = loadImage("lena_color.jpg");
- }
- void draw() {
- int grid = 10;
- background(0, 0, 100);
- for (int j = 0; j < height; j+= grid) {
- for (int i = 0; i < width; i+= grid) {
- color c = img.get(i, j);
- int gradation = int(brightness(c)/10) + 1;
- stroke(c);
- rectPointGradation(i, j, grid, gradation);
- }
- }
- noLoop();
- }
- void rectPointGradation(int x, int y, int grid, int gradation) {
- pushMatrix();
- translate(x, y);
- for (int j = 0; j < grid; j++) {
- for (int i = 0; i < grid; i++) {
- if ((j*grid + i)%gradation == 0) {
- point(i, j);
- }
- }
- }
- popMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement