Print Example 6: Scale and segment an image translate() problem

Hi, I'm having problems with this technique.

https://processing.org/tutorials/print/

 /* 
     * Example 6: Scale and segment an image
     * 
     * Draws an image larger than the screen by tiling it into small sections.
     * The scaleValue variable sets amount of scaling: 1 is 100%, 2 is 200%, etc.
     */

    int scaleValue = 3;  // Multiplication factor
    int xoffset = 0;     // x-axis offset 
    int yoffset = 0;     // y-axis offset

    void setup() {
      size(600, 600);
      stroke(0, 100);
    }

    void draw() {
      scale(scaleValue);
      translate(xoffset * (-width/scaleValue), yoffset * (-height/scaleValue));
      line(10, 150, 500, 50);
      line(0, 600, 600, 0); 
      setOffset();
    }

    void setOffset() {
      save("lines-" + xoffset + "-" + yoffset + ".jpg");
      xoffset++;
      if (xoffset == scaleValue) {
        xoffset = 0;
        yoffset++;
        if (yoffset == scaleValue) {
          exit();
        } 
      }
      background(204);
    }

the problem is that I have to use translate() several times after this and it makes impossible exporting the image correctly. Example:

void draw() {
  scale(scaleValue);
  translate(xoffset * (-width/scaleValue), yoffset * (-height/scaleValue));
  line(10, 150, 500, 50);
 translate(0,height/2);
  line(0, 600, 600, 0); 
  setOffset();
}

I've tried another ways like: Example 4: accumulate many frames into one pdf Example 5: high-resolution off-screen buffer

The problem is that I must use "aa" < fft.specSize() in my sketch and I can't enlarge it. Also there is a lot of transparency what makes it difficult to use a pdf/svg vector mode for exporting.

Thanks, sorry for my spanglish.

Answers

Sign In or Register to comment.