Page 1 of 1

Test Chart

Posted: Sun Sep 24, 2017 9:05 pm
by rbytes
This chart program shows the effect of the #.point() command, which was perfected in version 20.

The only change needed to produce the second chart is to uncomment the first line of code! The lower resolution chart is showing the SPL default resolution, which can also be initiated by #.point(#.dip) Device independent points will typically be larger than pixels.
As soon as you uncomment the line #.point(#.pix), the chart code can access all of the screen pixels. In the case of my CHUWI Hi10 tablet, it makes a huge difference.

Code: Select all

''
Screen Test Chart by rbytes
September 2017
''

' comment out the point command for #.dip (device independent points) which gives lower screen resolution.
' uncomment the point command for #.pix (pixels) which gives higher screen resolution.
'#.point(#.pix)
x,y = #.scrsize()
y = #.int(y)
#.scrview(#.normal)

' draw label
#.drawtext(x*.45,y*.45,"Screen Test Chart")
#.drawtext(x*.44,y*.49,"Created on CHUWI Hi10")
? #.scrdpi() = 144, #.drawtext(x*.435,y*.53,"Displayed on CHUWI Hi10")

' draw vertical lines at 100-point intervals
> n, 1..x, 100
  #.drawline(n-1,1,n-1,y)
  #.drawtext(n-50,2,n-1)
<

' draw borizontal lines at 100-point intervals
> n, 1..y, 100
  #.drawline(1,n,x,n)
  #.drawtext(50,n-28,n-1)
<
#.drawline(1,1,1,y-1)           ' draw left edge     
#.drawline(x,1,x,y)             ' draw right edge
#.drawline(1,y,x,y)         ' draw bottom edge
#.drawline(x*.8,y*.8,x,y-1)
#.drawtext(x*.76,y*.75,x)
#.drawtext(x*.76,y*.75+40,"x "+y)
#.delay(4)

Re: Test Chart

Posted: Sun Sep 24, 2017 9:07 pm
by rbytes
Mr. K, it seems that the stop button is not appearing at the upper right when I use #.scrview(#.normal)

Re: Test Chart

Posted: Sun Sep 24, 2017 9:18 pm
by Mr. Kibernetik
In your code:

Code: Select all

x,y = #.scrsize()
y = #.int(y)
#.scrview(#.normal)
if to put #.scrview before #.scrsize then you will get full screen graph.

Also, I see that on your graph 600 dips is equal to 900 pixels in size. If dips correspond to 96 dpi, then your screen is 900/600*96 = 144 dpi.

Re: Test Chart

Posted: Sun Sep 24, 2017 9:25 pm
by Mr. Kibernetik
Also it may be useful to turn off antialiasing of graphics by using #.aaoff function to make your lines look thinner. By default they are antialiased which gives smoother, but thicker look.

Re: Test Chart

Posted: Sun Sep 24, 2017 9:28 pm
by rbytes
Thanks. More things to try. I think SPL is more fun than a model train set. :)

Re: Test Chart

Posted: Sun Sep 24, 2017 9:31 pm
by rbytes
Yes, #.scrdpi() gives 144 on my CHUWI tablet. My laptop is 96 dpi, so #.point() may not make a difference there.