9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@cse.psu.edu
Subject: Re:_[9fans]_libdraw_α_differences_between_plan_9__and_p9p
Date: Fri, 31 Mar 2006 12:52:29 -0600	[thread overview]
Message-ID: <abf8e6f5427d6bc2974cb58d3c7a9d3a@quanstro.net> (raw)

the answer is i didn't understand that there was a bug in the draw
library; i was not sure if there was a little hidden magic on plan9 that
made that work

- erik

On Fri Mar 31 12:09:26 CST 2006, rsc@swtch.com wrote:
> > 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.
> 


             reply	other threads:[~2006-03-31 18:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-31 18:52 erik quanstrom [this message]
2006-03-31 22:03 ` _[9fans]_libdraw_α_differences_between_plan_9__and_p9p andrey mirtchovski
2006-03-31 22:13   ` _[9fans]_libdraw_α_differ ences_between_plan_9__and_p9p Russ Cox
2006-03-31 23:06     ` quanstro
2006-03-31 22:51       ` Re:__[9fans]_libdraw_α_differ_ences_between_plan_9__and_p9p Charles Forsyth

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=abf8e6f5427d6bc2974cb58d3c7a9d3a@quanstro.net \
    --to=quanstro@quanstro.net \
    --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).