From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Message-id: From: Pietro Gagliardi To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Wed, 11 Jun 2008 23:33:01 -0400 Subject: [9fans] First/second edition image manipulation tools Topicbox-Message-UUID: bb7a4db4-ead3-11e9-9d60-3106f5b1d025 Hello. My next experiment in learning libraries, as well as my next project, is a reimplementation of the first and second edition raster graphics manipulation tools. These use libmemdraw, which provides Memimage. Since I only have a working first edition manual, the program I will present shortly conforms to the first edition. NAME transpose - re-orient an image SYNOPSIS transpose [-vhadrlui] [-o 'x y'] [imgfile] DESCRIPTION transpose produces an image from another image by applying a transformation that satisfies the property of involution. The options are: -d Reflect image through descending axis (y=-x), the default -a Reflect image through ascending axis (y=x) -v Reflect image left-to-right through vertical center line (x=0) -h Reflect image top-to-bottom through horizontal center line (y=0) -r Rotates image right 90 degrees (clockwise) -l Rotates image left 90 degrees (counterclockwise) -u Rotates image upside down (180 degrees) -i Identity (for completeness) If the -o option is given, the new image has the upper-left coordinates given as an argument. Otherwise, the original upper-left coordinates are used. EXAMPLES Mirror image. transpose -v img > img2 Set the origin of an image to (0,0) without changing any pixels. transpose -i -o '0 0' img > img2 Involution exposition. transpose img | transpose > img2 BUGS The first edition specified the arguments to -o as two values - this cannot be done due to idiosyncrasies with args(2). What should I do to supply something like -o outfile? O(N^2) algorithms, even with -i - using -o makes the running time O(2(N^2)). You can find it in /n/sources/contrib/pietro/transpose.c. Pietro