|
|
Mildly NSFW but not really. Use of a b word but not the most offensive one.
Recruiters[^]
Real programmers use butterflies
|
|
|
|
|
I wonder if they sell used cars on the side?
|
|
|
|
|
Recruiters are people who have failed the integrity test for engineers, the honesty test for politicians, and the intelligence test for bankers, but ask one to trust that they are honest brokers.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
|
I swear I know the recruiter!
|
|
|
|
|
Why is he not wearing a red uniform? They're for disposable staff; like Temps, you use them up, then toss them in the dumpster...
Will Rogers never met me.
|
|
|
|
|
I taught myself C++14 and C++17 by writing one core piece of code - my pixel template.
To this day, it's some of the code I'm the most proud of. The things it can do at compile time are pretty impressive.
const auto col = bmpa_color::red;
col.channelr<channel_name::A>(.5);
This for example, sets the alpha channel to make a red color half transparent. It does so in a pixel binary format that is completely arbitrary and user defined, and does so entirely at compile time, yielding a color value with the appropriate binary footprint. All of the bit shifting and other nonsense that makes this possible is all computed by the compiler.
I tried writing an article (actually two, really) on it but I fear it wasn't well understood by people.
C++ template arcana is bloody hard to teach. The only way I could learn it well is practice practice practice until I could intuit the syntax because trying to remember all the rules by rote is extremely difficult if not impossible, at least for my mind.
Accelerated C++ by Andrew Koenig and Barbara Moo is still the best book to introduce people to generic programming in C++ in my opinion, but it doesn't teach the newest features, nor does it teach super complicated constructs.
So for starters, just so I can have something to refer people like my buddy to when he wants to learn this stuff, do any of you C++ devs out there have a book to recommend on generic programming with particular emphasis on metaprogramming, type lists and the like?
Also, are there any really useful tricks out there you've learned regarding this type of coding?
Real programmers use butterflies
|
|
|
|
|
Alexandrescu's book[^] was pioneering in this area. While looking for it, I came across this one[^], which seems to be more recent and focused on the topic.
|
|
|
|
|
Yeah but are they good?
For every good C++ book out there I find 10 bad ones, hence why I'm looking for recommendations.
Real programmers use butterflies
|
|
|
|
|
Sorry, can't help you there. I looked at the first one when learning C++, so I don't recall much because it wasn't what I needed at the time. I'll probably get the second one when I'm buying another one on voodoo.
|
|
|
|
|
I gave up on C++ books years ago. The best help I get are from various sites like Bartek's coding blog[^] and just trying stuff. (Stack Overflow sometimes has great answers, but they are few and far between.)
|
|
|
|
|
I don't really do books myself either, but in this case I felt like they might be useful.
I'll take a look at that blog, thanks.
Real programmers use butterflies
|
|
|
|
|
Sorry if my answer might come across as a bit harsh.
Quote: but it doesn't teach the newest features, nor does it teach super complicated constructs. But is the super complicated stuff really necessary? I come from the era of Literate Programming and still have a strong belief that programs should be written for humans and only executed by computers. In case of a lot of template meta-programming, if mere mortals have difficulty grasping it, maybe we should just stay with simpler stuff.
Looking at your code fragment, a const object (we don't know what it is because auto hides that - could be a color by the name of it, but who knows) has a property channelr (whoever that may be) changed to 0.5. Oh, and this is an instantiation of a templatized function for some parameter channel_name::A . You say that makes the red color half transparent and I believe you but let me tell you that it's not apparent from your code and it's the exact opposite from the ideal of literate programming where code should read like a novel. Your code is efficient, generic, compact, whatever you want but easy to understand, it ain't.
Seems to me you are slaving for the computer instead of the other way around.
Mircea
|
|
|
|
|
Prior to C++20 many of the metaprogramming techniques in C++ are effectively “hackish” because while C++ does support this kind of thing, it wasn’t originally designed for it.
I've hidden those complicated constructs I needed behind usable facades, but the code to make them work is necessarily ... difficult.
In my pixel class it would have been impossible performance wise to create a pixel in an arbitrary binary format with an arbitrary set of named channels without doing metaprogramming.
In C++17 and particularly 14 which I target, some of the code is necessarily complicated. Like you, I don’t like it. But, it is C++ and it is metaprogramming, and so this is par for the course. You either cope with it and the mess it brings, or avoid it altogether.
Furthermore, of course you aren't going to understand it without knowing anything about it.
If I were to explain the concept of pixels and channels you would get it. (I didn't invent the concept of channels either - they're just what individual values of a particular color model are called) - the alpha channel in graphics parlance is the channel that specifies the transparency of a pixel.
If you have an rgba8888 pixel that's 4 channels, 8 bits each, specifying red green blue and alpha. This is the standard pixel format in .NET.
But the pixel format for an ILI9341 display device is rgb565 with no alpha channel.
JPGs use YbCbCr pixels, so it's not even an RGB color model.
My library supports all of these and whatever else you define because it is cross platform, which was one of the goals - to be device agnostic.
I didn't expect you to understand exactly what that code was doing.
Now, if you didn't understand that code after reading this: GFX Forever: The Complete Guide to GFX for IoT[^] then one of us - probably me - has a communication issue
Real programmers use butterflies
modified 30-May-21 22:32pm.
|
|
|
|
|
honey the codewitch wrote: I tried writing an article (actually two, really) on it but I fear it wasn't well understood by people.
I have a similar issue with my latest article. The method I'm trying is separating the article into a conceptual section and a technical section. The conceptual section will talk about the topic at a high level. The idea is to get an initial, logical understanding of the problem being solved and the topics used to solve it without the confusing (but fun) details. Like when you learn about Model-View-Controller and you've got the pictures that show what the logical elements of that pattern do to give a practical understanding of what's going on. Then go over the technical details in a separate section to show how the various parts of the implementation solve the high-level, logical problems while diving into those gritty details that make it possible.
Can't confirm this approach works but it sounds good in my head
|
|
|
|
|
That tends to be how I do it. I usually divide it into "Conceptualizing this Mess" "Using this Mess" and sometimes "Coding this Mess" if I'm deep diving into how I built it.
Real programmers use butterflies
|
|
|
|
|
I assume this is the for your ongoing pixel drawing program. Any reason you dont wanna use shaders?
|
|
|
|
|
Show me an IoT graphics device that can support shaders and I'd consider it.
There is no hardware acceleration on this thing. Drawing is all point by point or square by square.
Real programmers use butterflies
|
|
|
|
|
Silverlight! hahahaha
|
|
|
|
|
I can make a "driver" to bind GFX to some sort of PC drawing surface, like a silverlight canvas (or whatever they have, I've never used silverlight in my life) but it seems pointless.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: This for example, sets the alpha channel to make a red color half transparent. It does so in a pixel binary format that is completely arbitrary and user defined, and does so entirely at compile time, yielding a color value with the appropriate binary footprint. Could've been straight out of a sci-fi movie!
|
|
|
|
|
It's not *that* complicated.
How many channels does an RGB pixel have? The answer is right in the question.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: It's not *that* complicated. Said the person who wrote it
honey the codewitch wrote: sets the alpha channel
honey the codewitch wrote: How many channels does an RGB pixel have? Four, I guess, counting the alpha
honey the codewitch wrote: The answer is right in the question. Unless alpha isn't a channel and the answer really is three, it clearly doesn't
And by the way, your original post didn't mention RGB, just "setting the alpha channel"
"I am the Alpha and the Omega, the First and the Last, the Beginning and the End." (Revelation 22:13, and also your code)
|
|
|
|
|
It was 3 channels, because i didn't name an alpha in the question, but from your response you clearly understand the relationship between channels and pixels, and correctly deduced that an alpha channel would be the fourth channel if it had one.
Now, I didn't expect anyone to understand that much about my initial code without any context. I didn't provide the context because I didn't think understanding the code was exactly relevant, until more than one person decided it was. So here we are.
Real programmers use butterflies
|
|
|
|