[9fans] First/second edition image manipulation tools - Plan9

This is a discussion on [9fans] First/second edition image manipulation tools - Plan9 ; 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 ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: [9fans] First/second edition image manipulation tools

  1. [9fans] First/second edition image manipulation tools

    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



  2. Re: [9fans] First/second edition image manipulation tools

    > 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



  3. Re: [9fans] First/second edition image manipulation tools

    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.



  4. Re: [9fans] First/second edition image manipulation tools

    > "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.



  5. Re: [9fans] First/second edition image manipulation tools

    > 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


+ Reply to Thread