############################################################################ # # File: mirror.icn # # Subject: Procedure to mirror tile # # Author: Ralph E. Griswold # # Date: November 15, 1997 # ############################################################################ # # This file is in the public domain. # ############################################################################ # # mirror(win) mirrors win using p2mm symmetry and returns the result as a # hidden window. # ############################################################################ # # Requires: Version 9 graphics # ############################################################################ # # Links: wopen # ############################################################################ link wopen procedure mirror(win, x, y, w, h) # mirror with p2mm symmetry local width, height, sym, x1, y1 /win := &window /x := 0 /y := 0 /w := WAttrib(win, "width") /h := WAttrib(win, "height") if w < 0 then { w := -w x -:= w } if h < 0 then { h := -h y -:= h } width := 2 * w height := 2 * h sym := WOpen("canvas=hidden", "size=" || width || "," || height) | fail CopyArea(win, sym, x, y, w, h) every x := 0 to w - 1 do CopyArea(sym, sym, x, 0, 1, h, width - x - 1, 0) every y := 0 to h - 1 do CopyArea(sym, sym, 0, y, width, 1, 0, height - y - 1) return sym end