BITCUT

Synopsis
BITCUT width height
Description

Cuts out part of the image and stores it in memory (or the clipboard, if BITINDEX is 0). Anytime later, you can use BITPASTE to "paste" it back into the image. FMSLogo cuts a rectangle starting at the turtle's position with a width of width pixels and a height of height pixels.

The rectangle that is cut is always taken horizontally and vertically, regardless of the turtle's heading.

BITCUT may appear to be off by 1 pixel in width and height when you use it, but it is not. This can be explained with an example. If you draw a square with REPEAT 4 [FORWARD 2 RIGHT 90], then the square is 3 pixels high, not 2. This is because of how FMSLogo draws images. In short, FMSLogo draws an imaginary line going down the center of each pixel. If a pixel is intersected (hit), then it is lit up. The distance from the center of the pixels representing the top of the square to the center of the pixels on the bottom of the square is 2 pixels. However, because FMSLogo can't turn on half a pixel, it turns on the entire pixel, which adds a half pixel to each side of the square, making the square 3x3 pixels in size. Bitmaps sizes are not taken from "center pixel to center pixel" like lines, they are whole pixel to whole pixel (inclusive).

Example
SETPENSIZE [2 2]
REPEAT 72 [CIRCLE2 100 SETPENCOLOR (LIST REPCOUNT*3 0 0) RIGHT 5]
PENUP
SETXY -50 -50
BITCUT 100 100
CLEARSCREEN
PENUP
REPEAT 36 [FORWARD 150 BITPASTE BACK 150 RIGHT 10]
See Also
SETBITINDEX

SourceForge.net Logo