iOS: how to add alpha to three layers of background - ios

I want something like this:
There are three layers of view, first is the background.
Then there is an alpha layer,
and another alpha layer contains "SAVE LOAD"
My question is how to set the alpha value and background color for the top 2 views so that it can display this desired layering. Many thanks!

From my point of view, it looks like
50% alpha on black
100% alpha on dark green
Yet, your designer might be a better fit to ask.
Edit:
You might have to play with the alpha on the black a little to get a good match without detailed information from your designer. As to the dark green, I cannot see any transparency, so I'd just go for opague to keep the alpha parts low for the graphics engine.

Related

How do I set tint color only for non white parts of the UIImage?

Simple I have UIImageView icon with two people and it looks like this:
but when I set tintColor to red it looks like this:
Is there any way to avoid covering every non zero-alpha pixel? I need to show the tie really there. One time I need people red, other time green.
The icon is simple png file. Rounded circle is simple background color of UIImageView. So the part of the image with tie cannot be zero-alpha.
Is there any way to achieve such effect WITHOUT creating images for every color?
This was similar to another idea I had been playing around with, so I did a little more fiddling...
Starting with these 3 images:
and then using them as .withRenderingMode(.alwaysTemplate) to give the desired colors... and then layering them via CALayer to get:
and an "exploded" view for clarity...
Create an image where the "people" are 100% transparent - effectively "holes" in the image.
Set the background color of the UIImageView to be the "fill" color.
You can still mask it with a circle (CAShapeLayer, for example), if you don't want a white bounding-box as part of the image.
Original images:
https://i.stack.imgur.com/eFrmB.png
https://i.stack.imgur.com/2GNDX.png
Use the CISpotColor filter:
https://developer.apple.com/library/content/documentation/GraphicsImaging/Reference/CoreImageFilterReference/#//apple_ref/doc/filter/ci/CISpotColor
This allows you to specify a color in your image that is to be changed into another color. Thus, since you know the original color of the tie and the background, you can change either of them, or both, in a single move.

CGColor - Determining the blended color from two UIViews that are on top of each other

I am trying to obtain the resultant CGColor (or UIColor) that would be displayed as a result of two (or perhaps more) views that are sat on top of each other each with differing colours. Obviously the view(s) nearer the foreground have an alpha value of less than 1, allowing the colour of views behind to bleed through.
Essentially, I guess I'm trying to mimic exactly what the UIView compositing process does exactly when it prepares for the painting of a scene.
NB. I'd like to steer away from a manual programmatic blend algorithm as will likely not be the same as the Cocoa blend mechanism.
I have just found this... Can I mix two UIColor together? but thought there must be an iOS/Cocoa equivalent
Heres a tutorial-ish thing:
Blending Modes in iOS
And here is the Apple Documentation that covers blend modes. Should get you on the right track. The exact formulas are shown for each blend mode option.
Finally, see this answer:
How to get the color of a displayed pixel

Is Core Animation color blended layers useful or say is it necessary?

Color Blended Layers
Open Instruments and choose the Core Animation template located under iOS / Graphics. First, click in the Core Animation instrument's timeline to reveal the bottom pane and find the section labeled "Debug Options". Check the "Color Blended Layers" box, which will show a red overlay over layers that were blended and a green overlay over layers drawn without blending.
Is Core Animation color blended layers useful or say is it necessary?
I found that the system UI is red blended yet.
And my app is also red blended in some areas.
what should I do?
Thanks in advance.
Yeah, It's necessary to fix the blended layers,
For example: you background have a white color and you add a label in the view .and set background color clear color. This will make your layer blended.
But this is unnecessary to calculate .
If you set your label color same as your view.
scrolling performance will improve a lot.
You can feel it.
Via apple developer:
Color Blended Layers. Shows blended view layers. Multiple view layers that are drawn on top of each other with blending enabled are highlighted in red. Reducing the amount of red in your app when this option is selected can dramatically improve your apps performance. Blended view layers are often the cause for slow table scrolling.
It's all about the performance of your UI rendering, if you will work with opaque option (or property) and all your layers will be green, your rendering will be super fast.
Good luck.
Red color in Color Blended Layers says that you should take additional look at this view and if possible optimise a layer to minimize effort to calculate result view
[iOS debug rendering]

how to fill solid color into the shape of a transparent PNG file with actionscript3?

For example, I have a transparent png file, the shape is a car.
In the png file, I only draw the white border shape.
Outside and inside the border are all transparent.
I want to use actionscript3 code to show the car object with different color, it means only fill color inside the border, and for the outside of the border, keep transparent.
How to do that?
So far, the simplest workaround is to prepare many images with PhotoShop, but it's not good enough for me. When I have many shapes and use many colors, I've to prepare many many images.
Add more details:
(Because I'm using white border, you may not see the basic png file if your background of browser is white)
Change my boarder of shape to black, hope this is helpful to understand my question.
Since you're working with loaded images/pixels you can make use of BitmapData's floodFill() which pretty much does what you need. There's an example in bellow the method description as well.
It does pretty much what you need, although in some cases it might not be perfect. It's worth having a look at Jan's optimizing the floodFill() method article which goes more in depth.
A simple solution is to use multiple layers. The top layer would contain just the border. The lower layer would contain just the car with no border. You can adjust the colour of the car layer using a ColorTransform or ColorMatrixFilter.

Truly transparent gradient possible in Fireworks CS5?

Does anyone know if it's possible to have a gradient created using Fireworks to be really transparent at the bottom?
I'm trying to create a gradient which is truly transparent at the bottom, so it can be placed on top of another image. As far as I'm aware, even though the opacity of the bottom is 0, I still have to select a color for the bottom. This makes the top color blend into it (like below it's blending into white). So whenever the image is placed over a dark image the bottom is transparent but still white.
Hope that makes sense. Thanks for the help.
I usually achieve this effect by setting both color endpoints of the gradient to the same color, then adjusting the opacity endpoint to 0% (or whatever you want).
Here's the result: This is #666/100% to #666/0% on the left, #666/100% to white/0% on the right.
I was having the same problem you should try working with auto vector masks
Command>Creative>Auto Vector Mask
Great little tutorial here
http://www.communitymx.com/content/article.cfm?cid=b5f64
How are you defining "really transparent"?
You must choose a linear gradient, then a colour at each end of the gradient, and then make one end opacity 0%. It doesn't matter if it is a colour or not, you make it invisible anyway.
If you are comparing it to something like Photoshop or Illustrator, yes it's annoying that Adobe cannot be consistent with how each application handles opacity, but in Fireworks, it's still the same effect, just a different method of doing it.

Resources