|
1. The lounge is for the CodeProject community to discuss things of interest to the community, and as a place for the whole community to participate. It is, first and foremost, a respectful meeting and discussion area for those wishing to discuss the life of a Software developer.
The #1 rule is: Be respectful of others, of the site, and of the community as a whole.
2. Technical discussions are welcome, but if you need specific programming question answered please use Quick Answers[^], or to discussion your programming problem in depth use the programming forums[^]. We encourage technical discussion, but this is a general discussion forum, not a programming Q&A forum. Posts will be moved or deleted if they fit better elsewhere.
3. No sys-admin, networking, "how do I setup XYZ" questions. For those use the SysAdmin[^] or Hardware and Devices[^] forums.
4. No politics (including enviro-politics[^]), no sex, no religion. This is a community for software development. There are plenty of other sites that are far more appropriate for these discussions.
5. Nothing Not Safe For Work, nothing you would not want your wife/husband, your girlfriend/boyfriend, your mother or your kid sister seeing on your screen.
6. Any personal attacks, any spam, any advertising, any trolling, or any abuse of the rules will result in your account being removed.
7. Not everyone's first language is English. Be understanding.
Please respect the community and respect each other. We are of many cultures so remember that. Don't assume others understand you are joking, don't belittle anyone for taking offense or being thin skinned.
We are a community for software developers. Leave the egos at the door.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
modified 16-Sep-19 9:31am.
|
|
|
|
|
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!
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
Show how to protest? (11)
"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!
|
|
|
|
|
Demonstrate
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
You are up tomorrow!
"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!
|
|
|
|
|
Monday
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
I'm losing track of what day it is with Herself off sick ...
"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!
|
|
|
|
|
It's Friday . . . 2021
// TODO: Insert something here Top ten reasons why I'm lazy
1.
|
|
|
|
|
#Worldle #503 2/6 (100%)
🟩🟩🟩⬜⬜⬅️
🟩🟩🟩🟩🟩🎉
https://worldle.teuteuf.fr
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
Wordle 720 4/6
🟨🟨🟨⬛⬛
⬛🟩⬛🟨🟨
🟩🟩🟨⬛🟨
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 720 4/6
⬛⬛🟨⬛⬛
⬛⬛🟨⬛🟩
⬛🟩🟩🟩🟩
🟩🟩🟩🟩🟩
Learnt a new word...
|
|
|
|
|
Wordle 720 6/6
🟨⬜⬜⬜⬜
⬜🟩🟨⬜⬜
⬜🟩⬜🟩⬜
⬜🟩⬜🟩⬜
⬜🟩🟩🟩🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 720 3/6
⬜⬜⬜🟩⬜
🟩⬜🟨🟩⬜
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 720 3/6*
🟨⬜⬜🟩⬜
🟩🟨🟨🟩⬜
🟩🟩🟩🟩🟩
Lucky with that second one!
"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!
|
|
|
|
|
⬜⬜🟨⬜⬜
⬜⬜⬜⬜🟨
🟨🟩🟩🟨⬜
🟩🟩🟩🟩🟩
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
Wordle 720 3/6*
🟨⬜🟨🟩⬜
⬜🟩🟩🟩🟩
🟩🟩🟩🟩🟩
Happiness will never come to those who fail to appreciate what they already have. -Anon
|
|
|
|
|
Wordle 720 5/6
🟨⬛⬛⬛⬛
🟨🟨🟨⬛⬛
⬛🟩🟩🟩⬛
⬛🟩🟩🟩🟩
🟩🟩🟩🟩🟩
Ok, I have had my coffee, so you can all come out now!
|
|
|
|
|
Wordle 720 5/6*
🟨⬜⬜🟨⬜
⬜⬜🟨🟩⬜
⬜🟩🟩🟩⬜
⬜🟩🟩🟩🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Got home from a meeting last night OK. Went to bed as usual. Not a wink of sleep, tossing and turning, feverish/chilled, screaming headache if I moved. Decided about midnight that I'd caught the flu (haven't had this year's vacc yet), probably at the fire management exercise of the last couple of days. 40+ people from all over the state in close proximity...
Did a RAT (Rapid Antigen Test, aka Lateral Flow and other names) this morning.
Yep, COVID. In the queue for a phone consult to get antivirals (which are very effective by all accounts). So far my life partner of 53 years tests negative. So far...
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|