I want to make smooth transparent sides like this:
There is the container (View) (blue border) that contains ScrollView. The container has the transparent gradient on both sides. How to implement that?
Related
When I use waifu2x model to scale an image with transparent pixels, the transparent black background seems to bleed into the image. Using bicubic interpolation also has this problem.
As specified in this blog, the transparent background can be filled with color as near as context as possible.
It's simple to find borders of such transparent borders. But is there any algorithm to generate such background?
I'm using a prefab for a box shape, which has a front and back plane.
My images are PNG and have transparent areas around the edge. I dragged the image onto my front plane, which now has a drop-down box for "Shader".
First I chose Shader: "Standard" but the transparent areas of my PNG image weren't transparent, so in order to fix that I changed it to "Sprites / Diffuse"... now the image looks fine (from the front).
However, when I rotate the shape, the image is also visible from the back. I want a way to not see the image / texture from the back.
How can I make the images only visible from the front side of a plane, whilst also preserving the transparency areas of the image / texture?
If you are using the standard built-in shader, you need to set the rendering mode to transparent in order for the texture's alpha channel to be transparent. The sprite shader, by default, forces the rendering of otherwise invisible back-faces, whereas the standard shader does not.
I have a container UIView that contains many columns/subviews.
I want to create a color fill animation on the container UIView, left to right as demonstrated on the image below, so it gradually changes the colors of only the subviews.
How to achieve this?
Im guessing i would have to create a mask and move it over this container UIView?
But then how to achieve that the mask only applies to the subviews?
EDIT:
this is a progress indicator for a playing audio file, so it needs to indicate the current time position precisely.
Also i must be able to have the shapes in different sizes as they represent audio waves
I would do it the opposite to the way you describe it. I would draw your audio wave shapes as a mask, thus revealing whatever is behind them. It is then trivial to position / animate a colored rectangle rightwards behind the mask to indicate the progress through the music:
In other words, the color is not an overlay but an underlay.
If I use a standard NSWindow to host a NSOpenGLView which extends for all the window frame, the two bottom corners of the window are automatically rounded.
When swithcing to NSBorderlessWindowMask I have to handle corner rounding myself.
I have already implemented a transparent custom NSWindow and a rounded custom NSView and they both work fine.
After that I have implemented a transparent NSOpenGLContext by setting NSOpenGLCPSurfaceOpacity to 0.
If I set a color background for the OpenGL context, the view is drawn correctly and I obtain the desired rounded corner.
But, since the app is a movie player, I need to draw the texture corresponding to every movie frame.
When I do this (using glTexCoord2f and glVertex2f) the texture is drawn till corners and therefore the image is drawn till outside of the rounded corners and I loose the rounded aspect of my window.
What does the system do when the window is standard and non NSBorderlessWindowMask that I can't seem to be able to reproduce?
What is the best way to round the corner of the texture while drawing it to the frame buffer?
You could apply the texture to a geometry with rounded corners, use an additional alpha mask on the movie texture with rounded corners, or use the stencil test to round off your viewport's corners.
In the background of my view, I draw a light blue color. And in the middle, i have a square box that is supposed to have an even lighter gray in it that has a 20% transparency. But for some reason the transparency is on top of a black background instead of a blue. I'm sorry If i'm not being clear.
You're probably using the wrong compositing mode to draw the smaller box. Show us your code.