From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <68bce97ae7814385cce7ecbc3a87baa6@swtch.com> To: 9fans@cse.psu.edu Subject: =?utf-8?q?Re:_[9fans]_libdraw_=CE=B1_differences_between_plan_9__and_p9p?= From: "Russ Cox" Date: Fri, 31 Mar 2006 13:09:06 -0500 In-Reply-To: <58016f906ee4ee8db79b500cdecbe236@quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Topicbox-Message-UUID: 2a9b0042-ead1-11e9-9d60-3106f5b1d025 > i've noticed a difference in how the =CE=B1 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: >=20 > - selected =3D eallocimage(one, 1, RGBA32, setalpha(DPalebluegreen, 0x= 5f)); > + selected =3D eallocimage(one, 1, RGBA32, setalpha(DPalebluegreen, 0x= 9f)); >=20 > is a mapping needed to convert libdraw =CE=B1 values to X? This is the wrong question. The right question is why you=20 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=20 bug in the X wrappers around libdraw and is now fixed. Russ P.S. Upas/marshal encodes subjects "correctly" now too.