kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #28399
Re: [PATCH] Add WithAlpha method to COLOR4D
-
To:
<kicad-developers@xxxxxxxxxxxxxxxxxxx>
-
From:
Maciej Sumiński <maciej.suminski@xxxxxxx>
-
Date:
Thu, 2 Mar 2017 14:08:11 +0100
-
Authentication-results:
spf=pass (sender IP is 188.184.36.50) smtp.mailfrom=cern.ch; lists.launchpad.net; dkim=none (message not signed) header.d=none;lists.launchpad.net; dmarc=bestguesspass action=none header.from=cern.ch;
-
In-reply-to:
<CAG1r56+GeC9J1Fc-qrEtnTevh0Eu90-m-52XU9ndnmv=uuXDyg@mail.gmail.com>
-
Spamdiagnosticmetadata:
NSPM
-
Spamdiagnosticoutput:
1:99
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1
Hi John,
Thank you for the patch, I have just committed it.
Cheers,
Orson
On 03/02/2017 06:52 AM, John Beard wrote:
> Hi,
>
> Here's a patch to add a new method to COLOR4D: WithAlpha. This means
> you can do this:
>
> const COLOR4D color = getSomeColor(); //could be an argument or static const
>
> gal.SetStrokeColor( color.WithAlpha( 0.5 ) );
>
> Rather than:
>
> const COLOR4D color = getSomeColor(); //could be an argument or static const
>
> COLOR4D temp = color; //don't modify base color
> color.a = 0.5;
> gal.SetStrokeColor( temp );
>
> or the shorter but less readable:
>
> gal.SetStrokeColor( { color.r, color.g, color.b, 0.5 } );
>
> It also uses transparent sanity checking in debug builds.
>
> Cheers,
>
> John
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
Attachment:
signature.asc
Description: OpenPGP digital signature
References