9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re:_[9fans]_libdraw_α_differences_between_plan_9__and_p9p
@ 2006-03-31 18:52 erik quanstrom
  2006-03-31 22:03 ` _[9fans]_libdraw_α_differences_between_plan_9__and_p9p andrey mirtchovski
  0 siblings, 1 reply; 5+ messages in thread
From: erik quanstrom @ 2006-03-31 18:52 UTC (permalink / raw)
  To: 9fans

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.
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: _[9fans]_libdraw_α_differences_between_plan_9__and_p9p
  2006-03-31 18:52 erik quanstrom
@ 2006-03-31 22:03 ` andrey mirtchovski
  2006-03-31 22:13   ` _[9fans]_libdraw_α_differ ences_between_plan_9__and_p9p Russ Cox
  0 siblings, 1 reply; 5+ messages in thread
From: andrey mirtchovski @ 2006-03-31 22:03 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

i hit that bug too when writing mahjongg (in drawterm, not in p9p). i
also didn't understand what was happening and simply did a workaround
(the -c argument, i believe) to force it in 32-bit mode...

you're not alone :)

On 3/31/06, erik quanstrom <quanstro@quanstro.net> wrote:
> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: _[9fans]_libdraw_α_differ ences_between_plan_9__and_p9p
  2006-03-31 22:03 ` _[9fans]_libdraw_α_differences_between_plan_9__and_p9p andrey mirtchovski
@ 2006-03-31 22:13   ` Russ Cox
  2006-03-31 23:06     ` quanstro
  0 siblings, 1 reply; 5+ messages in thread
From: Russ Cox @ 2006-03-31 22:13 UTC (permalink / raw)
  To: 9fans

>> 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

if a function call behaves differently between plan 9 and p9p
for no obvious & documented reason, that's always a bug.

the new drawterm works around this by turning off most of
the X optimizations.  i got tired of working around the early
OS X X server.

russ



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re:__[9fans]_libdraw_α_differ_ences_between_plan_9__and_p9p
  2006-03-31 23:06     ` quanstro
@ 2006-03-31 22:51       ` Charles Forsyth
  0 siblings, 0 replies; 5+ messages in thread
From: Charles Forsyth @ 2006-03-31 22:51 UTC (permalink / raw)
  To: 9fans

> i didn't have plan 9 at the time to compare.

there is no comparison



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re:__[9fans]_libdraw_α_differ_ences_between_plan_9__and_p9p
  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
  0 siblings, 1 reply; 5+ messages in thread
From: quanstro @ 2006-03-31 23:06 UTC (permalink / raw)
  To: 9fans

i didn't have plan 9 at the time to compare.

- erik

On Fri Mar 31 16:15:10 CST 2006, rsc@swtch.com wrote:
> >> 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
>
> if a function call behaves differently between plan 9 and p9p
> for no obvious & documented reason, that's always a bug.
>
> the new drawterm works around this by turning off most of
> the X optimizations.  i got tired of working around the early
> OS X X server.
>
> russ
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-03-31 23:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-31 18:52 erik quanstrom
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

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).