9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Micah Stetson <micah@cnm-vra.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Pico (again)
Date: Thu, 18 Jul 2002 16:07:23 -0700	[thread overview]
Message-ID: <20020718160723.A3485@cnm-vra.com> (raw)
In-Reply-To: <20020718141436.3434B19A3E@mail.cse.psu.edu>; from anothy@cosym.net on Thu, Jul 18, 2002 at 10:14:21AM -0400

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

> common to most unix command line programs on Plan 9. i've not
> checked to see that it does sensable things with images, though,
> mainly because i don't know what to do with popi's output. 

Here is a program that takes popi's output and makes a plan9
image from it.  It isn't anything amazing, but maybe it will
save you a few seconds.

Micah


[-- Attachment #2.1: Type: text/plain, Size: 279 bytes --]

The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Type: text/x-csrc; charset=us-ascii
	Content-Disposition: attachment; filename="popi2image.c"

[-- Attachment #2.2: popi2image.c.suspect --]
[-- Type: application/octet-stream, Size: 586 bytes --]

#include <u.h>
#include <libc.h>
#include <draw.h>
#include <memdraw.h>

#define DEF_X	248	/* image width  */
#define DEF_Y	248	/* image height */

void
main(void)
{
	int i;
	uchar *pix;
	Memimage *img;

	memimageinit();

	pix = (uchar*)malloc(DEF_X * DEF_Y);

	for (i = 0; i < DEF_Y; i++)
		if(readn(0, pix+i*DEF_X, DEF_X) != DEF_X) {
			fprint(2, "popi2image: read error\n", i);
			exits("read");
		}

	img = allocmemimage(Rect(0,0,DEF_X,DEF_Y), GREY8);
	loadmemimage(img, Rect(0,0,DEF_X,DEF_Y), pix, DEF_X*DEF_Y);
	writememimage(1, img);

	exits(0);
}

  parent reply	other threads:[~2002-07-18 23:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-18 14:14 anothy
2002-07-18 18:07 ` Fariborz (Skip) Tavakkolian
2002-07-18 23:07 ` Micah Stetson [this message]
2002-07-29 15:57 ` Douglas A. Gwyn
  -- strict thread matches above, loose matches on Subject: below --
2002-07-26  6:03 Byron Rakitzis
2002-07-18 20:04 Dennis Ritchie
2002-07-19  8:19 ` ggm
2002-07-29 15:57 ` Douglas A. Gwyn
2002-07-18  8:53 steve.simon
2002-07-17 22:46 Sam
2002-07-18  0:28 ` Fariborz (Skip) Tavakkolian
2002-07-17 23:19   ` Sam
2002-07-18  0:35     ` Fariborz (Skip) Tavakkolian
2002-07-18  9:51   ` William Josephson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020718160723.A3485@cnm-vra.com \
    --to=micah@cnm-vra.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).