Transparant part of image show white

Robto

Member
Licensed User
Longtime User
Hi all,

This is my first try with b4a and I'm running into a little bit of cosmetic challenges. I have taken the RotatingNeedle package and altered the content.

First challenge:
- How do I get the other PNG to be recognized by the project so it can be called by Activity_Create? I created a new ImageView in Designer and added the new PNG as a quick workaround. I then removed that Imageview again. This works but what is the 'normal' way of doing this?

By the way that reminds me, why don't I see the Imageview in Designer when I open the RotatingNeedle package?

Second challenge:
- I created a new circle PNG with transparant sides, but when I run the package, the circle show up with white edges. Those edges are transparant so I probably messed up somewhere. I used the following code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim x, y As Float
   
   Activity.LoadLayout("Layout1")

   bmpCompass.Initialize(File.DirAssets,"CircleNova.png")
   
   Imageview1.Initialize("")
   Imageview1.Color=Colors.Transparent
   Imageview1.Bitmap = bmpCompass
   
   x = 200
   y = 200
   'Activity.AddView(Imageview1, 200, 200, bmpCompass.Width, bmpCompass.Height)
   Activity.AddView(Imageview1, 20, 20, x, y)
   
   csvCompass.Initialize(Imageview1)
   RectCompass.Initialize(0, 0, bmpCompass.Width, bmpCompass.Height)
   
   Timer1.Initialize("Timer1",200)
   Timer1_Tick
End Sub

Did I mess up with Gimp or with the code? :sign0104:
 

Robto

Member
Licensed User
Longtime User
Erel,

First of all my thanks for bringing basic to android. Once you get the hang of it, it really helps you get things done fairly quick. There is however one thing that I find really hard to grasp.

When I open the 'UserInterfaceMenu' project, the editor shows me the code of the modules etc etc, but apart from the fact that it initializes 3 pages, it doenst show anything about the properties of those pages.

So now I have to startup Designer to check the cosmetic properties. Why is this? Why doesn't the Designer just generate the code based on the specified settings? And why doesn't the designer, when I open the designer, take my specified value from the code in the properties of that module? :sign0163:

To me this feels like I'm working with two different tools whereas, to my opinion, it would work faster and cleaner when they intereact with the same piece of code. This would also deal with the concept of 'to initialize, or not to initialize'. But then there's always the possibility I'm not seeing the whole picture here :D
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I tried to have a look at your project but unfortunately you didn't follow Erels request.
You should export your project from the IDE menu Files / Export As Zip.
Your zip file contains only the b4a file but not the images nor the layout file.

Best regards.
 
Upvote 0

Robto

Member
Licensed User
Longtime User
Thank you Klaus. I did both actually. Maybe I have added the wrong file.
I have a zipped file, but it is too large to attach so I have used Dropbox but I cant post an URL...

Stuck :signOops:
 
Upvote 0

Robto

Member
Licensed User
Longtime User
Hi Klaus,

Yes I think so. I have been working on the problem and at one time I did manage to get two transparant circles. So I'm sure it is in my code. I also believe I initialize two imageviews(?) because I had two overlapping transparant images. I'm thinking about not using the Designer any more and just initialize via the code.

Is there a topic on the various members? (Objects?). Like what is a Canvas, Imageview, Button, Menu item, etc. I would really like to know the possibilities with members.

- Is a canvas an imageview?
- Can you rotate a canvas?
- Can you create round buttons?
- Can you rotate buttons?

Thank you
 
Upvote 0

Robto

Member
Licensed User
Longtime User
Hi Klaus,

Yes I think so. I have been working on the problem and at one time I did manage to get two transparant circles. So I'm sure it is in my code. I also believe I initialize two imageviews(?) because I had two overlapping transparant images. I'm thinking about not using the Designer any more and just initialize via the code.

Is there a topic on the various members? (Objects?). Like what is a Canvas, Imageview, Button, Menu item, etc. I would really like to know the possibilities with members.

- Is a canvas an imageview?
- Can you rotate a canvas?
- Can you create round buttons?
- Can you rotate buttons?

Thank you

Ok, there's lot of information about my questions in the Keywords_View.pdf. :sign0013:
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Is there a topic on the various members? (Objects?). Like what is a Canvas, Imageview, Button, Menu item, etc. I would really like to know the possibilities with members.
- Is a canvas an imageview? No, it's a drawing tool working on the bitmap you specify in the Initialize method.
- Can you rotate a canvas? No. But you can draw rotating bitmaps.
- Can you create round buttons? Yes, set the corner radius to half the with.
- Can you rotate buttons? Not directly with B4a. Perhaps there does exist any view rotation possibility in Android but I don't know.

Did you have a look at the Beginner's Guide ?

Best regards
 
Upvote 0

Robto

Member
Licensed User
Longtime User
Yes, after I posted the questions... I should RTFM before posting questions next time :)
Thank you for answering!
 
Upvote 0
Top