[ros-kernel] kmode GDI advise needed

Ge van Geldorp gvg at reactos.com
Tue Jun 22 11:16:32 CEST 2004


> From: Royce Mitchell III
> 
> Now, as I'm looking at it, BITMAPOBJ has a BITMAP member 
> called bitmap, which of course has a member called bmBits.
> 
> I'm assuming that since there's no DIBSECTION, we must get our bitmap 
> data from this member.
> 
> I also assume from the other members of the BITMAP object 
> that we have everything we need to know about the format of those
bits.

The bitmap can be a device-dependent bitmap, meaning it is not in one of
the standard DIB formats. The bitmap bits could even be stored in some
memory internal to the video card, inaccessible from the CPU.

> To make a long story short, I don't want to duplicate a *ton* of code 
> that already exists for what is basically a bitblt.
> 
> What would be the best way to reuse existing code to perform this blt 
> without having to make a copy of it?

Create a new SURFOBJ using EngCreateBitmap (which returns a PSURFOBJ,
not a HBITMAP) of the correct dimension and format. Convert the HBITMAP
passed in to a PSURFOBJ using BitmapToSurf. If required, create a
palette as described in the GetDIBits() documentation and use that
palette plus the palette in the DC to set up a XLATEOBJ. Then bitblt
using IntEngBitBlt() from the bitmap passed in to the temp SURFOBJ. Copy
the bits from the temp SURFOBJ to the output buffer using
MmCopyToCaller(). Destroy the temp SURFOBJ.

Ge van Geldorp.



More information about the Ros-kernel mailing list