I am using this function to create an image-gradient effect:
B4X:
public Sub SetGradientBackground(pnl As B4XView, Clrs() As Int, Orientation As String)
Dim bc As BitmapCreator
bc.Initialize(pnl.Width / xui.Scale, pnl.Height / xui.Scale)
bc.FillGradient(Clrs, bc.TargetRect, Orientation)
Dim iv As ImageView
iv.Initialize("")
Dim xiv As B4XView = iv
pnl.AddView(xiv, 0, 0, pnl.Width, pnl.Height)
xiv.SendToBack
bc.SetBitmapToImageView(bc.Bitmap, xiv)
End Sub
However, I end up getting this tearing effect on the gradient. I noticed that it doesn't use blending, is there any way to fix that?
This is the call:
CPF.SetGradientBackground(overlayPanel, Array As Int(0xddF1EAE7, 0x00BAB8BA), "TOP_BOTTOM")
It's more noticeable on the phone display, but it's ripping a bit from top to bottom. If you are looking at an LCD monitor, you can see it if you look from below the monitor.
I don't see a place, where do you stretch a bitmap from a jpg file. Meanwhile this is important.
Imagine that a panel has aspect ratio 2 : 1. A picture - 1,5 : 1. In this case will be 'white' zones from top and bottom.
If possible, try to set a background color for ImageView the same as a background color in jpg.
I don't see a place, where do you stretch a bitmap from a jpg file. Meanwhile this is important.
Imagine that a panel has aspect ratio 2 : 1. A picture - 1,5 : 1. In this case will be 'white' zones from top and bottom.
If possible, try to set a background color for ImageView the same as a background color in jpg.
I don't see a place, where do you stretch a bitmap from a jpg file. Meanwhile this is important.
Imagine that a panel has aspect ratio 2 : 1. A picture - 1,5 : 1. In this case will be 'white' zones from top and bottom.
If possible, try to set a background color for ImageView the same as a background color in jpg.
I tried your sample in iPhone 12 Simulator and did not notice serious troubles.
Like experiment, you can compare with native gradient. For example, create a new project. Add ImageView1 with your picture (set resize mode - Fill or make transparent png).
After Loadlayout add following call:
I tried your sample in iPhone 12 Simulator and did not notice serious troubles.
Like experiment, you can compare with native gradient. For example, create a new project. Add ImageView1 with your picture (set resize mode - Fill or make transparent png).
After Loadlayout add following call: