xinhu
November 24, 2010, 10:58am
1
Hi,
I want build a irregular window from the jpeg file ,which contains the mask color(#FF00FF ).
How to do this? I find all the api reference document, but sorry for nothing got.
The next is my picture, BackgroudC.jpeg, I wonder how to set the mask color for it?
[attachment=0]BackgroundC.jpeg[/attachment]
Thanks
Warren
jules
November 24, 2010, 11:19am
2
Convert it to a PNG with an alpha channel, and use that instead.
xinhu
November 24, 2010, 11:48am
3
:<, my god, there are many files needeb be converted. Tough task!!!
Dose the juce has such converting functionality? Maybe it needs the third party tool, e.g, photoshop?
Thanks jules for you so fast reply:)!!!
jules
November 24, 2010, 1:17pm
4
You could write a little routine to convert it in juce, but the reason why nobody uses mask colours any more is because they look crap, having only a 1-bit alpha. Ideally, you should get the original photoshop files, remove all the masking layers, and re-composite them properly, saving them with an 8-bit alpha channel.
sample
Image* imageMask;
imageMask=ImageFileFormat::loadFrom(File("image.jpg"));
for(int y=1; y<= imageMask->getHeight(); y++)
{
for(int x=1; x<= imageMask->getWidth(); x++)
{
if (imageMask->getPixelAt(x,y)==Colour(0xFF00FFFF))// 0xFF00FFFF--->color mask
{
imageMask->setPixelAt(x,y,Colour (0x00000000));
}
}
}
xinhu
November 25, 2010, 1:33am
6
Thanks very much. I think I will add a tiny routine to do it.
Thanks yosvaniscc. you sample seems even simple.