9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] radar for plan 9, and two draw funnies.
Date: Sat, 12 Dec 2009 11:09:54 -0500	[thread overview]
Message-ID: <769f60484d9fa178a33b89972ecdf4bd@brasstown.quanstro.net> (raw)
In-Reply-To: <<dd6fe68a0912120745w38f491a5y65da039556f936ab@mail.gmail.com>>

i'm sure this could be smaller, but i've got to run.
the images are here: /n/sources/contrib/quanstro/drawfunny/images/

; 8.out <{jpg -t9 /lib/radar/*.jpg} <{gif -t9 /lib/radar/hw.gif} <{gif -t9 /lib/radar/radar.gif}|page

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

enum {
	CHAN	= RGBA32,
};

void
usage(void)
{
	fprint(2, "usage: composetst...\n");
	exits("usage");
}

Memimage*
newimage(int fd, ulong chan)
{
	Memimage *t, *im;

	im = readmemimage(fd);
	if(im == nil)
		sysfatal("readmemimage: %r");
	if(chan != 0){
		t = allocmemimage(im->r, chan);
		if(t == nil)
			sysfatal("readmemimage: %r");
		memfillcolor(t, DTransparent);
		memdraw(t, im->r, im, ZP, nil, ZP, SoverD);
		freememimage(im);
		im = t;
	}
	return im;
}

void
main(int argc, char **argv)
{
	int i, fd;
	Memimage *im, *scr;

	ARGBEGIN{
	default:
		usage();
	}ARGEND
	if(argc == 0)
		usage();
	memimageinit();
	fd = open(argv[0], OREAD);
	if(fd == -1)
		sysfatal("open: %r");
	scr = newimage(fd, CHAN);
	for(i = 1; i < argc; i++){
		fd = open(argv[i], OREAD);
		if(fd == -1)
			sysfatal("open: %r");
		im = newimage(fd, 0);
		memdraw(scr, scr->r, im, ZP, nil, ZP, SoverD);
		freememimage(im);
	}
	writememimage(1, scr);
	exits("");
}



       reply	other threads:[~2009-12-12 16:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<dd6fe68a0912120745w38f491a5y65da039556f936ab@mail.gmail.com>
2009-12-12 16:09 ` erik quanstrom [this message]
2009-12-12 18:57   ` Russ Cox
     [not found] <<20091212144519.GA2904@zoidberg.hsd1.mi.comcast.net>
2009-12-12 20:00 ` erik quanstrom
     [not found] <<dd6fe68a0912120655q18c8e3f3pd056284626b0ae4f@mail.gmail.com>
2009-12-12 15:25 ` erik quanstrom
2009-12-12 15:45   ` Russ Cox
2009-12-12  1:51 erik quanstrom
2009-12-12 14:45 ` Jacob Todd
2009-12-12 14:55 ` Russ Cox

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=769f60484d9fa178a33b89972ecdf4bd@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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).