Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Image problem

dave1707dave1707 Mod
edited November 2012 in Bugs Posts: 9,471

Can someone explain what's happening here. I create an image, size v,v. I draw a white dot at v,v. I create a rectangle at 1,1 with width v, and height v. I draw a diagonal line from 1,1 to v,v. Everything seems to work OK until the value of v is greater than 495. Over 495, it doesn't draw the rectangle or the diagonal line to the dot at v,v. Run the program with the value of v at 300, 400, 500, and 600.


function setup()     displayMode(FULLSCREEN)          v=300    -- change to 400, 500, 600          c=color(255,255,255)     img = image(v,v)     img:set(v,v,c)    -- draw white dot at v,v             setContext(img)         fill(175, 179, 75, 255)     rect(1,1,v,v)    -- draw rect at 1,1 width v, height v          stroke(251, 0, 0, 255)     strokeWidth(3)     line(1,1,v,v)    -- draw diagonal line from 1,1 to v,v end function draw()     background(0,0,0)     sprite(img,WIDTH/2,HEIGHT/2)    -- draw image centered on screen end

Comments

  • Posts: 2,161

    Haven't tried it, but try putting in noSmooth()

  • dave1707dave1707 Mod
    edited November 2012 Posts: 9,471

    @Andrew_Stacey

    The problem isn't with the way the line looks, the rect and line commands aren't being drawn all the way. It's as if the rect and line commands are being clipped, but trying clip() has no affect.

  • Posts: 489

    I think this is issue #212: move displayMode() outside of setup().

  • dave1707dave1707 Mod
    edited November 2012 Posts: 9,471

    Thanks @mpilgrem. That fixed the problem. From now on I'm going to put that and some of the other commands before setup().

  • dave1707dave1707 Mod
    Posts: 9,471

    @mpilgram

    Moving displayMode(FULLSCREEN) above setup() worked as long as the size of v in the above program was 768 or below. Once the value got above 768 (width size) the line and rect were getting clipped again. I used translate() to shift the display so I could see the top right corner.

  • Posts: 489

    I understand from this discussion here that Codea clips large images in some way.

  • dave1707dave1707 Mod
    Posts: 9,471

    @mpilgrem The link was interesting to read. Playing around more, I can set an image size to 2048 x 2048 and use image:set() to set points up to the 2048 edge, but when I use the line or rect commands, they're clipped at the screen size of 1024 x 768. So it seems like the image isn't being clipped but the line and rect commands are. I'm using an iPad 1 so I don't know if things work different on the later iPads.

  • JohnJohn Admin Mod
    Posts: 643

    .@dave1707 I'll have to test this. It sounds like an issue with setContext clipping draw commands to the window size instead of the image size.

Sign In or Register to comment.