iOS Question Join 2 images

Graeme Mitchell

Member
Licensed User
The program takes 2 screenshots and I want to stitch them side by side and then email. I have the screenshot bit working and I can send the 2 screenshots as separate attachments but not 1.
 
Upvote 0

emexes

Expert
Licensed User
likewise: just because you think you can't figure out how to do it, doesn't mean you can't give it a go

experience is the best teacher

:)
 
Upvote 0

Graeme Mitchell

Member
Licensed User
Neither bitmap loads to the panel, just shows the outline of the panel

B4X:
Sub Process_Globals
 'These global variables will be declared once when the application starts.
 'Public variables can be accessed from all modules.
 Public App As Application
 Public NavControl As NavigationController
 Private Page1 As Page
 Private xui As XUI
 Private canvas As B4XCanvas
 Private pnl1 As B4XView
 Private bmp1rect As B4XRect
 Private bmp2rect As  B4XRect
 Private bmp1 As B4XBitmap
 Private bmp2 As B4XBitmap
End Sub

Private Sub Application_Start (Nav As NavigationController)
 'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
 NavControl = Nav
 Page1.Initialize("Page1")
 Page1.Title = "Page 1"
 Page1.RootPanel.Color = Colors.White
 NavControl.ShowPage(Page1)
 Page1.RootPanel.LoadLayout("Bitmap")
 
 canvas.Initialize(pnl1)
 bmp1= xui.LoadBitmap(File.DirAssets,"Shaelyn-Half-Field.png")
 bmp2=xui.LoadBitmap(File.DirAssets,"Shaelyn-Half.png")
 
 bmp1rect.Initialize(0,0,bmp1.Width,bmp1.Height)
 bmp2rect.Initialize(bmp1.Width,0,bmp2.Width,bmp2.Height)
 
 canvas.DrawBitmap(bmp1,bmp1rect)
 canvas.DrawBitmap(bmp2,bmp2rect)
 
End Sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You must call Canvas.Invalidate and you should also call Canvas.Release.

Note that the page size might not be set yet at that point.

You can add:
B4X:
Page1.RootPanel.LoadLayout("Bitmap")
If Page1.RootPanel.Width = 0 Then
 Wait For Page1_Resize (Width As Float, Height As Float) '<---
End If
 canvas.Initialize(pnl1)
 bmp1= xui.LoadBitmap(File.DirAssets,"Shaelyn-Half-Field.png")
 bmp2=xui.LoadBitmap(File.DirAssets,"Shaelyn-Half.png")
 
 bmp1rect.Initialize(0,0,bmp1.Width,bmp1.Height)
 bmp2rect.Initialize(bmp1.Width,0,bmp2.Width,bmp2.Height)
 
 canvas.DrawBitmap(bmp1,bmp1rect)
 canvas.DrawBitmap(bmp2,bmp2rect)
Canvas.Invalidate
 Dim bmp As B4XBitmap = Canvas.Bitmap
 Canvas.Release
 
Upvote 0
Top