I stated in another post that WebView displays images of poor quality when the image is large.
The following code can view or a large picture (4975x600 pixels) or a small image (320x240 pixels).
Who will have the courtesy to try this code you will notice the difference in image quality is considerable.
My problem at this point is to give up a certain project in the code above is just a small part, or find, with your help, ways to improve the quality of the images displayed by WebView.
Add that the choice of WebView has been made taking into account that I have the need to:
1) navigate within the image (and Webview allows)
2) overlay image lines and labels (and I can do with HTML5).
Both things I've done, but I was disappointed in WebView.
Thanks in advance for your attention.
The following code can view or a large picture (4975x600 pixels) or a small image (320x240 pixels).
Who will have the courtesy to try this code you will notice the difference in image quality is considerable.
B4X:
Sub Process_Globals
End Sub
Sub Globals
Dim w As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim sb As StringBuilder
Dim h As String
Dim S As String
w.Initialize("W")
Activity.AddView(w, 0, 0 , 4975, 600)
sb.Initialize
sb.Append ("<HTML>")
sb.Append(CRLF)
sb.Append("<head>").Append (CRLF)
sb.Append("<script>").Append(CRLF)
sb.Append("window.onload = function(){").Append(CRLF)
sb.Append("var Canvas = document.getElementById('myCanvas');").Append(CRLF)
sb.Append("var context = Canvas.getContext('2d');").Append(CRLF)
'--- immagine
sb.Append("var imageObj = new Image();").Append(CRLF)
sb.Append("imageObj.onload = function(){").Append(CRLF)
sb.Append("context.drawImage(imageObj, 0, 0);").Append(CRLF)
sb.Append("}").Append(CRLF)
'================================
'--- large image ( 4975 x 600 pixel )
sb.Append("imageObj.src = '" & File.DirRootExternal & "/big.jpg" & "';").Append(CRLF)
'--- small image ( 320 x 240 pixel )
'sb.Append("imageObj.src = '" & File.DirRootExternal & "/small.jpg';").Append(CRLF)
'================================
sb.Append("};").Append(CRLF)
sb.Append("</script>").Append(CRLF)
sb.Append("</head>").Append(CRLF)
sb.Append(CRLF)
sb.Append ("<BODY>").Append(CRLF)
sb.Append("<Canvas id='myCanvas' width='4975' height='600'>").Append(CRLF)
sb.Append ("</Canvas>").Append(CRLF)
sb.Append ("</BODY></HTML>")
sb.Append(CRLF)
h=sb.ToString
w.LoadHtml(h)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
My problem at this point is to give up a certain project in the code above is just a small part, or find, with your help, ways to improve the quality of the images displayed by WebView.
Add that the choice of WebView has been made taking into account that I have the need to:
1) navigate within the image (and Webview allows)
2) overlay image lines and labels (and I can do with HTML5).
Both things I've done, but I was disappointed in WebView.
Thanks in advance for your attention.