← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Add WithAlpha method to COLOR4D

 

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