|
Probably infected by a venomous worm.
|
|
|
|
|
If memory serves Adam and Eve ate "fruit" (not an apple) from the tree of knowledge, but that's OK an apple is a fruit. Apple has traditionally been named as the fruit from the tree of knowledge due to translations between Greek and Latin. However, your oldest computer story is still cleverly punned. I like it.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Sure, the apple has a part that is the fruit - but usually, you won't eat it. Or at least not all of it.
The part that you eat is called the receptacle, which is, in botanical terms, not the fruit. Roughly speaking, the apple core is the fruit. A quite good photo illustration is found at Wikipedia: Pome[^]
|
|
|
|
|
This distinction of fruit and receptacle is not well known. So, botanically, the fruit is the seed and the receptacle is a means (eaten) to distribute it, by man or beast. The receptacle could also be considered a wing to transport the seed by air which a number of plants do.
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
So I needed a simple bit of code to take an icon and convert it to 1-bit monochrome. I had to write it in C++ such that my friend could easily understand it and then port it to JS and make my website do it. I'm an idiot when it comes to web development.
I could not get it right. Could not.
One cup of coffee later:
using test_t = bitmap<alpha_pixel<1>>;
uint8_t test_data[test_t::sizeof_buffer(faAnchorCircleCheck_size)];
void gen_1bit() {
size_t i = 0;
size_t idx = 0;
size_t offs = 0;
uint8_t tmp = 0;
for(int y = 0;y<faAnchorLock.dimensions().height;++y) {
for(int x = 0;x<faAnchorLock.dimensions().width;++x) {
decltype(faAnchorLock)::pixel_type px;
faAnchorLock.point(point16(x,y),&px);
float luma =px.template channelr<0>();
if((luma>=.5)) {
tmp|=(1<<(7-offs));
}
++i;
++offs;
if(8==offs) {
test_data[idx]=tmp;
tmp=0;
offs=0;
++idx;
}
}
}
if(offs!=0) {
test_data[idx]=tmp;
}
}
Like magic.
Not difficult code, by any means, but it just eluded me. And yes, I could replace ifs with shifts and such but I didn't make this to perform - I made it to be able to be read by someone else and ported.
There's smoke in my iris
But I painted a sunny day on the insides of my eyelids
So I'm ready now (What you ready for?)
I'm ready for life in this city
And my wings have grown almost enough to lift me
|
|
|
|
|
My health care provider has suggested I cut back on caffeine -- I wish decaf coffee tasted better than it does.
|
|
|
|
|
Decaf gives me nasty headaches.
Apparently, it can also raise cholesterol levels as well.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: Decaf gives me nasty headaches From my experience, the headache comes from caffeine withdrawal, which takes a while. Decaf doesn't usually cause headaches.
Software Zen: delete this;
|
|
|
|
|
Yep.
Although maybe it is from the aggravation of remembering which to buy and make.
|
|
|
|
|
My morning brew is ⅓ caffeinated, ⅔ decaf. My blood pressure gets more difficult to control the older I get, and cutting the caffeine simplifies things.
Software Zen: delete this;
|
|
|
|
|
I get my caffeine through excessive use of diet Pepsi. Been doing it for years and it appears to have no effect on my blood pressure.
|
|
|
|
|
Flavored decaf is drinkable and even enjoyable. I use decaf hazelnut coffee after having my allotment of regularly-caffeinated Ethiopian coffee. All black.
|
|
|
|
|
Coffee gives me wicked acid reflux, thus I no longer drink it.
Needless to say, I seldom get my code "right".
|
|
|
|
|
I would die.
I would actually die.
There's smoke in my iris
But I painted a sunny day on the insides of my eyelids
So I'm ready now (What you ready for?)
I'm ready for life in this city
And my wings have grown almost enough to lift me
|
|
|
|
|
Hmm. My response is a little different. Let me put it this way. I have a mug with a picture of a dragon with a steaming cup of coffee in its, er, claws with the caption: "Take my mug and I will drink my coffee from your skull."
Software Zen: delete this;
|
|
|
|
|
Gary Wheeler wrote: I will drink my coffee from your skull
I really like that, a lot.
|
|
|
|
|
I'm the same way with the acid reflux. I still love the flavor of Coffee, though. I'll gladly eat coffee candy and stuff like that. I need to try cold brew coffee. It's supposed to be less acidic.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
I used to code in C++, lots and lots.
decltype(faAnchorLock)::pixel_type px;
...
float luma =px.template channelr<0>();
no idea what decltype and that template [space] stuff does. Though decltype is sort of obvious.
How things have changed.
|
|
|
|
|
channelr is a template function that takes one argument - 0 in this case.
template simply disambiguates it for the compiler. It's not always required - not even sure if it is in this case, but all it does in this context is tell the compiler "i'm about to instantiate a template"
the first line is grabbing a type alias declaration off of the type that corresponds to faAnchorLock. What it means in lay terms is "let me know what type of pixel format the faAnchorLock icon is using."
The pixel format is something like rgb_pixel<16> (rgb565 format, 16 bit) or in this case alpha_pixel<8>, which is a pixel that is nothing but an alpha channel. You can also have gsc_pixel<4> for example which is 4-bit grayscale, or many other types, and you can define more.
I'm using that to read the values out of the faAnchorLock icon. channelr gets them as a "real" value (floating point) scaled from 0-1 so I don't have to care about the source's bit depth (8 in this case, but that's an implementation detail)
There's smoke in my iris
But I painted a sunny day on the insides of my eyelids
So I'm ready now (What you ready for?)
I'm ready for life in this city
And my wings have grown almost enough to lift me
|
|
|
|
|
I still code in C++. When I want someone to understand some code, I place block comments and line comments to explain what the code is doing. When did that go out of style?
|
|
|
|
|
|
kmoorevs wrote: Black Sabbath, 'Heaven and Hell' \m/ Great song, great album!
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Prefer 'Heaven and Hell' by Vangelis.
|
|
|
|
|
Does Ronnie James Dio sing on it?
Seriously though, I do like the music he made with Jon Anderson.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
jeron1 wrote: Great song, great album!
Just wanted to add great singer to that list! RIP RJD!
It seems that we have similar musical tastes! I'd bet that you are probably are a musician. Rock On!
"Go forth into the source" - Neal Morse
"Hope is contagious"
|
|
|
|