size matters

_A__A_
edited January 2014 in Using Processing

point(width, height/2); does not appear in the Java applet window, nor does it appear in a saved raster image file, but it does appear (or half of it) as expected when outputted as a pdf. The same is also true for a default, (1 px) line as in, line(width, 0, width, height); I am running 2.0.3 on OSX v10.6.8

Answers

  • point() will create a single pixel at the x & y provided. So for a raster output, like your screen, or the saved image, the pixels are drawn inside the bounds of a pixel. but for the pdf, it is a vector object, so the pixels are drawn ON the bounds of the pixels.

    for example, the point (0, 0) on screen is the top left pixel. but in vector, the point (0, 0) is the top left corner of the top left pixel.

    hope this helps!

  • _A__A_
    edited January 2014

    In drawing programmes, a stroke is usually painted centred to the spline.
    Also, ellipse(0,0,0,0); maps to same dimension as point()
    And ellipse(0,0,1,1); is twice the diameter of a point!
    I think, there is something not quite right!

    stroke(0);
    noFIll();
    rect(0,0,width,height); 
    

    draws a rectangle that is width+1 x height+1 so that the right and bottom strokes are missing, (except when exported as a pdf).

    Interesting.

    Both ellipse(width/2,height/2,width,height); and ellipse(width/2,height/2, width-1,height-1); work in pdf, but in Processing/bitmap only ellipse(width/2,height/2, width-1,height-1); works without clipping.

    Shurely, shome mishtake!

    rectMode(CENTER);
    noFill();
    rect(width/2,height/2,width,height);
    

    Is painted off centre, but

    rect(width/2,height/2,width-1,height-1);

    works!
    Is this a feature or a bug?

  • edited January 2014

    "ellipse(0,0,1,1); is twice the diameter of a point!"
    You should try without anti-aliasing: noSmooth().

  • I do not need to do that. Exporting as pdf does not 'add' anti-aliasing. What is the point, you are trying to make?

  • a point with antialiasing is larger than a pixel because neighbouring pixels are also affected to make the target point look better.

    as for your original post - point(width, height/2); - this is offscreen when talking about screen pixels. screen is width pixels across, numbered 0 to width - 1. same with rect(0, 0, width, height).

  • A circle is symmetrical about its centre. ellipse(width/2,height/2,width-1,height-1); isn't symmetrical for a square canvas.

  • rounding errors?

  • ...unless your size() parameter is an odd number. A circle is symmetrical about its centre. ellipse(width/2,height/2,width-1,height-1); isn't symmetrical for a square canvas e.g. size(200,200);

Sign In or Register to comment.