Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha channel on fill colours? #201

Closed
Dayjo opened this issue Mar 15, 2016 · 4 comments
Closed

Alpha channel on fill colours? #201

Dayjo opened this issue Mar 15, 2016 · 4 comments

Comments

@Dayjo
Copy link

Dayjo commented Mar 15, 2016

Hello!

Just saw #199 but as it has no content, plus it contains multiple issues, I thought I'd write this up.

I'm very new to this library, but it seems great and mostly covers everything I need. However, I'm trying to add transparency to fill colour. Looking at the code, it seems like it's using ARGB (and in the Color class handles ARGB channels), however in the saved out presentation, it seems to always use a 100% alpha channel.

Taking the Linear gradient example from the samples directory the following code makes the background a gradient;

$shape->getFill()->setFillType(Fill::FILL_GRADIENT_LINEAR)->setRotation(90)->setStartColor(new Color( 'FF4672A8' ))->setEndColor(new Color( 'FF000000' ));

I assumed by changing the prefixing FF (alpha channel) that this would just work but it appears not. Is there anything special needed to get Alpha transparency to work?

Thanks for all your hard work!

@Dayjo
Copy link
Author

Dayjo commented Mar 15, 2016

Looking deeper into the code (though I don't really have the time right now), looks like this shouldn't be too difficult to implement (given the documentation of OOXML is reasonable :/). I may put together a pull request once I've gone through the contributing notes.

@Dayjo
Copy link
Author

Dayjo commented Mar 15, 2016

Ok, I've given this a go following the documentation but to no avail.

I figured that it would just be a matter of adding the alpha element to the srgbClr element as per;

<a:srgbClr val="4672A8">
    <a:alpha val="1"/>
</a:srgbClr>

But when opening in Keynote and Google Slides (ironically, I don't have PowerPoint), whatever I put in the value of the alpha element, it ends up with an alpha value of 0. Perhaps I'm missing something?


Edit: Looks like values need to be * 1000. Pull request on it's way :)

@Progi1984
Copy link
Member

@Dayjo I just add some improvements (and some code deduplications) ;).

@Progi1984
Copy link
Member

Merged in develop branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants