Test Chart

Post Reply
User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Test Chart

Post 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)
Attachments
Screenshot (66).png
Screenshot (66).png (58.29 KiB) Viewed 3509 times
Screenshot (65).png
Screenshot (65).png (66.91 KiB) Viewed 3509 times
The only thing that gets me down is gravity...

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Test Chart

Post by rbytes »

Mr. K, it seems that the stop button is not appearing at the upper right when I use #.scrview(#.normal)
The only thing that gets me down is gravity...

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Test Chart

Post 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.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Test Chart

Post 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.

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Test Chart

Post by rbytes »

Thanks. More things to try. I think SPL is more fun than a model train set. :)
The only thing that gets me down is gravity...

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Test Chart

Post by rbytes »

Yes, #.scrdpi() gives 144 on my CHUWI tablet. My laptop is 96 dpi, so #.point() may not make a difference there.
The only thing that gets me down is gravity...

Post Reply