Stulish Active Member Licensed User Longtime User May 4, 2013 #1 Is there a way to load one PNG file over another. I have a PNG file called "block" and another called "S" What i want is the block to be the background and the S to be in the foreground as a kind of merged PNG. is this possible? Or will i have to have one image view on top of another with the 'block' image loaded in to the imageview at the rear and the 'S' image loaded into the foremost imageview? Thanks
Is there a way to load one PNG file over another. I have a PNG file called "block" and another called "S" What i want is the block to be the background and the S to be in the foreground as a kind of merged PNG. is this possible? Or will i have to have one image view on top of another with the 'block' image loaded in to the imageview at the rear and the 'S' image loaded into the foremost imageview? Thanks
klaus Expert Licensed User Longtime User May 4, 2013 #2 Yes, but you need to have the background color of the foreground image to be transparent otherwise the background image would be totally overwritten. You should draw both or at least the second one with a Canvas. Best regards. Upvote 0
Yes, but you need to have the background color of the foreground image to be transparent otherwise the background image would be totally overwritten. You should draw both or at least the second one with a Canvas. Best regards.
Stulish Active Member Licensed User Longtime User May 4, 2013 #3 the PNG backgrounds are transparent so should be ok. so would i have to initialize a Rect and then draw one bitmap onto the canvas and then the other and finally invalidate the imageview to get it to redraw? Something like: Code: Copy Dim cvs As Canvas,rd As Rect rd.Initialize(0,0,imageView1.Width,imageView1.Height) cvs.DrawBitmap(LoadBitmap(File.DirAssets, "block.png"),Null,rd) cvs.DrawBitmap(LoadBitmap(File.DirAssets, "s.png"),Null,rd) imageview1.Invalidate Im not on my B4A laptop at the moment so cant try it Thanks Stu Upvote 0
the PNG backgrounds are transparent so should be ok. so would i have to initialize a Rect and then draw one bitmap onto the canvas and then the other and finally invalidate the imageview to get it to redraw? Something like: Code: Copy Dim cvs As Canvas,rd As Rect rd.Initialize(0,0,imageView1.Width,imageView1.Height) cvs.DrawBitmap(LoadBitmap(File.DirAssets, "block.png"),Null,rd) cvs.DrawBitmap(LoadBitmap(File.DirAssets, "s.png"),Null,rd) imageview1.Invalidate Im not on my B4A laptop at the moment so cant try it Thanks Stu
klaus Expert Licensed User Longtime User May 4, 2013 #4 You need also to initialize the canvas. Code: Copy cvs.Initialize(imageView1) Best regards. Upvote 0
Stulish Active Member Licensed User Longtime User May 4, 2013 #5 Ah didn't think about that. Thanks, i will check it when i am back at my laptop :sign0060: Upvote 0