From: andrey mirtchovski <mirtchovski@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Porter-Duff alpha blending
Date: Wed, 4 Mar 2009 19:07:41 -0700 [thread overview]
Message-ID: <14ec7b180903041807q58ae6a8fh31350709edd0c0c@mail.gmail.com> (raw)
In-Reply-To: <14ec7b180903041729g772d2aa3sae266e08cbcfab89@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 448 bytes --]
just for fun, the attached file should run the whole gamut of
allocimage chan options in the 32-bit range (with RGB24 thrown in for
good measure) and will create files in /tmp for each possible
combination without involving drawing to the screen display (ideally
this should be done in memdraw, i suppose).
i think page will display them honestly, but i'm not sure. i'll leave
to you to convert the resulting images for outside viewing :)
[-- Attachment #2: t.c --]
[-- Type: text/plain, Size: 1374 bytes --]
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <cursor.h>
Image *col;
Image *back;
ulong types[] = {
RGBA32,
ARGB32,
XRGB32,
XBGR32,
RGB24,
};
char *descs[] = {
"rgba32",
"argb32",
"xrgb32",
"xbgr32",
"rgb24",
};
void
main(void) {
int fd, i, j, k;
char *str;
ulong type = RGBA32;
if(initdraw(nil, nil, "tri") < 0)
exits("initdraw");
for(j = 0; j < 5; j++) {
for(k = 0; k < 5; k++) {
str= smprint("/tmp/%s-over-%s.1", descs[k], descs[j]);
print("creating: %s\n", str);
back = allocimage(display, Rect(0, 0, 800, 300), types[j], 0, DBlack);
for(i = 0; i < 0xff; i++) {
col = allocimage(display, Rect(0,0,1,1), types[k], 1, setalpha(DWhite, 0xff-i));
draw(back, Rect(0,i,200,i+1), col, nil, ZP);
freeimage(col);
col = allocimage(display, Rect(0,0,1,1), types[k], 1, setalpha(DRed, 0xff-i));
draw(back, Rect(200,i,400,i+1), col, nil, ZP);
freeimage(col);
col = allocimage(display, Rect(0,0,1,1), types[k], 1, setalpha(DGreen, 0xff-i));
draw(back, Rect(400,i,600,i+1), col, nil, ZP);
freeimage(col);
col = allocimage(display, Rect(0,0,1,1), types[k], 1, setalpha(DBlue, 0xff-i));
draw(back, Rect(600,i,800,i+1), col, nil, ZP);
freeimage(col);
}
fd = create(str, OWRITE, 0664);
if(fd < 0)
sysfatal("create");
writeimage(fd, back, 0);
close(fd);
}
}
}
next prev parent reply other threads:[~2009-03-05 2:07 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-04 21:32 erik quanstrom
2009-03-04 21:37 ` andrey mirtchovski
2009-03-04 21:42 ` andrey mirtchovski
2009-03-04 21:44 ` erik quanstrom
2009-03-04 21:53 ` andrey mirtchovski
2009-03-04 22:03 ` erik quanstrom
2009-03-04 22:21 ` andrey mirtchovski
2009-03-04 22:22 ` Devon H. O'Dell
2009-03-04 22:45 ` andrey mirtchovski
2009-03-04 22:59 ` erik quanstrom
2009-03-04 23:05 ` andrey mirtchovski
2009-03-04 23:58 ` Charles Forsyth
2009-03-05 1:04 ` erik quanstrom
2009-03-05 1:29 ` andrey mirtchovski
2009-03-05 2:07 ` andrey mirtchovski [this message]
2009-03-05 2:22 ` erik quanstrom
2009-03-06 3:21 ` andrey mirtchovski
2009-03-06 20:48 ` Russ Cox
2009-03-06 21:42 ` andrey mirtchovski
2009-03-08 22:33 ` Jeff Sickel
2009-03-09 15:28 ` Michaelian Ennis
2009-03-09 16:40 ` Jeff Sickel
2009-03-09 14:00 ` erik quanstrom
2009-03-09 15:32 ` yy
2009-03-04 21:53 erik quanstrom
2009-03-04 22:01 ` andrey mirtchovski
2009-03-05 18:31 maht
2009-03-04 21:18 ` andrey mirtchovski
2009-03-04 23:24 ` 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=14ec7b180903041807q58ae6a8fh31350709edd0c0c@mail.gmail.com \
--to=mirtchovski@gmail.com \
--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).