Animating UIButton alpha with a PNG background: why does the animation get bright white as it transitions from alpha = 0 to alpha = 1? - ios4

This is something that is stumping me; I have a simple UIButton with the following PNG as it's background:
I'm using an iOS 4 block animation, and all I'm doing is animating it's alpha property from 0.0 to 1.0. However, while the animation is in progress, the UIButton gets bright white, before finally settling to look like the above image when the property reaches 1.0.
I'm pretty stumped - if, for example, I open that image in Paint.NET and slide the image's opacity from 0 to 255, I see a nice fade-in effect - which is exactly what I'm going for. But when I animate an opacity change in iOS, the button gets bright white during the middle part of the animation.
If I change the animation's duration to something extended, like 5 seconds, the effect is even more prominent. Any ideas?
Edit: I am using Xcode 4.1, and running iOS 4.3.3 (first gen iPad).

It turns out, after much consideration, that the issue was my UIButton was a Round Rect button; the type needed to be changed to Custom. Even though the background images I set for my button worked when the type was Round Rect, applying an alpha animation to the button still caused the default white Round Rect style to appear for the duration of the animation. That is what my eyes interpreted as "bright white" during the animation - it had nothing to do with my PNG background, and everything to do with the underlying type of the button I was using.
Problem solved. Moral of the story? Change your UIButton type to Custom if you're going to animate the button while using your own background images.

Related

mlt double tent fade in and fade out

Yesterday I saw the wonderfull screen transition effect of a samsung smartphone, where the fade out and fade in was not just all screen getting black and coming back, butthe black color is arriving troug h2 lateral "tents" that arriving are making the screen black and the opposite. How to do it with melt?
PS.
the tents are blur and not just black blocks coming to blacking all the screen.
MLT has a transitions module named "luma" that takes a grayscale image to define the reveal of the second image or clip. There are some examples in this video.
Most of those examples are hard edge, but there is also a softness parameter. As for the blur, you can attach a blur filter to either clips and/or the transition as well. In addition, the blurriness parameter can be animated over time.

Aliasing in Qt Items?

How come this happens to my QPixmap painted in a QGraphicsView?
It has 0.8 opacity added by code.
It´s a PNG image. The original looks like this:
I see this kind of strange flickering that stays the same depending on the height of the QMainWindow. When i resize it, some of the pixmaps get disorted.

webgl: white border when using transparency (alpha)

When rendering textures that have an alpha-channel, a white border appears around the non-transparent part (the border seems to be the pixels that have an alpha > 0 and < 1):
The original texture is created in illustrator and exported as a png. here it is:
(well, seems stackoverflow altered the image, adjusting pixels that are not completely opaque/transparent, so here is a link)
it is probably the blending, though i dont know what is wrong with the setup:
gl.enable(gl.BLEND);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
[Update]
Here is a rendered version, where i added a alpha-gradient to the left part of the texture (so it is getting from 0 opacity to 1 until the half)
this texture is the only texture rendered at this position. it seems to be whitest around a=0.5. really weird. the background is just a cleared color:
gl.clearColor(0.603, 0.76, 0.804, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
// render objects here
the depth-function looks like:
gl.enable(gl.DEPTH_TEST);
gl.depthFunc(gl.LEQUAL);
any ideas? thanks a lot.
[Update 2]
Answering my own question: the effect occurs when the background-color of the canvas or the body of the html-page is white. I don't have an explanation, though.
Use premultiplied alpha and this problem will go away.
See: http://home.comcast.net/~tom_forsyth/blog.wiki.html#%5B%5BPremultiplied%20alpha%5D%5D
This is problem related to texturing linear interpolation. On borders, some interpolated pixels will take half white half green, and 0.5 alpha. You should modify your texture to extend your borders with one more green pixel, even if it is totally transparent.
What's your draw order? This looks like a depth buffering issue to me — you start with a white background, draw the thing with the border so that it's composited on the white, then draw the thing behind the thing with the border. Those areas where the border was blended with the original white background will have stored a value in the depth buffer equal to the depth of their plane, so when the object behind is subsequently drawn, its pixels are discarded in that area.
The general rule is to draw transparent objects after opaque objects, usually from back to front. If you're using additive blending then it's often good enough to disable the depth buffer after the opaque draw and draw them in any order.
When setting the FragColor in the shader, try multiplying the image RGB with the image alpha.

Transparency problem with gradient - Label in a Panel on a UserControl, ultimately displayed on parent Form

I know this has been asked many times, but not quite the way I'm trying to solve it.
I have Labels in a Panel on a UserControl, and the UserControl goes onto a form.
The Label.BackColor = Transparent.
The panel is from DevExpress, and I've set a gradient background.
Problem: The Labels aren't transparent; they each show as a white solid rectangle around the text. (I presume the white comes from the Panel, as the first of the two gradient colors is White.)
Everything I google about this problem says I need to roll my own Label control and fire off peculiar GDI+ commands, and Invalidate the control, and hook the Paint event and sing a stirring sea shanty and hold one foot above my head and...
Really? Doesn't the Label allow ".BackColor=Transparent" ? Why doesn't that work?
And what's the best way through this?
Somehow it turns out I never tried making the Label backgrounds transparent.
I am not a proud.

Round Rect Button behavior when using a flipview controller

Hia.
I am using some round rect buttons with own images for their states. Each time am displaying a different view for some stuff, the buttons become white and my images are fading in briefly later.
The problem occurs only with the UIModalTransitionStyleCrossDissolve animation.
The other 3, UIModalTransitionStyleCoverVertical, UIModalTransitionStyleFlipHorizontal and UIModalTransitionStylePartialCurl, don't show this effect.
The effect would be ok, ok if the starting color would be black. I didn't find any way to change that color in IB. Where does it come from? Any idea?
Tried to set the background over the inherited properties of UIImage, but he simply ignored it. Switching the Round rect button to a custom one solved it. Leaves the question what to do if I want a round rect. A black background image didn't help. He seems to use the background color to fade.

Resources