question about lDelta in GDI calls

Hi,
?
I am a driver writer, developing a display driver for Windows XP environment. It is for a proprietary display HW.
?
My question is about the lDelta field in the SURFOBJ parameter getting on many of the Drv functions. DDK says “lDelta Specifies the count of bytes required to move down one scan line in the bitmap”. But i have noticed that in many conditions this comes as a negative value!!! I’m wondering what is mean by a negative pitch value? In that condition, how to interpret the pvBits and pvScan0 fields?
?
thanks
praveen

On Thu, Aug 21, 2008 at 11:53:13PM -0700, prvn ns wrote:

I am a driver writer, developing a display driver for Windows XP environment. It is for a proprietary display HW.

My question is about the lDelta field in the SURFOBJ parameter getting
on many of the Drv functions. DDK says “lDelta Specifies the count of
bytes required to move down one scan line in the bitmap”. But i have
noticed that in many conditions this comes as a negative value!!! I’m
wondering what is mean by a negative pitch value? In that condition,
how to interpret the pvBits and pvScan0 fields?

I’m very surprised you’ve never encountered this before. Standard DIBs
are stored “bottom up”; the first byte of memory is the pixel at the
lower left-hand corner. Thus, moving “down” one scanline requires
going to a lower address in memory – a negative lDelta.

In such a case, you’ll find pvBits points to (0,N-1), the bottom-most
scanline, which is first in memory, while pvScan0 points to (0,0), the
top-most scanline, which is last in memory.

In a “top doown” DIB, where lDelta is positive, pvBits and pvScan0
have the same address. Thus, to go through the scanlines in order
from Y=0 to Y=N-1, you should always start from pvScan0 and add
lDelta each time, even if lDelta is negative.

Tim Roberts, xxxxx@probo.com
Providenza & Boeklheide, Inc.