Hi Lou,
For the Json stuff Herbert is correct. You will need to load a Json reader. On my image I use.
Json readFrom: self readStream. To get a dictionary. You then just read the values from the dictionary.
Some other Json reader might have #readFromString: as Herbert suggested.
For managing the package if it is not loaded I would recommend adding
Smalltalk at: #KscEarthSunAstroData ifPresent: [ <put your draw code here> ].
That way you handle the problem if the dependency is not loaded.
I also had a problem with my image (4.1)
I had to use:
Project current fullScreenOn and Project current fullScreenOff.
Also, it is possible to return fraction from your x point calculation which will cause problems: I added asFloat below to fix it.
Form >> drawString: aString centeredIn: rect vOffset: vOffset withFont: font color: color
"Display the string centered horizontally in the rectangle with a vertical offset from the top using the font and color."
| bb stringExtent f x y rOrigin |
bb := (StringMorph contents: aString font: font) imageForm boundingBox.
stringExtent := bb extent.
f := Form extent: stringExtent depth: 32.
f getCanvas drawString: aString in: (0@0 extent: stringExtent) font: font color: color.
rOrigin := rect origin.
x := rOrigin x + ((rect width - bb width) / 2) asFloat.
y := rOrigin y + vOffset.
self getCanvas translucentImage: f at: (x@y).
I also noticed that the time quite large :)
I'm seeing: 11:28:35.28400000001 am
Keep up the nice work!
All the best,
Ron