Mildly Hurtful Sarcasm

Meaningless ranting, just like everybody else.

Tuesday, January 30, 2007

Quest for a nicer desktop III - Shadows

I've made my window transparent, and it's working fairly well. Shadow is what I'm after next. After a brief search on MSDN I found out about CS_DROPSHADOW class style - turns out in XP, you can add shadows to your windows right out of the box.

AfxRegisterWndClass(CS_DROPSHADOW, ...);

The result is actually pretty nice.



However nothing happens when I apply the same class style to my non-rectangular window. Perhaps it is because it is not a WS_OVERLAPPEDWINDOW. I need to implement shadow on the my own. I pick the easiest way: slide under the main window a top level window that resizes and relocates accordingly. I knew ahead of time a solid shadow like old times won't do it any more, but I didn't know it is going to look so bad, it even kills the transparency of my main window. So I reduce the opacity of my shadow window to 50%.



Transparent shadow works ok but looks pretty rigid. Windows' shadows are the fuzzy type, I need to add fuzziness. I create a GraphicsPath that outlines my shadow window's shape. Since my main window is see through, I need my shadow to be solid in the middle and fade out only at the edge.

INT num = 1;
Color clrSurround = Color::White;
PathGradientBrush brShadow(&path);
brShadow.SetSurroundColors(&clrSurround, &num);
brShadow.SetCenterColor(Color::Black);
REAL xScale = (nWidth - nEdgeWidth * 2) / nWidth;
REAL yScale = (nHeight - nEdgeWidth * 2) / nHeight;
brShadow.SetFocusScales(xScale, yScale);
graphics.FillPath(&brShadow, &path);


It looks okay at first, but when I take a closer look I realize this is really creating a white rim:


This sucks, I am so close...

Labels:

Sunday, January 28, 2007

Plush for kids

What's the complaint? Too yellow too brown? Who would have thought they'd be cute if you just put eyes and legs on them.

Labels:

Tuesday, January 23, 2007

Quest for a nicer desktop II - Transparency

So I wanted to jazz up the look of my windows and I wanted to stick with Windows XP. I was thinking transparency and shadows. Transparency has been supported since Windows 2000, but you don't see alot of that in Windows applications; my guess: cause it's only good for look, other than chewing up cycles.

Anyway, to make it translucent, I use layered window, give it about 78% opacity (0xc8):


LONG_PTR lStyle = GetWindowLongPtr(GetSafeHwnd(), GWL_EXSTYLE);
SetWindowLongPtr(GetSafeHwnd(), GWL_EXSTYLE,
lStyle WS_EX_LAYERED);
SetLayeredWindowAttributes(GetSafeHwnd(), RGB(0x0, 0x0, 0x0),
0xc8, LWA_ALPHA);

Voi la, I get my translucent window:



But just as I have predicted, transparency is trouble. Some of the text is obscure, the buttons become see through and muxed up. It did more bad than good. Then I remember Aero in Vista, where only the so called non-client area is see through, I need to do that. I can think of 2 ways: per pixel transparency in layered windows, or literally layering windows. I will go ahead and do the latter - detaching widgets like buttons and make them toplevel windows so that they won't be affected by the parent window's opacity - which will take up more resources but is easier to code.

I make my window widgets, such as the list box, the buttons and the minimize and close window manager buttons top level windows. The minimize and close buttons are round, so I need to clip them to a round region. It works, sort of. Notice that Windows' region is a path of pixel, hence these buttons appear with a zig-zag edge.



It's all about look so I need to solve this. The solution is to first paint color rings right where the buttons are supposed to be, before overlaying buttons on them. They are painted anti-alias and will be see through because they are on the parent window, but that's barely noticable and the result is satifying.



Next stop, shadows...

Labels:

Thursday, January 18, 2007

Quest for a nicer desktop I

I may not be crazy for Macs, but I am not delusional. I do find MacOS X's desktop very refine and neat. Last week I set off to make my XP desktop just as nice. High quality oversized desktop icons? Checked. A kick ass wallpaper? Checked. Aqua buttons and controls? I'll pass, I prefer XP's.

But it's still not as nice.

Do I really have to move to Vista? This week at work I have to install Vista on one of my desktops for testing purpose. The machine is capable of supporting dashboard widgets but Aero is out of the question for that on board video card. Vista black desktop is nice, it's comparable to the Macs, but I wouldn't run it on my main systems (that'd be another story). My home desktop and laptop remain XP.

So I looked closer, I realized my user interface was missing some of the more refine details on the Mac, like shadows and transparency.


A shaodw is clearly visible underneath a transparent menu

Oh, I can do that. Few people realize but these two elements have been supported in Windows since Windows 2000. For example, the mouse cusor has been casting a fuzzy shadow since Windows 2000, so do the menus since XP.

What do you know, turns out Windows have shadows too

If I can just make my window cast a shadow too, hmm...

Labels:

Wednesday, January 10, 2007

More on iPhone

Apparently Apple fans everywhere are excited about the iPhone, contrary to my expectation. My intuition has failed me once again, but here is why I think fans would have been disappointed:
  1. The look: admit it Apple fans, its all about the look. But the one thousand fantasy iPod phone designs out there all look more Apple-ish that the iPhone, which ironically enough, resembles a Sony to me.
  2. It's not an iPod: remember the Motorola phone that boasted a built-in iPod, oops, sorry, iTune? What a bummer that was!
  3. Too bulky: I know we all want big screens, but none of us want to be a real life Sponge Bob (square pants, you know, when a rectangular shape shows)

If I were the marketing/engineering guy at Cupertino, I'd have:

  1. Pushed for an acrylic white case
  2. Made the music software a virtual iPod, complete with a touch screen click wheel, etc (something like this)
  3. Called it iPodPhone, at least that way Cisco won't sue.
  4. Got a different hand model!! (that knuckle is really annoying).
Wouldn't we all be more excited if the iPhone looks something like this?

Labels: ,

Tuesday, January 09, 2007

Technical competency and terminology abuse

Today Apple unveiled its new iPhone, claimed to have reinvented the phone. So let’s talk about invention.

The iPhone is a music player, a phone that integrates seamlessly with contact management applications like calendar and address book. You can also view photos and watch videos and browse the web with its beautiful bright screen…… that is so wicked cool…. except my iPaq from 6 years ago could do all that!

I loved my iPaq, I still do. I have a large compact flash card and Windows Media Player so I can listen to music and watch full feature films on it. Back then when wireless wasn’t popular I had a CF modem I used to browse the web with Pocket IE. Believe it or not Pocket IE loads as fast as anything, it even scales down pictures to make web pages look great on that bright screen. I don’t have a GPRS card which otherwise would have allowed me to make phone calls with it (at the time I saw a Cisco demo of the integration of iPaq and Aironet 802.11b card to make IP phone calls). In all fairness, my iPaq is a bulkier than the iPhone. It also requires a stylus for scrolling – which brings me back to why I like my iPaq so much – it’s programmable - Microsoft had made Embedded Visual Studio freely available, and I have written several applications for PocketPC (available here). I could have added thumb scrolling myself, its just software.

Seen here double as a GPS is my iPaq, or what my coworker Ray so affectionately dubbed the brick for its bulkiness


I am not Apple bashing again (as I sometimes do) and I am sure the iPhone is a fine piece of shit. But the thing is, invention should be something new. Packaging together old functionalities doesn’t pass as an invention. Shinny shells and pretty graphics shouldn’t be passed on as inventions. Churn out a piece of equipment that basically does what some 6 year old PDAs could do and call it an invention makes me mad.

This behavior of terminology abuse has gone out of control in this industry. Six months ago I was reading up AJAX for work. AJAX is essentially 4 lines of code that allows a browser to update only portions of a page (instead of reloading an entire page). The technique of repainting as little as possible is ancient; it has been around forever in computer animation because it is crucial to avoid screen flashing. Yet you see so many less columnist calling AJAX a powerful technology. Pluuuuuease, a technology? Software that park cars - that’s technology. AJAX doesn’t even pass as a technique.

Since then I’ve been paying attention to how people describe software. Indeed, the better programmers normally would saying something like “we can just call those functions” instead of “we can leverage that technology”. And if you have said the latter in front of me, that’s right, I probably have rolled my eyes and grumbled “technology my ass”.

Labels: ,