9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] First/second edition image manipulation tools
@ 2008-06-12  3:33 Pietro Gagliardi
  2008-06-12  3:46 ` Russ Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Pietro Gagliardi @ 2008-06-12  3:33 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] First/second edition image manipulation tools
  2008-06-12  3:33 [9fans] First/second edition image manipulation tools Pietro Gagliardi
@ 2008-06-12  3:46 ` Russ Cox
  2008-06-12  3:57   ` Pietro Gagliardi
  0 siblings, 1 reply; 5+ messages in thread
From: Russ Cox @ 2008-06-12  3:46 UTC (permalink / raw)
  To: 9fans

> 	The first edition specified the arguments to -o as two values - this cannot be done
> 	due to idiosyncrasies with args(2).

case 'o':
	arg1 = EARGF(usage());
	arg2 = EARGF(usage());
	break;

russ



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] First/second edition image manipulation tools
  2008-06-12  3:46 ` Russ Cox
@ 2008-06-12  3:57   ` Pietro Gagliardi
  2008-06-12  8:24     ` Charles Forsyth
  2008-06-12 14:29     ` Russ Cox
  0 siblings, 2 replies; 5+ messages in thread
From: Pietro Gagliardi @ 2008-06-12  3:57 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Jun 11, 2008, at 11:46 PM, Russ Cox wrote:

>> 	The first edition specified the arguments to -o as two values -
>> this cannot be done
>> 	due to idiosyncrasies with args(2).
>
> case 'o':
> 	arg1 = EARGF(usage());
> 	arg2 = EARGF(usage());
> 	break;
>
> russ
>
>

According to arg(2), that's not a good idea.
	"ARGF must be called just once for each option that takes an argument."
See if your code works.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] First/second edition image manipulation tools
  2008-06-12  3:57   ` Pietro Gagliardi
@ 2008-06-12  8:24     ` Charles Forsyth
  2008-06-12 14:29     ` Russ Cox
  1 sibling, 0 replies; 5+ messages in thread
From: Charles Forsyth @ 2008-06-12  8:24 UTC (permalink / raw)
  To: 9fans

> 	"ARGF must be called just once for each option that takes an argument."

that means you cannot get the same argument (parameter value) twice,
so you'd better save it if you need it.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] First/second edition image manipulation tools
  2008-06-12  3:57   ` Pietro Gagliardi
  2008-06-12  8:24     ` Charles Forsyth
@ 2008-06-12 14:29     ` Russ Cox
  1 sibling, 0 replies; 5+ messages in thread
From: Russ Cox @ 2008-06-12 14:29 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> According to arg(2), that's not a good idea.
>        "ARGF must be called just once for each option that takes an
> argument."

Who are you going to believe?  Me or that lying man page?

> See if your code works.

I'm not your code monkey.  You mentioned that you
didn't know how to do something; I pointed out how.
If you are skeptical about my suggestion, why not
give me the benefit of the doubt, at least for a minute,
and try it yourself?  (It was two lines of code!)

Your posts often feel like knee-jerk responses.
This is a mailing list, and it goes to a lot of people.
Instead of replying immediately, you might consider
putting in a few extra minutes of work to gather and
include actual technical content.  For example, you could
try the code I posted and say "that doesn't work for me",
posting a tiny sample program and its output.
Or you could try it, find that it *does* work, and say
something like "Apparently that does work,
but I'm worried about this line in the man page."

Telling me to try it, when you're the one who actually
has a use for the code, is just the pinnacle of laziness.

Russ


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-06-12 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-12  3:33 [9fans] First/second edition image manipulation tools Pietro Gagliardi
2008-06-12  3:46 ` Russ Cox
2008-06-12  3:57   ` Pietro Gagliardi
2008-06-12  8:24     ` Charles Forsyth
2008-06-12 14:29     ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).