-
-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add linegraphs #511
Comments
#1382 will certainly help with this |
I don't think line graphs would be really possible without pixel/sixel, since blitting a straight line onto blocks or box drawing characters would probably be pretty unreadable for some angles. But on pixels there's no problem, all that's needed is some function for blitting pixel lines. That means some functions for drawing basic shapes are probably desired in the API. Antialiasing exists too... Although AA might be better off done by the end user, with something like cairo. |
yep, i'd reached this same conclusion.
i'd really, really like to find a good library for this and use it, something that works directly on RGBA buffers. i'm not experienced enough with graphics APIs to know what people want here, really (and don't care to write a bunch of code that in the end has nothing to do with terminals). |
Cairo has multiple output targets, including in-memory buffers. But from what I've seen it's not hard to draw simple shapes with it. It has plenty of other outputs though, so it would be a big dependency. But then anyone with GTK installed already has it... |
yep, i wrote some exploratory code along these lines last year, enough to get pango rendering. i wouldn't be opposed to an optional dep on cairo, perhaps even its bitch sister pango. |
Isn't pango for text rendering though? |
yeah, it sits atop cairo. it wouldn't be directly applicable to this. |
Okay, so my week-long easter break has begun and I'll have a lot of time to spend on coding. The question regarding line graphs is whether we want the optional cairo dependency for them or not. I personally don't think drawing just lines warrants it. If we were to aim for some public API for pixel drawing, then yeah probably, but such an API would be a pain in the ass and not worth it since cairo can draw to memory buffers and those can be fed to notcurses, so it'd be completely redundant and add bloat. I'd say that's a nono. So I'll look into implementing line graphs by drawing lines myself in the coming days probably. :) |
this is exactly what i was going to say -- line graphs seem nothing more to me than "draw a column of pixels, with the right colors at the right places." the plot widget currently works a column at a time, since that's how samples are organized. |
cool! i was going to take a look at this over the weekend, but if you particularly want it, i can leave it for you. the one worry here is that the bitmap stuff is still very much in flux (i've got a branch outstanding which changes almost all of it at a fundamental level), and i expect linegraphs to possibly drive more change there. that code's very delicate simply due to the (unstated) perf requirements from bitmap drawing in various terminals. |
I was also looking at #1282 but QR codes are surprisingly complex.
I'm currently going off what's in |
I can't find a way to get info on how many pixels fit in a cell/ncplane. Is that a thing somewhere? |
|
btw, these would ideally be just a multidimensional take on i.e. we have |
Yeah, plot.c is a mess, but you can see what I did on my fork on branch linegraphs – I basically include one file twice (really the same file recursively) with different macros. It's kind of poor man's generics, but it's better than having to end every line with |
Could that information made available through the API? related: #1507 |
NCPlot's histograms are good. We ought now add linegraphs. The fundamental difference is that linegraphs are a three-dimensional record, allowing multiple distinct sample sets (each mapped to a different (range of) color(s), natch).
The text was updated successfully, but these errors were encountered: