hobbyware

[프로세싱] PImage를 이용한 이미지 처리 #4 이중 for문을 이용하여 바둑판식 그림 배열

develop/processing




/* 소스코드 시작 */


PImage img;



void setup()

{

  size(640, 360);

  smooth();

  img = loadImage("file.png");

}


void draw()

{

  int w = mouseX+1;

  int h = mouseY+1;

  for (int j=0; j<height; j+=h)

  {

    for (int i=0; i<width; i+=w)

    {

      image(img, i, j, w, h);

    }

  }

}



/* 소스코드 끝 */