Eng_xxx Punting not working

Hi all, I have been stuck on this problem for months and I really dont know where to bang my head. I am creating a DIB and punting it to the GDI so it can render the bitmap. But the engine is returning the surface object with drawing anything on it; meaning the buffer pointed by pvBits remains full of NULLS even after a call to the engine rendering functions. Some of my code goes like this: hHeap = GetProcessHeap(); pvBits= (LPBYTE)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, (SIZE_T) (pPDev->HorzRes * pPDev->VertRes)); *phBmp = EngCreateBitmap(szlBmp, lBmpDelta, Format, BMF_TOPDOWN |BMF_NOZEROINIT, pvBits)); EngAssociateSurface((HSURF)*phBmp, (HDEV)pPDev->hpdev, 0)); pso = EngLockSurface((HSURF)*phBmp); then (assuming DrvLineTo) EngLineTo(pTempSurf, &clip, pbo, 10, 100, 40, 400, &rect, R2_COPYPEN | (R2_COPYPEN << 2));
// Just a test to see if it draws, note clipping fits drawing surface and brush is a solid black brush I tried it in many ways, but still the buffer remains all 0s. I dont really know what to do since our printer only takes bitmaps and I need to generate a bitmap. Should I do build my own graphics engine??

Thanks alot
Adam


Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze.

The first parameter to EngLineTo is a SURFOBJ.

BOOL
EngLineTo(
SURFOBJ *pso,
CLIPOBJ *pco,
BRUSHOBJ *pbo,
LONG x1,
LONG y1,
LONG x2,
LONG y2,
RECTL *prclBounds,
MIX mix
);

Maybe you should use pso instead of pTempSurf.

Sincerely,
William Michael Jones “Mike”

adam darmanin" wrote in message news:xxxxx@ntdev…
Hi all, I have been stuck on this problem for months and I really dont know where to bang my head. I am creating a DIB and punting it to the GDI so it can render the bitmap. But the engine is returning the surface object with drawing anything on it; meaning the buffer pointed by pvBits remains full of NULLS even after a call to the engine rendering functions. Some of my code goes like this: hHeap = GetProcessHeap(); pvBits= (LPBYTE)HeapAlloc(hHeap, HEAP_ZERO_MEMORY, (SIZE_T) (pPDev->HorzRes * pPDev->VertRes)); *phBmp = EngCreateBitmap(szlBmp, lBmpDelta, Format, BMF_TOPDOWN |BMF_NOZEROINIT, pvBits)); EngAssociateSurface((HSURF)*phBmp, (HDEV)pPDev->hpdev, 0)); pso = EngLockSurface((HSURF)*phBmp); then (assuming DrvLineTo) EngLineTo(pTempSurf, &clip, pbo, 10, 100, 40, 400, &rect, R2_COPYPEN | (R2_COPYPEN << 2));// Just a test to see if it draws, note clipping fits
drawing surface and brush is a solid black brush I tried it in many ways, but still the buffer remains all 0s. I dont really know what to do since our printer only takes bitmaps and I need to generate a bitmap. Should I do build my own graphics engine?? Thanks alotAdam

------------------------------------------------------------------------------
Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze.

pTEmp and pso are the same thing, except on is returned by a function I
built to make a temporary DIB surface for the GDI to access, which it isnt
doing no matter what arguments I pass.

Could it be that since the driver is in user mode and this call is in Kernel
it isa not getting passed? Or may it requires certsain coordinate system or
colour?

Adam

Take this simple example. Assuming I have a black and white printer and
wish to draw a black line across the surface.

  1. In DrvEnablePDEV

hsurf = EngCreateDeviceSurface((DHSURF)pPDev, SurfSize, BMF_1BPP)
EngAssociateSurface(hsurf, (HDEV)hpdev, /*my hooks*/))

and return HSURF

  1. In DrvEnableSurface:

// FIlling the DEVINFO
// CYMK meaning 0 is white 1 is black, also tell the GDI to do ICM
pDevInfo->flGraphicsCaps = GCAPS_CMYKCOLOR | GCAPS_ICM;
pDevInfo->cxDither = 0;
pDevInfo->cyDither = 0;
pDevInfo->iDitherFormat = BMF_1BPP;

// where 0 is white and index 1 is black in DevColor array
DevColor[0] = CMYK(255, 255, 255, 0);
DevColor[1] = CMYK(0, 0, 0, 255);
pDevInfo->hpalDefault = EngCreatePalette(PAL_INDEXED, 2, DevColor, 0, 0,
0)))

//Filling the GDI info
pGDIInfo->ulHTOutputFormat = HT_FORMAT_1BPP;
pGDIInfo->flHTFlags = HT_FLAG_OUTPUT_CMY;
pGDIInfo->cBitsPixel = 1;
pGDIInfo->cPlanes = 1;
pGDIInfo->ulNumColors = 2;

  1. NOw in one of the many hooked functions; assume I wish to create a very
    simple black and white line

//szLbmp is 400 x 400 and lBMpDelta is the number of bytes to pass to jump a
raster row
hTempbmp = EngCreateBitmap(szlBmp, lBmpDelta, BMF_1BPP, BMF_TOPDOWN, NULL)
EngAssociateSurface((HSURF)hTempbmp, (HDEV)hpdev, 0))
pTempSurf = EngLockSurface((HSURF)hTempbmp);

// Create a sample clip region to test
ZeroMemory(&tempClip, sizeof(CLIPOBJ));
tempClip.iMode = TC_RECTANGLES;
tempClip.iFComplexity = FC_RECT;
tempClip.iDComplexity = DC_RECT;
tempClip.iUniq = 1;

tempClip.rclBounds.top = 0;
tempClip.rclBounds.bottom = 400;
tempClip.rclBounds.left = 0;
tempClip.rclBounds.right = 400;

TempBrush.flColorType = BR_CMYKCOLOR;
TempBrush.iSolidColor = CMYK(0,0,0,255);
// Or same as TempBrush.iSolidColor = 1 (index 1 is black)

// Now punt and tell it to just copy the pens bits
EngLineTo(pTempSurf, &tempClip, &TempBrush, 2, 140, 2, 180,
&(tempClip.rclBounds), (R2_COPYPEN | (R2_COPYPEN << 8)));

ANd of course nothing gets rendered or touched. Why? IS the windows engine
bugged?

Best regards
Adam