schimanski Well-Known Member Licensed User Longtime User Dec 2, 2010 #1 I want to draw an rotating arrow on an imageview, like one of the first versions of GPS4ppc. My idea was to rotate the arrow as bitmap with drawBitmapRotated. The first problem is, that when i draw it on the activity, the arrow is under the imageview. When I draw it on the imageview, I get an error, that the bitmap is not mutable???? And last but not least, is it possible to get the borders of the rotating bitmap transparent? I don't know, if DrawBitmapRotated is the suitable for an rotating arrow. Thanks for answer..............
I want to draw an rotating arrow on an imageview, like one of the first versions of GPS4ppc. My idea was to rotate the arrow as bitmap with drawBitmapRotated. The first problem is, that when i draw it on the activity, the arrow is under the imageview. When I draw it on the imageview, I get an error, that the bitmap is not mutable???? And last but not least, is it possible to get the borders of the rotating bitmap transparent? I don't know, if DrawBitmapRotated is the suitable for an rotating arrow. Thanks for answer..............
Erel B4X founder Staff member Licensed User Longtime User Dec 2, 2010 #2 You can draw on an ImageView: Code: Copy ImageView1.Initialize("") ImageView1.Bitmap = LoadBitmap(File.DirAssets, "smiley.gif") Activity.AddView(ImageView1, 25%x, 25%y, 50%x, 50%y) Dim c As Canvas c.Initialize(ImageView1) c.DrawCircle(50dip, 50dip, 20dip, Colors.Red, True, 0) You can have two image views. One with the background and the other with the rotating arrow. Or you can redraw the background yourself like is done in the bouncing smiley example: http://www.b4x.com/forum/basic4andr...2-catch-bouncing-smiley.html?highlight=smiley Upvote 0
You can draw on an ImageView: Code: Copy ImageView1.Initialize("") ImageView1.Bitmap = LoadBitmap(File.DirAssets, "smiley.gif") Activity.AddView(ImageView1, 25%x, 25%y, 50%x, 50%y) Dim c As Canvas c.Initialize(ImageView1) c.DrawCircle(50dip, 50dip, 20dip, Colors.Red, True, 0) You can have two image views. One with the background and the other with the rotating arrow. Or you can redraw the background yourself like is done in the bouncing smiley example: http://www.b4x.com/forum/basic4andr...2-catch-bouncing-smiley.html?highlight=smiley
klaus Expert Licensed User Longtime User Dec 2, 2010 #3 Attached you find an example of a rotating needle or a rotating compass. The compass and needle are drawn directly onto the Activity. The surrounding pixels of the needle have bin set transparent in the png file. I have not yet tested Erel's proposal with an ImageView view. I had also some trouble trying to draw onto an ImageView. Best regards. Attachments DrawNeedle.zip DrawNeedle.zip 23.4 KB · Views: 1,635 DrawNeedle.jpg 22.3 KB · Views: 1,690 Upvote 0
Attached you find an example of a rotating needle or a rotating compass. The compass and needle are drawn directly onto the Activity. The surrounding pixels of the needle have bin set transparent in the png file. I have not yet tested Erel's proposal with an ImageView view. I had also some trouble trying to draw onto an ImageView. Best regards.
klaus Expert Licensed User Longtime User Dec 2, 2010 #4 Erel, I think that your code example is given for B4A version 1. I tried it, but get in line: Code: Copy [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]ImageView1.Bitmap = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]LoadBitmap[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]File[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2].DirAssets, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Compass.bmp"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT] the error: Compiling code. Error Error compiling program. Error description: Unknown member: bitmap Occurred on line: 37 ImageView1.Bitmap = LoadBitmap(File.DirAssets, "Compass.bmp") Word: bitmap Click to expand... Best regards. Upvote 0
Erel, I think that your code example is given for B4A version 1. I tried it, but get in line: Code: Copy [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]ImageView1.Bitmap = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]LoadBitmap[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]File[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2].DirAssets, [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Compass.bmp"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT] the error: Compiling code. Error Error compiling program. Error description: Unknown member: bitmap Occurred on line: 37 ImageView1.Bitmap = LoadBitmap(File.DirAssets, "Compass.bmp") Word: bitmap Click to expand... Best regards.
Erel B4X founder Staff member Licensed User Longtime User Dec 2, 2010 #5 Yes, I'm sorry for the confusion. Version 1 is planned to be released next week on Wednesday. The last couple tutorials will also not work with the beta version. Upvote 0
Yes, I'm sorry for the confusion. Version 1 is planned to be released next week on Wednesday. The last couple tutorials will also not work with the beta version.
schimanski Well-Known Member Licensed User Longtime User Dec 2, 2010 #6 Thanks Erel and Klaus!! That's what I'am looking for.... Upvote 0