; MagnifyPixels - Show Pixels on the Graphics Canvas Blown Up ; ------------- ; Description of box of pixels to be magnified ; ; number of pixels per side, their length to boxSideLen output 70 end ; half length of side - with any fractional part removed to halfBoxSideLen output int quotient boxSideLen 2 end ; leftX, topY, width, height sentence describing the box to boxRectList output (sentence (minus halfBoxSideLen) halfBoxSideLen boxSideLen boxSideLen) end ; number of members (pixels) in the box to boxNumPix output product boxSideLen boxSideLen end ; the number of replicated pixels in each dimension for an original pixel to magnification output 4 end ; Magnified box stuff ; ; length of a side to bigBoxSideLen output product boxSideLen magnification end ; half length of side - with any fractional part removed to halfBigBoxSideLen output int quotient bigBoxSideLen 2 end ; output sentence of leftX, topY, width, height to bigBoxRectList output (sentence (minus halfBigBoxSideLen) halfBigBoxSideLen bigBoxSideLen bigBoxSideLen) end ; output the input number decremented by one to decr :num output difference :num 1 end ; output the input number incremented by one to incr :num output sum :num 1 end ; output new array composed of magnified pixels to getMagnifiedPixels :pixAry localmake "bigPixAry array (product bigBoxSideLen bigBoxSideLen) localmake "putIdx 1 repeat (sentence 1 boxNumPix boxSideLen) ~ [localmake "linePixIdx repcount ~ repeat magnification ~ [repeat (sentence :linePixIdx (sum :linePixIdx (decr boxSideLen))) ~ [localmake "pixel item repcount :pixAry ~ repeat magnification ~ [setitem :putIdx :bigPixAry :pixel make "putIdx incr :putIdx]]]] output :bigPixAry end ; MAIN ; ---- to main clean ;hideturtle loadpict "yoshiamon.bmp setpencolor 10 stamp wait 1000 localmake "pixels getpixels boxRectList setpixels bigBoxRectList (getMagnifiedPixels :pixels) end main