Binary Builder adds Transparency to png


#1

Hi all,

Im new to Juce and just trying to develop my first plugin. I managed to answer all my questions by lurking this board but there is one thing I dont understand:

I had a png for a rotary slider and converted it with the Binary Builder.
Everything went fine so far.

But when it gets displayed its half-transparent. The brighter the pixel, the more transparency it gets.
Maybe there is a problem with pngs that already have transparent background?
Do I need to tell the Binary Builder that my png actually has an alpha channel?

Here is how I draw my Image in the code:

AffineTransform rotator; Image knobNormal = ImageCache::getFromMemory (binaryKnob::knob_png, binaryKnob::knob_pngSize); g.drawImageTransformed (knobNormal, rotator.rotated(angle,73,73).scaled(width*0.005,height*0.005), false);

And here is my test knob png:

I hope you can help me with this one.
Keep up the good work

edit: Oh and there is one more thing but I hope this is an easy one… when using “drawImageTransformed” - is there any way to tell the graphics object WHERE to draw the image (e.g. with x and y offset)? …I tried drawImage() and after that add Transform() but that includes the other elements that i dont want to transform…


#2

BinaryBuilder just stores the file’s contents - it doesn’t change it in any way at all!

Maybe before you draw it you should call Graphics::setOpacity (1.0f)?

Well that’s what the transform is there for! You can translate a transform in any way you like.


#3

My bad - it was just that the graphics painted the additional elements after painting the knob so they were above it and only visible in the non-black areas.

and the AffineTransform with offset work via the pivot coordinates in the scaling methods (wich is a bit tricky but it works)…

Thank you very much
Best regards