Showing results for November 2006 - Page 2 of 3 - The Old New Thing

Nov 17, 2006
Post comments count0
Post likes count0

The window manager moves the mouse; applications choose the cursor

Raymond Chen
Raymond Chen

You can sometimes narrow down the source of a problem just by looking at the screen and moving the mouse. When you move the mouse, the cursor on the screen moves to match. This work is done in the window manager in kernel mode. The mouse hardware notifies the window manager, "Hey, I moved left twenty units." The window manager takes this value, ac...

Tips/Support
Nov 16, 2006
Post comments count0
Post likes count0

Using DIB sections to perform bulk color mapping

Raymond Chen
Raymond Chen

When doing dithering, one operation you have to do for every pixel is map it (more accurately, map a modified version of it) to the nearest color in your available palette. Since this is part of the dithering inner loop, you need this operation to be as fast as possible.¹ A common technique for this is to precompute the nearest palette index ...

Code
Nov 15, 2006
Post comments count0
Post likes count1

Manipulating the DIB color table for fun and profit

Raymond Chen
Raymond Chen

If you create a DIB section at 8bpp or lower, then it will come with a color table. Pixels in the bitmap are represented not by their red/blue/green component values, but are instead indices into the color table. For example, a 4bpp DIB section can have up to sixteen colors in its color table. Although displays that use 8bpp or lower are conside...

Code
Nov 14, 2006
Post comments count0
Post likes count0

Keeping classic hardware alive through emulation

Raymond Chen
Raymond Chen

At the Windows 2000 Conference and Expo which coincided with the operating system's launch, I paid a visit to the emulators.com booth, where they were excitedly showing off SoftMac 2000, a Mac emulator that ran on Windows 2000. Emulator trivia: MacOS booted in five seconds under Windows 2000, which was faster than the real Mac, ...

History
Nov 14, 2006
Post comments count0
Post likes count1

Blitting between color and monochrome DCs

Raymond Chen
Raymond Chen

When blitting between color and monochrome DCs, The text foreground and background colors play a role. We saw earlier that when blitting from a monochrome DC to a color DC, the color black in the source turns into the destination's text color, and the color white in the source turns into the destination's background color. This came in handy when...

Code
Nov 13, 2006
Post comments count0
Post likes count0

New dessert lounge: Coco la ti da

Raymond Chen
Raymond Chen

After a Seattle Symphony concert, it has long been a tradition among my friends to walk the three blocks from Benaroya Hall, up University Street, past Luly Yang Couture to gawk at the jaw-dropping gowns in the window (the pictures on the web site fail to capture their fabulousness), arriving at the W Hotel, home of Earth & Ocean, where we w...

Non-Computer
Nov 13, 2006
Post comments count0
Post likes count0

What do bitwise operations mean for colors?

Raymond Chen
Raymond Chen

Someday, you're going to pass a raster operation to the function that entails bit manipulation. Something like perhaps, or possibly the dreaded . These bitwise operations make perfect sense for monochrome bitmaps, since those are one bit per pixel anyway. But what does it mean for color bitmaps? What do you get when you "and" together forest gree...

Code
Nov 10, 2006
Post comments count0
Post likes count0

Converting an HRESULT to a Win32 error code: Diagram and answer to exercise

Raymond Chen
Raymond Chen

Here's the diagram from How do I convert an HRESULT to a Win32 error code?. If you are offended by VML, cover your ears and hum for a while. The little sliver at the top is the mapping of zero to zero. The big white box at the bottom is the mapping of all negative numbers to corresponding negative numbers. And the rainbow represents the mapp...

Code
Nov 9, 2006
Post comments count0
Post likes count0

A modest proposal: Solving the problem of steroids in baseball

Raymond Chen
Raymond Chen

In recent years, the issue of steroids in baseball has been the source of much hand-wringing. Some people argue that steroids are ruining the game. Others say that you can't go around trampling the Bill of Rights and punishing people for doing things that are perfectly legal anyway. To resolve this issue, I present this modest proposal. Toda...

Non-ComputerA modest proposal
Nov 9, 2006
Post comments count0
Post likes count0

Why can't you use the Tab key to select items from the auto-complete drop-down?

Raymond Chen
Raymond Chen

An anonymous commenter asked why the Tab key doesn't select items from the auto-complete drop-down list. The answer: Because that key already has some other meaning. The Tab key is used to navigate among controls in a dialog box. Adding auto-complete behavior to an existing dialog would disturb the tab order, which would in turn frustrate people ...

Other