Colorizing images for Windows Phone 7

I know what you're thinking... I have these great icons, and I want to display them in the system color. I need to use a PixelShader. Or some other kind of ShaderEffect.
Well, sure, you could do it that way... but that's overkill. Instead, allow me to introduce you to the OpacityMask.
Here's the idea: you paint a rectangle the size of the icon you want to render. Fill it in the color you want to paint with. And set the OpacityMask of the icon to the image you want to use as the outline.
For example:

And hey presto! One neatly colored image, for very minimal fuss. Doesn't work for tinting, but certainly works for rendering icons in the right color for the UI.

The blog moves.. pt. 2

Well goddamn it... my GoDaddy setup is all screwed up. (That's what I get for hosting multiple domains on one IIS account, apparently).

More news as I try to fix this damned thing.

#accidental scientist
This entry was posted under Meta. Bookmark the permalink.

Jesus and Schrodinger

This was on Digg today:

My response?...

John 4:46:And lo he sat by Schrodinger's bedside.
"Schrodinger... that's a good Jewish name.", he said and laid his hands upon the box by his bedside.

John 4:47:"Why is thine box ticking?", the Lord said.
"That, Messiah, is a Geiger Counter," he said, and wept.

John 4:48:"Why do you weep, for I am the son of God, risen again and here to save you?"
"Well it's just that I put some poison in there too. And Fluffy."
And Jesus wept, for Fluffy was Schrodinger's cat. A calico.

John 4:49: "Well this is quite a quandary", said the Lord. "For this cat is both alive and not alive, dead and not dead. In fact he is far from the light of my Father."

John 4:50:Schrodinger thought about this. "You mean..."
Jesus stalled him. "Yes. Spooky action at a distance. There are unknown variables here."
"But I thought your father was omniscient?", said Schrodinger.
"He is. But the problem is this." He kicked the box, and it shimmered in gold and red, like a desert mirage."... the wavefunctions have not yet been resolved. They need to collapse. The only way we can do that is by opening the box."

Jesus gently pulled his foot out of the sandal, which was now melted half into the box.

John 4:51"Oh Lord, what shall we do? Fluffy must be getting hungry in there, and the Gods..."
Jesus glowered at him.
"I said you were Jewish. Monotheistic. Are you some kind of Egyptian plant? Do you report to Herod?"
Schrodinger looked down, admonished by the Son and the Word. He mumbled back... "... Trinary ...", but the word was lost on the wind.

John 4:52 "We shall open the box on the third day. That way we will know if Fluffy is alive or is dead."
"Or if Fluffy will scratch us to pieces."
"We shall not shake the box; Fluffy will be fine. Besides, quantum entangled systems such as these exhibit a decoherence of mass in the local system which means that gravitational forces and moment are smeared throughout the whole of the probability point cloud for the dynamics of the system."
Schrodinger: "But what if Fluffy is dead."
Jesus scratched his chin.
"No worries. There was once this guy in Bethany, and he was out for four days when I brought him back. Mind you, he was quite annoyed. Nightmares for weeks."
"It is agreed."
"I should hope so. I don't just go around the Middle East resurrecting random pets, you know. This is a special favor."

John 4:53 And so, the Lord waited three days, and with great intrepidation, opened the box.But inside the box there was nothing.
"Deja vu", Jesus said.
"You already looked?". Schrodinger was crestfallen.
"No", said Jesus. "I don't mean it literally."
And the two of them looked in awe.

John 4:54 The Lord left Schrodinger, and walked to the mountain. He sat on the mountain, and became lost in thought.
"I wish I knew where that bloody cat had disappeared to", he said. "Its wavefunction should have been constrained; that's a square well in 3-dimensions; even an undergraduate knows the calculus for that one."
The bush next to him chuckled.
"Dad, knock it off."

#religion, #physics, #what's in the box what's in the box?, #se7en
This entry was posted under Humor. Bookmark the permalink.

The Blog Moves…

… but the address remains the same.

Hang onto your hats… I’m going to shift the blog away from using Blogger FTP Publishing to Wordpress. It may get a little bumpy here while things shake out. Links may break. That kind of thing.

Please hold tight :)

#accidental scientist
This entry was posted under Meta. Bookmark the permalink.

Cake and Healthcare - When Analogies Attack...

A lot of Americans appear to not quite understand how this whole Universal Healthcare thing might work, and don't understand why (a) they should pay for someone else's healthcare (answer below), or (b) how the system could possibly work and be more efficient than, say, paying some kind of company that tries to make a profit (even 501(c) companies in the US are allowed to make a profit; they're just not allowed to keep it and carry the cash forward to the next year).

Allow me to help.

Let's say you go to a really flashy restaurant. That restaurant feeds you exceptionally well, and you can see hundreds of people coming in and out of the door.

You finish your meal, and you're feeling completely stuffed. The waiter comes by with your bill. You look down at it, and there's a line item for a dime - with just one item listed. "Cake", it says.
You, flustered, wave the waiter back over. "Excuse me, but I didn't order cake, and I don't need cake."

"But it's only a dime, sir," the waiter says. "As you leave the restaurant, if you are still hungry, there is a large cake at the coat check. If you don't believe me, you can come back."
So you get up, and you sign the bill (tipping the waiter less 'cos you don't believe his story), and when you get to the coatcheck they say "So, sir, how was your meal? Can I have your ticket, and may I ask if you're still hungry?"

"Actually, yes, I am hungry," you gruffly state, while handing over the ticket.

The coat-check attendant walks into the other room, and comes back with your coat, and a trolley on which lies an immense 4-storey tier cake, covered in sparklers, with ganache all over it, fresh strawberries and a chocolate fountain bubbling up from the top.

"But... but..." you stammer. "How can you afford to do this?"

It's quite simple: The restaurant feeds all of their customers well ahead of time, making sure that most people never leave hungry, and don't get to the point of needing the cake in the first place.

The dime on every bill adds up for all of the people who come into the restaurant, until eventually, 3000 happy customers have gone by with one 1 of them needing the actual cake itself. And they don't try to make a profit on the cake; they charge a dime, because statistically, that's what the cake costs.

The restaurant is a co-op, which each of the diners buy into. Rather than making a profit for the owner, the membership fee allows the diners to lower their rate. Kind of like CostCo. There's still profits to be made, but it's much cheaper for everyone because the shareholders are taking the profits as direct benefits, not as dividends.

So ultimately, I ask you: Why don't you like cake? Sure, you could go buy that cake yourself for $300... but that's a lot to pay for cake. I'd rather pay 10c every time I went to that restaurant. Sure, occasionally other people might get the benefit of the cake I paid for, but when I want it, it'll be there for me.

(Some people point out that Medicaid/Medicare doesn't work... and that's because Old People and Kids PREFER Cake, which is a concept I'll tackle in my next post).

#Health, #healthcare debate
This entry was posted under Politics. Bookmark the permalink.

subscribe via RSS