Hi all,
in one of my libraries I wrote I've this line:
... where W and H are 200 pixels.
The image I process is a big horizontal stripped image of 20000x200 pixels where I just use a portion 200x200 on it, in the case of this line I've posted it just draw the first frame because the sourceX is zero, to show all frames I just increase the StartX every 200 pixels, so 200 show a second frame, 400 the third frame and so....
This always worked on old system with Win XP but still return a null pointer exception on a new system with Win 11.
In new system I compile with Java11, on old system I compile with Java8, maybe is this the problem ?
I even add #VirtualMachineArgs: -Xms256m -Xmx1024m so is not a memory Heap problem, the full image is 570Kb in jpg format or 2.8Mb in png format.
I tried to reproduce it with a small code and have the same issue, with smaller images (in pixels) works, with larger images (in pixels) does not works.
Is not a problem of image size in memory consume, it works with a 5.5Mb jpg file of 4250x3800 pixels, probably it do not like images with big width or height dimensions in this case 20000.
I cannot post the image because a upload limit and the smaller is 570Kb.
Please any advice to get it working is welcome......
Thanks!!!
Here the simple code I've used to reproduce it:
..... and here is the log with 20000x200 image:
in one of my libraries I wrote I've this line:
B4X:
cvs.DrawImage2(img, 0, 0, W, H, 0, 0, W, H)
The image I process is a big horizontal stripped image of 20000x200 pixels where I just use a portion 200x200 on it, in the case of this line I've posted it just draw the first frame because the sourceX is zero, to show all frames I just increase the StartX every 200 pixels, so 200 show a second frame, 400 the third frame and so....
This always worked on old system with Win XP but still return a null pointer exception on a new system with Win 11.
In new system I compile with Java11, on old system I compile with Java8, maybe is this the problem ?
I even add #VirtualMachineArgs: -Xms256m -Xmx1024m so is not a memory Heap problem, the full image is 570Kb in jpg format or 2.8Mb in png format.
I tried to reproduce it with a small code and have the same issue, with smaller images (in pixels) works, with larger images (in pixels) does not works.
Is not a problem of image size in memory consume, it works with a 5.5Mb jpg file of 4250x3800 pixels, probably it do not like images with big width or height dimensions in this case 20000.
I cannot post the image because a upload limit and the smaller is 570Kb.
Please any advice to get it working is welcome......
Thanks!!!
Here the simple code I've used to reproduce it:
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private Button1 As B4XView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
Dim cvs As Canvas
Dim img As Image
img.Initialize(File.DirAssets, "Speaker1.jpg")
Dim W As Int = 200
Dim H As Int = 200
cvs.Initialize("")
Form1.RootPane.AddNode(cvs, 0, 0, 500, 500)
cvs.DrawImage2(img, 0, 0, W, H, 0, 0, W, H)
End Sub
java.lang.NullPointerException
at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(NGCanvas.java:213)
at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.initCanvas(NGCanvas.java:641)
at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.renderContent(NGCanvas.java:604)
at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578)
at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
at javafx.graphics/com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:479)
at javafx.graphics/com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:328)
at javafx.graphics/com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at javafx.graphics/com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.NullPointerException
at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(NGCanvas.java:213)
at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.initCanvas(NGCanvas.java:641)
at javafx.graphics/com.sun.javafx.sg.prism.NGCanvas.renderContent(NGCanvas.java:604)
at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
at javafx.graphics/com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270)
at javafx.graphics/com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578)
at javafx.graphics/com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072)
at javafx.graphics/com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964)
at javafx.graphics/com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:479)
at javafx.graphics/com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:328)
at javafx.graphics/com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at javafx.graphics/com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
at java.base/java.lang.Thread.run(Thread.java:834)
Last edited: