How to plot a graph
Peter Scheele (2290) 178 posts |
Graphicologically, meteorologically, magically, wimpsymphonically spoken: ‘wanna see me graph?’ https://scheelpj.home.xs4all.nl/graph24.png Thank you, Nemo! |
nemo (145) 2546 posts |
Bravo. Are you using GDraw there? Your graph certainly has four times oversampling on the antialiasing. |
Bryan Hogan (339) 592 posts |
Might have SpecialFX loaded which I think passes Draw calls onto GDraw instead (or something like that). |
Peter Scheele (2290) 178 posts |
I took your listing (Draw module) and the only thing I changed was t=4 instead of t=80. What is GDraw?
I switched SpecialFX off, but no visible difference. |
Rick Murray (539) 13840 posts |
How are you making the image? I ask because I think InterGIF expands the DrawFile by three when rendering, then reduces it by three when creating the GIF to “antialias” it. Maybe whatever creates the PNG does something similar? |
Peter Scheele (2290) 178 posts |
With Snapper and I save it as PNG, Rick. Then I transported it to my Mac via USB and then I uploaded it to my webspace. @ Nemo: can you tell me please how you see the oversampling? To me the lines look pretty nice. Probably a bit thick for a graph, but they are smooth. |
Peter Scheele (2290) 178 posts |
You were right, Bryan. I switched off ‘Always load SpecialFX’ and when I turned on my RPi later, the graphs looked ragged. At the moment I switched SFX on again, my beautiful lines were back. What am I supposed to do? Improve my graphs (probably not everyone has SFX on)? In that case I might have to think about Bezier curves. |
nemo (145) 2546 posts |
The Draw module produces aliased output – it either draws a pixel, or it doesn’t. For long near-horizontal lines like your graph, that would be very obvious. Your (lovely) image features antialiasing however. I know a little about antialiasing. If you look closely you will see that the edges of your near-horizontal lines mostly feature four ‘colours’ – solid, and three intermediate shades. I will call them 3, 7 and 11 for reasons that will become apparent. So, going along a horizontal row, you will have solid pixels (15), then sometimes a single intermediate pixel before your get a run of 11, then something a single intermediate before a run of 7, then sometimes a single intermediate before a run of 3, then sometimes a single intermediate before empty background. This shows that the antialiasing is being calculated by oversampling – in this case by four times vertically, and probably four times horizontally too. In effect the line is drawn, aliased (jagged), four times too big, then groups of 16 of those subpixels are summed to work out the colour to use. There are other ways of doing antialiasing that do not exhibit that diagnostic staircase effect.
I think the image looks great. “Oversampling” is a technique, not a criticism. |
nemo (145) 2546 posts |
Won’t make the slightest difference. The ‘problem’ is that your lines are nearly axis-aligned. That always shows aliasing at its worst. There are a number of techniques that can improve things. One is oversampling yourself. For example, my little AAClock uses oversampling to produce a nice antialiased clock: Using GDraw if available is perfectly acceptable. |
Peter Scheele (2290) 178 posts |
I understood that, but ’over’sampling suggests too much work than necessary.
Ha, you showed me ten seconds of your life :-) Thanks, for your extensive answers as well! If you look at https://scheelpj.home.xs4all.nl/24graph.png, you see text like temperature..gust, -50..+50, 0..100. That are labels in the Template file, each with their own foreground colour which are stable. But the hours in the top are done by: They are supposed to be grey, but their colour change when a window is moved across them. They can even be different at the moment the window is opened. I’ve tried different values for R2, they make no difference. What am I doing wrong? |
nemo (145) 2546 posts |
Font painting uses its own colours. This is because of some history: • The FontManager originally used 16 colour sprites, in effect, created offline from a pen & nib Basic program. Therefore the colours used were nothing to do with the VDU’s text or graphics colours. Instead one had to set the colour numbers for the start and end of the antialiasing colours, and the number of steps. Uggh. So, you need to do ColourTrans_SetFontColours,,fg_BbGgRr00,bg_BbGgRr00,14 Don’t ask about the 14, you don’t want to know. |
nemo (145) 2546 posts |
|
Peter Scheele (2290) 178 posts |
Clear as glass, steady as a rock, thank you. (Not only RGB is in a different order, fg_ and bg_ as well) When I look back at my recent questions it seems that my knowledge is a bit (well, only some 20 years) behind. My PRM is from 1992, the digital version from 1995, Wimp Programming for All from 1993, my BBC reference from 1987. Can you recomment me some more recent (paper: I have a large table and a not so large screen) books about programming Wimp and BBC BASIC, please? |
Steve Fryatt (216) 2105 posts |
Not really… The PRM that you have is the current one (if you have Volume 5 or 5a, that is), supplemented by more up-to-date information here. For details of what “the other side” got up to, you can find the RISC OS 6 PRM here. Unfortunately there isn’t one single source of reference documentation. That said, for BBC BASIC, you need the new BBC BASIC Reference Manual from ROOL – launched last year at the London Show (IIRC), it covers the latest versions of BASIC in RISC OS 5. There’s also a new Style Guide from a couple of years ago, and if C or ObjAsm is your thing, then the Desktop Development Environment also got a new manual a year or so back. Programming the Wimp is harder. Things like Wimp Programming For All are still sort-of current, although a lot of the advice in those books doesn’t scale well or lend itself to maintainability. There are the Dr Wimp books (tied to that specific set of BASIC libraries), and also a book on BASIC by the late Ray Favre, which are probably still available from some bloke in Glastonbury. To be honest, there isn’t much which is current and reflects modern ways of doing things, which is one reason why I started on this guide to Wimp programming in C – it’s still very much a work in progress, however. Finally, there are some other old manuals on the 3QD page. Note that as far as I can see they’re all the old Acorn-era versions, so anything where ROOL have published a similar document (eg. the BBC BASIC Reference, the PRMs, the DDE Books, Style Guide, etc) will be as much use as a chocolate teapot when working on RISC OS 5. |
nemo (145) 2546 posts |
ColourTrans allows you to specify nice sensible RGB colours even in ‘low colour’ display modes that previously required a ‘colour number’ (an index into a predefined or customised palette). ColourTrans is less important when your display mode is 16M colours, obviously, but that’s the API. Font anti-aliasing usually needs background as well as foreground colour… however, you can switch on font blending (when painting a line of text) and it will do an alpha blend from the foreground colour only. Obviously that’s more expensive and if you’re plotting the text onto a plain background, wasteful. As for books… not really. I feel like I said this just the other day: One tends to reach for a skeleton program for Wimp Programming – those of us who have been doing it for thirty years have a nicely honed one thank you very much, as comfortable as an old pair of slippers.
You’ll fit right in. RISC OS is too. |
Clive Semmens (2335) 3276 posts |
RISCOS was way out in front twenty years ago. Unfortunately way out in front in a slightly different direction from the direction everyone else went. |
Peter Scheele (2290) 178 posts |
I ordered one immediately. Will take some time though… Thanks for the tip, Steve.
I’m working on one, but it takes time. And you always find new subjects to develope, like plotting graphs. Thanks, Nemo.
I remember that. Acorn had a new machine ready, the ugly yellow one. And then suddenly they quitted. I had ordered for a membership of ‘The Clan’, got the membership card with number 05916 and then got an e-mail: everything was prosponed. Sad days! Never understood what really was behind it. |
nemo (145) 2546 posts |
Greed. Sorry, “Maximising shareholder value”. Acorn co-founded ARM. ARM made oodles of money. Acorn owned lots of ARM shares. Every year oodles of dividends flowed into Acorn, which they spent making local computers for local people. This did not make Acorn oodles of money. Acorn shareholders did not get oodles of dividends. People who were 0% interested in technology but 100% interested in ‘look at the size of my wad’ reasoned that if only they could stop Acorn from spending those ARM dividends, and instead smashed Acorn into little pieces so all the ARM shares fell out, then Hence. |
Clive Semmens (2335) 3276 posts |
In a nutshell, yes. Pardon the pun. |
Rick Murray (539) 13840 posts |
To add to what nemo said, I think that Phoebe just wasn’t impressive. It seemed to me like a RiscPC++ that came years too late, used outdated technology, and would very likely (judging by RO3.8) have still remained stuck in the 26 bit era. So couple the “maximising shareholder value” (an evil responsible for breaking many things) with a design that just wasn’t going to cut it, and you have a recipe for disaster. |
nemo (145) 2546 posts |
Or even shorter:
|
Colin Ferris (399) 1814 posts |
IMHO – Its was a great pity that when ‘Acorn’ introduced the ‘RiscPC’ – the RO wasn’t 32bit – or perhaps very soon after release. MRS/MSR catch module – for the last of the Arc’s – so everyone could move forward in a 32bit world. ‘Sib’ running in 4col mode didn’t help – with ‘Acorn’ being able to use a off the shelf grapics card like – Viewfinder. [edit1] not too sure – dropping the ‘Arc’ name – was a good move by ‘Acorn’. wonder if something like ‘aemulor’ would have worked with the RPC RO5 – anyone tried? |
Peter Scheele (2290) 178 posts |
A very remarkable thing of the matter is that Acorn/RiscOS was pretty far ahead compared to other systems. A very remarkable thing as well is, that Acorn/RiscOS was hardly known outside the UK. Lack of marketing? And, things became behind: not 32 bit, no laptop/notebook, a different way of multitasking… They missed a lot of oppertunities. I hardly get it out of my mouth/fingers: shareholders probably did what they had to do: leave the ship before it sinks. The consequence is that, by doing that, the ship sank. Anyway, one is not supposed to cry over spilt milk. Snif-snif. |
nemo (145) 2546 posts |
It wasn’t existing shareholders. It was a smash and grab. |
Peter Scheele (2290) 178 posts |
Was is to eliminate a serious rival on the market? I can’t imagine it’s done solely for the money. |