* [9fans] libdraw α differences between plan 9 and p9p
@ 2006-03-31 17:16 erik quanstrom
2006-03-31 18:09 ` Russ Cox
0 siblings, 1 reply; 2+ messages in thread
From: erik quanstrom @ 2006-03-31 17:16 UTC (permalink / raw)
To: 9fans
i've noticed a difference in how the α channel looks in p9p vs.
plan 9. for example when porting mahjongg to plan9port,
i need to make this change to make the selection highlighting
apparent:
/sys/src/games/mahjongg//mahjongg.c:75,81 - ./mahjongg.c:75,81
{
Rectangle one = Rect(0, 0, 1, 1);
- selected = eallocimage(one, 1, RGBA32, setalpha(DPalebluegreen, 0x5f));
+ selected = eallocimage(one, 1, RGBA32, setalpha(DPalebluegreen, 0x9f));
is a mapping needed to convert libdraw α values to X?
- erik
p.s. p9p mahjongg is on sources but it's missing the tile sets and lib configuration.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9fans] libdraw α differences between plan 9 and p9p
2006-03-31 17:16 [9fans] libdraw α differences between plan 9 and p9p erik quanstrom
@ 2006-03-31 18:09 ` Russ Cox
0 siblings, 0 replies; 2+ messages in thread
From: Russ Cox @ 2006-03-31 18:09 UTC (permalink / raw)
To: 9fans
> i've noticed a difference in how the α channel looks in p9p vs.
> plan 9. for example when porting mahjongg to plan9port,
> i need to make this change to make the selection highlighting
> apparent:
>
> - selected = eallocimage(one, 1, RGBA32, setalpha(DPalebluegreen, 0x5f));
> + selected = eallocimage(one, 1, RGBA32, setalpha(DPalebluegreen, 0x9f));
>
> is a mapping needed to convert libdraw α values to X?
This is the wrong question. The right question is why you
changed this line:
if(level.board[d][x][y].clicked)
- draw(img, r, selected, nil, ZP);
+ draw(img, r, selected, selected, ZP);
Since you're drawing selected through itself, you're effectively
squaring the alpha, and (0x9F^2)/255 is approximately 0x5F, so
this change necessitates the first one.
I see why you changed the draw call, though, since on X, it
just ignored the alpha channel in selected and just draws
a big solid-color rectangle over the tile. This was due to a
bug in the X wrappers around libdraw and is now fixed.
Russ
P.S. Upas/marshal encodes subjects "correctly" now too.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-03-31 18:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-31 17:16 [9fans] libdraw α differences between plan 9 and p9p erik quanstrom
2006-03-31 18:09 ` 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).