brownplt / pyret-docs

The documentation for Pyret.
9 stars 18 forks source link

Documentation/Functionality Error for scene-line #81

Open manaskor opened 11 months ago

manaskor commented 11 months ago

https://pyret.org/docs/latest/image.html#%28part._image_scene-line%29

scene-line :: ( img :: Image, x1 :: Number, y1 :: Number, x2 :: Number, y2 :: Number, background :: Image ) -> Image Draws a line from (x1,y1) to (x2,y2) on the scene background. Unlike add-line, this function crops the resulting image to be the same size as background.

But the background parameter should instead refer to a parameter of type ImageColor, as seen below for add-line:

https://pyret.org/docs/latest/image.html#%28part._image_add-line%29

add-line :: ( img :: Image, x1 :: Number, y1 :: Number, x2 :: Number, y2 :: Number, color :: ImageColor ) -> Image Creates a new image like img with a line added starting from the point (x1,y1) and going to the point (x2,y2). Unlike scene-line, if the line passes outside of img, the image gets larger to accommodate the line.

Additionally, scene-line adds a small black border around the resultant image, which is not a stated feature of either scene-line, add-line, or crop.

blerner commented 5 months ago

Additionally, scene-line adds a small black border around the resultant image, which is not a stated feature of either scene-line, add-line, or crop.

This is not quite the right interpretation of what you're seeing. "Scenes" have borders around them, for example empty-scene(40, 20) produces image But you're right that the image in the docs doesn't show that border, for some reason. @schanzer @shriram we should harmonize these somewhat: when do we really want Scenes to have borders on them? We don't appear to be consistent about this at all.

As for the signature error, I'll push a fix in a moment.

schanzer commented 5 months ago

@blerner my understanding of empty-scene is that it always adds a border. So unless I've been using it incorrectly for the last 19 years, I think the image in the docs is just wrong!

blerner commented 5 months ago

Yes, but there are a bunch of calls to makeSceneImage with false for the border parameter. I.e. we make a bunch of "scenes" in the data sense but not in the scenic sense.