Wrong ! https://www.b4x.com/android/forum/threads/b4x-bitmapcreator-draw-radial-gradients.92853/Am I correct in saying that drawing circles and ovals with a GRADIENT fill instead of a single color is currently impossible in B4A?
Sub Globals
Private GradientBrush As BCBrush
Private xui As XUI
Private ActivityBC As BitmapCreator
Private ImageView1 As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
'create the brush (create it once and reuse it when needed)
Dim bc As BitmapCreator
bc.Initialize(100dip, 100dip)
bc.FillGradient(Array As Int(xui.Color_Red, xui.Color_Blue), bc.TargetRect, "TL_BR")
GradientBrush = bc.CreateBrushFromBitmapCreator(bc)
'Create the bc that will be used for the drawings
ActivityBC.Initialize(100%x, 100%y)
End Sub
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
GradientBrush.SrcOffsetX = x - 50dip 'Need to set the brush offsets to make it start in the top left corner
GradientBrush.SrcOffsetY = y - 50dip
ActivityBC.DrawCircle2(X, Y, 50dip, GradientBrush, True, 0)
ActivityBC.SetBitmapToImageView(ActivityBC.Bitmap, ImageView1) 'ImageView1 covers the activity
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
ActivityBC.Initialize(100%x, 100%y)
GradientBrush = ActivityBC.CreateBrushFromBitmap(LoadBitmapResize(File.DirAssets, "10039.jpg", 100dip, 100dip, True))
End Sub
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
GradientBrush.SrcOffsetX = x - 50dip 'Need to set the brush offsets to make it start in the top left corner
GradientBrush.SrcOffsetY = y - 50dip
ActivityBC.DrawCircle2(X, Y, 50dip, GradientBrush, True, 0)
ActivityBC.SetBitmapToImageView(ActivityBC.Bitmap, ImageView1) 'ImageView1 covers the activity
End Sub
No. BitmapCreator doesn't support drawing ovals so you need to use B4XCanvas for this. If you only need to draw circles (or other supported shapes) then you don't need the canvas.Or am I missing something?