5 ms·
ISO C++ 2D API
- IsTom 13y agoNews from Herb Sutter -- cool. Rather subjective attack on "hostile templates" -- not cool.
- randallu 13y agoAGG is pretty nasty to use and has worse performance than Cairo on basics like alpha blends and copies (bitblts).
- mikevm 13y agoThat blog post has 0 content. In what way was Cairo the "clear winner"?
- sparkie 13y agoDo we really need a vector graphics library in standard C++? Why not just create a new ISO standard using Cairo as the base, and stop making the language even more bloated that it currently is. If the proposed graphics API does not require changes to the language it really doesn't need to be there.
- oscargrouch 13y agoyeah.. i dont think that add much to the language.. as for 2d we are better of pluging into the native 2d api of the systems we are plumbing.. thats the true value of C and C++ What c++ is trying to be, java?
- adamnemecek 13y agoI mean, C++ is the de facto standard for graphics drawing so it kind of makes sense. It's kind of similar to how Go has a HTTP library as a part of the standard library.
- MaulingMonkey 13y agoQuality standard libraries are wonderful in that you can rely on their presence. A thousand ad hoc separately licensed libraries with wildly varying build chains, supported compilers and operating systems, with similarly varying code quality, naming conventions, build configuration options, conflicting runtime selection, error handling styles, documentation quality, etc. may be the bread and butter of your standard C++ programmer -- I know it is of mine -- but it hardly seems like the ideal state of things, especially having also used languages with much, much larger standard libraries. What practical problems have you, personally, run into as a result of standard library "bloat"? Just yesterday, as a practical problem I've personally had with the "leanness" of non-standard libraries, I spend a good half the day trying to wrangle a set of third party libraries into submission. 4 library configs x 3 platforms varying just enough to spend a good half the day setting up library paths, library names, library dependencies, tracking down #defines for "optional" functionality that was forgotten (or off because it doesn't work yet -- I haven't figured out which) on one platform, all in yet another build system (adapting their projects to ours would take too long), harmonizing runtime library settings to match instead of crash... A whole lot of busywork that simply doesn't happen for standard libraries, because "batteries included" means it's already been taken care of, without cutting off the rabbit hole of extra libraries when you need them.
- oscargrouch 13y agoIt would be ok, if started from the beggining with this.. maybe people would use it.. and then when ios and android happen, its would be adapted to work on them.. but now? people that have C++ or already have they own toolkits, or use some provided by the platform.. i think its just too late for this.. its different with a network stack... its badly needed! and you use it in every way... (backend, frontend) i think people just wont use it.. because of the points i've made earlier.. A better proposition for graphics(because its futuristic) would be to focus on what LLVM are doing for instance... like the ability to compile directly to gpu instructions.. In the direction of Opencl, cuda.. heterogeneous computing.. something that can make graphics AND vectorized computation ..than it would be just a matter of creating 2d graphics kernels, and wrap a api on top of it, C++ has a unique position here! they need to think looking forward.. not backwards..
- Sharlin 13y agoApparently it's an often-requested feature. But the question you stated is exactly what the Committee is trying to find an answer to by forming the study group. Nothing's been decided yet; they're just trying to chart the possibilities.
- Someone 13y agoNeither of the containers requires changes to the language, nor does the regex support, the RNG support, etc. Taking that to the extreme, you don't even need character I/O streams, as people could build them on raw byte streams, adding char-to-byte conversions and formatting. All of these were included to counter one of the weakest points of C and C++: the language may be portable, but even simple programs aren't. That's one area where Java was a huge improvement over C. So, the argument should not be "If the proposed graphics API does not require changes to the language it really doesn't need to be there.", but one should ask "how far should we go in adding standard libraries?". The answer to that question should guide the answer to the "Do we want a 2D graphics API in the standard?" question. I find 2D graphics going a bit far for that, but can see why people would see this otherwise. And to those stating that they don't see that making it into embedded use: C++ already has optional features (http://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optional_features http://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optio...). Yes, that is less than ideal from the portability viewpoint, but that's the real world for you.
- oscargrouch 13y agoits a matter of subjective taste.. particularly i think C# is nasty.. nothing to see here. Edit: But i respect the man! :)
- oscargrouch 13y agoreally, in the case he is pointing out (choosing cairo for moonlight) its just a matter of wrapping a C api in a C++ application.. so people can embed more easily... See the case for the Dart VM for a good example.. its everything wrapped in the C api.. (and also if you want a example of beautiful C++ code for a complex application. hack the VM).. in every language you can write pretty code or nasty code.. i think the only exception here would be haskell (as a proof of the impossibility to write a code that do not look ugly)
- rayiner 13y agoHe's not wrong about C versus C++. I'm probably just dumb, but I find the Mono source (C) way easier to follow than say the Sun JVM (C++).
- eropple 13y agoI don't know many people who'd call the JVM good C++, though. It's got a lot of baggage. Life's way too short to not have things destruct on scope exit. I'm pretty confident that my own projects would be a lot more verbose and much, much more error prone (like, failure-to-get-off-the-ground error-prone) if I had to deal with C's limitations.
- randallu 13y agoWhat is this? Python? Why "standardize" Cairo? I can already use Cairo if I want to. I'd rather they provided some standard template interfaces to all of the common 2D graphics algorithms (simple line clipping, tessellation, polygon clipping, bezier subdivision, etc) and not couple it to a classical scanline rasterizer CPU graphics library. But I don't think that even this belongs in the language standard. There are a bunch of other opensource libraries they'd need to "standardize" if they want to draw text...
- cypher543 13y agoWhile I agree that a 2D API doesn't sound like something that needs to be in the standard library, it sounds to me like they're just basing the API on Cairo's and not necessarily forcing everyone to use Cairo bindings. Individual standard library vendors would be free to implement that API any way they like, just like video card vendors have their own unique, yet consistent OpenGL implementations.
- zanny 13y ago> Why "standardize" Cairo? Because it means you can start making assumptions about available resources on platforms you target. If all you need is the included 2d api in the standard (which would be terse at best) then as soon as you can throw a compiler flag for, say, c++14, you can assume those primitives are there. You don't have to fight to either bundle a 3rd party library with your software, or pray to god the included version on the target system still has a version with the same abi, etc. You can just use it outright without hesitation because standard compliance means you have it at your disposal.
- vinkelhake 13y agoThis blogpost is so silly. Agg is more like a meta library for constructing drawing APIs. Using it directly is quite painful. It even comes with Agg2D which is a simplified API. Another easy to use C++ drawing API is Qt's QPainter. It all comes down to how you design the API. C++ doesn't force you to come up with Agg if you really want something like QPainter. I expect the C++-translation of Cairo to be equally simple. We're talking about translating cairo_foo(ctx, params); to ctx.foo(params); and adding automatic memory management. API design is hard. If you have it in you to design a good C API, you could probably do the same in C++.
- cosmotriton 13y ago[A note from the peanut gallery] Miguel loves C and that's perfectly fine - it's a great language, easy to read and write, powerful, but does suffer from some of the same fundamental problems as C++... Both languages are tightly bound to today's base machine architecture - they are called "systems programming languages" for this very reason. I find it odd that we have this continual debate about older (and widely used) systems programming languages (the ones that are actually used and form the basis of modern computing....), but neglect the arguably more interesting - and obvious - problem: the lack of a viable, consumer class, non-Von Neumann machine architecture. What would it mean for the advent and design of new high level programming languages that are safe, performant, productive, portable, and that directly map to this new machine model? The future will always be built on the past, but this doesn't mean we have to keep re-inventing the same problems to solve... Here's to a future of new machine models and the languages used to program them efficiently, effectively, safely, and easily.
- checker659 13y agoWhat about Skia?
- atesti 13y agoBy the way, the author of Antigrain (Agg) has recently died: http://beta.slashdot.org/submission/3154635/rip-maxim-shemanarev http://beta.slashdot.org/submission/3154635/rip-maxim-sheman... I was shocked to read this when I saw the blogpost from Miguel and wanted to find out why development of Antigrain stalled.