B4A Library [B4X] [XUI] SD CreativeBackground

1606586088138.png
1606764752160.png


This new library is based on my latest work (here) of gradual backgrounds and @JordiCP 's code (here) that gave me permission to rework it and insert it in a custom view.

SD_CreativeBackground

Author:
Star-Dust
Version: 0.06
  • GradientBackground
    • Fields:
      • Fill_BL_TR As String
      • Fill_BOTTOM_TOP As String
      • Fill_BR_TL As String
      • Fill_LEFT_RIGHT As String
      • Fill_Radial As String
      • Fill_RIGHT_LEFT As String
      • Fill_TL_BR As String
      • Fill_TOP_BOTTOM As String
      • Fill_TR_BL As String
    • Functions:
      • Class_Globals As String
      • GenerateGradientRounded (Width As Int, Height As Int, TintColor As Int(), Fill As String, BorderColor As Int, BorderWidth As Float, CornerRadius As Float) As B4XBitmap
        es. GenerateGradientRounded(array as int(xui.Color_Black,xui.Color_White),ColorGradient.Fill_Radial,10Dip)
        Fill = RADIAL, TR_BL , TL_BR, BL_TR , BR_TL
        TOP_BOTTOM, BOTTOM_TOP, RIGHT_LEFT, LEFT_RIGHT
      • GradientToView (Vw As B4XView, TintColor As Int(), Fill As String, BorderColor As Int, BorderWidth As Float, CornerRadius As Float) As String
        "RADIAL", "TR_BL" , "TL_BR", "BL_TR" , "BR_TL", "TOP_BOTTOM", "BOTTOM_TOP", "RIGHT_LEFT", "LEFT_RIGHT"
        es. GradientToView(MyImageView,Array As Int(0xFF9F26E7,0xFFD287DA),"RADIAL",xui.Color_Black,0dip,20dip)
      • Initialize As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • PatternColor (PatternNumber As Int) As Int()
        PatternNumber (0..20)
        0 = lilla; 1 = rosa; 2 = red; 3 = blue; 4 = blue2; 5 = cyan; 6 = yellow
        7 = Green; 8 = Green2; 9 = Brown; 10 = Orange; 11 = none; 12 = Gold; 13 = Silver; 14 = Silver2
        15 = Elettro; 16 = none; 17 = bronze; 18 = Rainbow; 19 = Rainbow; 20 = diamond
  • NativeShadow
    • Functions:
      • Class_Globals As String
      • Initialize As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • NativeShadowToView (Vw As B4XView, ShadowsWidth As Float) As String
  • ShadowEffectBackground
    • Fields:
      • DarkFactor As Float
      • LightFactor As Float
      • softness As Int
      • TypeComics As String
      • TypeDaisy4 As String
      • TypeDaisy5 As String
      • TypeDaisy8 As String
      • TypeHeart As String
      • TypeHexagonShadow As String
      • TypeRect As String
    • Functions:
      • Class_Globals As String
      • EffectBackgroundToView (Vw As B4XView, Effect As String, InvertShadow As Boolean, Color As Int, DepthEdge As Int, cornerRadius As Int, Recursive As Int, AlternateShadow As Boolean) As String
        Parameter
        GenerateBackgound(View,Effect, InvertShadow, Color, DepthEdge, CornerRadius, Recursive, AlternateShadow, Rotate) As B4XBitmap
        Vw as view,
        Effect = Type of Effect,
        InvertShadow (Light Down, Dark Up)
        Color = Color of base
        DepthEdge = Depth of shadow
        CornerRadius = 0 for rectangle
        Recursive = Shadows one inside the other (For single shadowd set=1)
        AlternateShadow = If the recursive value is greater than 1 the invert shadows alternate
      • GenerateEffectBackground (Vw As B4XView, Effect As String, InvertShadow As Boolean, Color As Int, DepthEdge As Int, cornerRadius As Int, Recursive As Int, AlternateShadow As Boolean) As B4XBitmap
      • Initialize As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
  • sePoint
    • Fields:
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • X As Float
      • Y As Float
    • Functions:
      • Initialize
        Inizializza i campi al loro valore predefinito.
 

Attachments

  • SD_CreativeBackground 0.06.zip
    13.8 KB · Views: 214
  • jSD_CreativeBackground 0.06.zip
    15 KB · Views: 138
  • iSD_CreativeBackground 0.06.zip
    137.1 KB · Views: 131
  • B4A Sample.zip
    10.1 KB · Views: 155
  • B4J Sample.zip
    3.4 KB · Views: 127
  • B4i Sample.zip
    111.3 KB · Views: 110
Last edited:

Peter Meares

Member
Licensed User
Longtime User
Hi. This looks brilliant. Could I ask to get the the "groud " changed to "ground". There are a mixture of both words and it makes searching for the article tricky. Trivial issue and I love the effects.
 

Star-Dust

Expert
Licensed User
Longtime User
Sorry, a typo in writing the topic title
 

Star-Dust

Expert
Licensed User
Longtime User
Update rel 0.03
add 5 new effects in the ShadowEffectBackground class​
  • TypeComics
  • TypeDaisy4
  • TypeDaisy5
  • TypeDaisy8
  • TypeHeart
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
ezgif.com-optimize.gif

.

New example with animated effects
 

Attachments

  • B4J Sample 2.zip
    2.6 KB · Views: 323
Last edited:

Star-Dust

Expert
Licensed User
Longtime User

Peter Meares

Member
Licensed User
Longtime User
Not really fiar as my Itaian doe snot even run to "One beer please". :)
But possibly.

EffectBackroundToView maybe EffectBackgroundToView

TypeExagonShadow maybe TypeHexagonShadow

Two instances of:
  • IsInitialized As Boolean
    Verifica se l'oggetto sia stato inizializzato.
And this
DeptEdge = Dept of shadow
is probably
DepthEdge = Depth of shadow

Sorry. They are amazing and I couldn't think how to create them.
Thx
 

Star-Dust

Expert
Licensed User
Longtime User
You obviously didn't do a good job last time and you didn't report all the errors
  • IsInitialized As Boolean
    Verifica se l'oggetto sia stato inizializzato
To create the documentation I use a Java tool created by @Informatix (here). The message is produced in Italian because my IDE is in Italian. I have no intention of changing the settings of the IDE

B4X:
Sorry. They are amazing and I couldn't think how to create them.
Thx
On the other hand, you know English. Be satisfied
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Update 0.05
  • Added LightFactor and DarkFactor in ShadowEffectBackground. It allows you to establish the degree of intensity of the light / dark shade. Normally LightFactor=1.15 and DarkFactor =0.85

Update 0.06
  • Fix Bugs
  • Added help comments to choose the pattern
  • Added "Fill" field
    Sample
    Gradiend:
    Gb.GradientToView(MyView,Array As Int(0xFFAAAAAA,0xFF777777) ,Gb.Fill_BR_TL,xui.Color_White,0dip,15dip)
 
Last edited:
Top