B4J Question XUI, B4XBitmap and Pane

Star-Dust

Expert
Licensed User
Longtime User
I started trying the muio code XUi pe ril 3D with B4J.

Using the first part of the renderiung that deals with polygons uses B4XCanvas that works correctly.

A second part uses BitmapCreator. For B4A I used the last version but in B4J there is not yet.
At the end of the code I apply BitmapCreator in the Bread like this
B4X:
Pane.SetBitmap(BitmapCreator.Bitmap.Resize(Pane.Width,Pane.height,False))
In B4A it works while in B4J it generates me this error ...
 

Star-Dust

Expert
Licensed User
Longtime User
You're right Erel, I forgot that it should be used with ImageView. I had changed because I had difficulty between B4XCanvas with ImageView.

I'm continuing with B4XCanvas and BitmapCreator I use it with B4XCanvas this way:
B4X:
Dim Can as B4XCanvas
Dim Rec As B4XRect

Can.Initialize(Panel)
Rec.Initialize(0,0,Panel.Width,Panel.Height)
Can.DrawBitmap(BitmapCreator.Bitmap.Resize(Panel.Width,Panel.Height,False),Rec)
Can.Invalidate
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
True, the solution is slow. However, it is not known on the computer. Obviously I prefer a solution that goes well for Android/iOS/Windows.

Maybe implement DrawLine and DrawRec for BitmapCreator and so drank to use B4XCANVAS.

I always hope that in the next version of BitmapCreator there are already.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Everything you need is already available.

Don't draw on the pane directly.
Code to create B4XCanvas:
B4X:
Public Sub CreateCanvas (Width As Int, Height As Int) As B4XCanvas
   Dim p As B4XView = xui.CreatePanel("")
   p.SetLayoutAnimated(0, 0, 0, Width, Height)
   Dim cvs As B4XCanvas
   cvs.Initialize(p)
   Return cvs
End Sub

Use ImageView on all platforms.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Thank's. Good idea
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…