示例#1
0
DWORD
lsd_display_stretchdibits(WORD msg, HDC32 hDC32, DWORD dwParam,
			LPLSDS_PARAMS lpStruct)
{
    LSDE_STRETCHDATA *lpsd = &lpStruct->lsde.stretchdata;
    HBITMAP hDIB,hBMPOld;
    HDC hCompatDC;
    HDC32 hCompatDC32;
    BOOL bRet;
    LPLOGPALETTE lp;
    HPALETTE     hpal,hpalold = 0;

    if (!lpsd || !lpsd->lpbmi)
	return 0;

    if (!(hCompatDC = CreateCompatibleDC(GETHDC16(hDC32))))
	return 0;

    hpal = hDC32->hPalette;
    lp   = WinMalloc(sizeof(LOGPALETTE) + sizeof(PALETTEENTRY)*356);

    GetPaletteEntries(hpal,0,256,lp->palPalEntry);
    lp->palVersion = 0x300;
    lp->palNumEntries = 256;

    hpal = CreatePalette(lp);
    WinFree(lp);

    if (hpal)
       hpalold = SelectPalette(hCompatDC,hpal,0);

    if (!(hDIB = CreateDIBitmap(hCompatDC,&lpsd->lpbmi->bmiHeader,
	    CBM_INIT,lpsd->lpvBits,lpsd->lpbmi,lpsd->fuColorUse))) {
	DeleteDC(hCompatDC);
	return 0;
    }
    hBMPOld = SelectObject(hCompatDC,hDIB);

    if (hDC32->dwInvalid & IM_BRUSHMASK)
	DisplayValidate(hDC32,lpStruct,IM_BRUSHMASK);

    hCompatDC32 = GETDCINFO(hCompatDC);
    lpsd->hSrcDC32 = (HDC32)(hCompatDC32->lpDrvData);
    RELEASEDCINFO(hCompatDC32);

    bRet = (BOOL)DRVCALL_GRAPHICS(PGH_STRETCHBLT,
		hDC32->lpDrvData,0L,lpStruct);

    if (hpal) {
       SelectPalette(hCompatDC, hpalold, 0);
       DeleteObject(hpal);
    }

    SelectObject(hCompatDC, hBMPOld);
    DeleteObject(hDIB);
    DeleteDC(hCompatDC);
    return (bRet)?lpsd->yDest:0;
}
示例#2
0
DWORD
lsd_display_extfloodfill(WORD msg, HDC32 hDC32, DWORD dwParam,
			LPLSDS_PARAMS lpStruct)
{
    HDC hDC = GETHDC16(hDC32);
    RECT rc;

    if (hDC32->dwInvalid & (IM_BRUSHMASK|IM_ROP2MASK))
	DisplayValidate(hDC32, lpStruct, IM_BRUSHMASK|IM_ROP2MASK);

    GetClipBox(hDC, &rc);
    LPtoDP(hDC,(LPPOINT)&rc,2);
    /* For child windows, LPtoDP does not take into account DOx/DOy; */
    /* we need here actual position in the physical GC -- Lana K. */
    OffsetRect(&rc,hDC32->DOx,hDC32->DOy);

    return DRVCALL_GRAPHICS(PGH_FLOODFILL,hDC32->lpDrvData,&rc,lpStruct);
}
示例#3
0
文件: dib.c 项目: chunhualiu/OpenNT
LPVOID DumpDibInfo(PDIBINFO pdi)
{
    DIBINFO di;
    
    READMEM_XRET(di, pdi);
    pdi = &di;  

    PRINTF(">> Structure at %08X\n", (DWORD)(LPVOID)pdi);
    PRINTF("di_hdc: (32)%08X (16)%04X\n", pdi->di_hdc, GETHDC16(pdi->di_hdc));
    PRINTF("di_newdib: %08X\n", (DWORD)pdi->di_newdib);
    PRINTF("di_newIntelDib: %08X\n", (DWORD)pdi->di_newIntelDib);
    PRINTF("di_hbm: (32)%08X\n", (DWORD)pdi->di_hbm);
    PRINTF("di_dibsize: %08X\n", (DWORD)pdi->di_dibsize);
    PRINTF("di_originaldibsel: %08X\n", (DWORD)pdi->di_originaldibsel);
    PRINTF("di_originaldibflags: %08X\n", (DWORD)pdi->di_originaldibflags);
    PRINTF("di_lockcount: %08X\n", (DWORD)pdi->di_lockcount);
    PRINTF("\n");

    return (LPVOID)pdi->di_next;
}
示例#4
0
BOOL
GdiSelectBrush(HDC32 hDC32, LPBRUSHINFO lpBrushInfo)
{
    UINT uiCompatibility;
    BOOL bDither;
    COLORREF crColor,crTemp;
    LPIMAGEINFO lpImageInfo;
    HBITMAP hBitmap;
    int nDepth = 0;
    WORD wBrushType;
    int i;

    if (lpBrushInfo->lpBrush.lbColor & PALETTE_MASK)
	crColor = TWIN_PaletteRGB(hDC32, lpBrushInfo->lpBrush.lbColor);
    else
	crColor = lpBrushInfo->lpBrush.lbColor;

    if (lpBrushInfo->lpBrush.lbStyle == BS_SOLID) {
	wBrushType = LOWORD(lpBrushInfo->dwFlags);
	if (!(lpBrushInfo->dwFlags & DCX_DISPLAY_DC))
	    /* we have to re-realize solid brush, dither if needed */
	    wBrushType = BFP_UNASSIGNED;
	if (hDC32->hBitmap) {
	    /* if the brush is realized, but its depth is different */
	    /* from the currently selected bitmap, it has to be re- */
	    /* realized */
	    lpImageInfo = GETBITMAPINFO(hDC32->hBitmap);
	    nDepth = lpImageInfo->BitsPixel;
	    if (nDepth != (int)LOBYTE(HIWORD(lpBrushInfo->dwFlags)))
		wBrushType = BFP_UNASSIGNED;
	    RELEASEBITMAPINFO(lpImageInfo);
	}

	if (wBrushType == BFP_UNASSIGNED) {
	    /* solid brush needs to be realized;		*/
	    /* gets resolved to either BFP_PIXEL (solid color)	*/
	    /* or BFP_PIXMAP (dithered pattern)		  	*/
	    if (nDepth == 1) {
		if ((crColor == RGB(0,0,0)) || crColor == RGB(255,255,255))
		    bDither = FALSE;
		else
		    bDither = TRUE;
	    }
	    else {
		uiCompatibility = GetCompatibilityFlags(0);
		if (!(uiCompatibility & WD_NODITHERPURE)) {
		    for (i = 0, bDither = TRUE; bDither && i < 16; i ++) 
			if (RGB(VGAColors[i].rgbRed,
				VGAColors[i].rgbGreen,
				VGAColors[i].rgbBlue) == crColor)
			    bDither = FALSE;
		}
		else {
		    crTemp = GetNearestColor(GETHDC16(hDC32),crColor);
		    if (lpBrushInfo->lpBrush.lbColor & PALETTE_RGB) {
			bDither = FALSE;
			crColor = crTemp;
		    }
		    else 
			bDither = (crColor != crTemp);
		}
	    }
	    if (!bDither) {
		wBrushType = BFP_PIXEL;
		lpBrushInfo->lpPrivate = (LPVOID)DRVCALL_COLORS
				(PLH_MAKEPIXEL,
				 crColor,
				 0L,0L);
	    }
	    else {
		hBitmap = GdiDitherColor
			(GETHDC16(hDC32),crColor,nDepth);
		lpBrushInfo->lpBrush.lbHatch = (int)hBitmap;
		wBrushType = BFP_PIXMAP;
		lpImageInfo = GETBITMAPINFO(hBitmap);
		if (!lpImageInfo) {
		    return FALSE;
		}
		lpBrushInfo->lpPrivate = (LPVOID)DRVCALL_IMAGES
				(PIH_CREATEBRUSH,
				BFP_PIXMAP,0L,
				lpImageInfo->lpDrvData);
		RELEASEBITMAPINFO(lpImageInfo);
	    }
	    lpBrushInfo->dwFlags = DCX_DISPLAY_DC | wBrushType;
	    lpBrushInfo->dwFlags |= (BYTE)nDepth << 16;
	}
    }
    if (!lpBrushInfo->fIsRealized) {
	LSDS_PARAMS argptr;
	argptr.lsde_validate.dwInvalidMask = 0;
	argptr.lsde.point = hDC32->ptBrushOrg;
	DRVCALL_GRAPHICS(PGH_SETBRUSHORG,
				(DWORD)hDC32->lpDrvData,0L, &argptr);
	lpBrushInfo->fIsRealized = TRUE;
    }
    return TRUE;
}
示例#5
0
DWORD
lsd_display_stretchblt(WORD msg,HDC32 hDC32,DWORD dwParam,
			LPLSDS_PARAMS lpStruct)
{
    DWORD dwRet;
    POINT pt;
    SIZE sz;
    LSDE_STRETCHDATA *lpsd = &lpStruct->lsde.stretchdata;

    if (hDC32->dwInvalid & (IM_BRUSHMASK|IM_TEXTCOLORMASK|IM_BKCOLORMASK))
	DisplayValidate(hDC32, lpStruct,
		IM_BRUSHMASK|IM_TEXTCOLORMASK|IM_BKCOLORMASK);

    if (msg == LSD_PATBLT) {
	if (lpsd->nWidthDest < 0) {
	    lpsd->nWidthDest = abs(lpsd->nWidthDest);
	    lpsd->xDest -= lpsd->nWidthDest;
	}
	if (lpsd->nHeightDest < 0) {
	    lpsd->nHeightDest = abs(lpsd->nHeightDest);
	    lpsd->yDest -= lpsd->nHeightDest;
	}
	lpsd->nWidthSrc = lpsd->nWidthDest;
	lpsd->nHeightSrc = lpsd->nHeightDest;
    }
    else if (lpsd->hSrcDC32) {
	pt.x = lpsd->xSrc;
	pt.y = lpsd->ySrc;

#if	0
	LPtoDP(GETHDC16(lpsd->hSrcDC32),&pt,1);
	/* LPtoDP uses MM_UAPPLY macros, so DC origins are not taken into */
	/* account; we have to explicitly add them in */
	lpsd->xSrc = pt.x + lpsd->hSrcDC32->DOx;
	lpsd->ySrc = pt.y + lpsd->hSrcDC32->DOy;
#endif	/* 0 */

	/* MM_UAPPLY has been replaced by MM0_LPtoDP_X() and MM0_LPtoDP_Y()
	 * which also work with world transforms.  The 0 in MM0 means that
	 * it assumes that the DC origin is (0,0).  In other words, MM0_*()
	 * does not take the DC origin into account.
	 *
	 * MM_LPtoDP_X() and MM_LPtoDP_Y() have also been added which take
	 * the DC origin into account.  These two functions replace MM_APPLY.
	 *
	 * Hence, it ought to be possible to replace the three lines above
         * with these two...
	 */
	lpsd->xSrc = MM_LPtoDP_X(lpsd->hSrcDC32, pt.x, pt.y);
	lpsd->ySrc = MM_LPtoDP_Y(lpsd->hSrcDC32, pt.x, pt.y);

	sz.cx = lpsd->nWidthSrc;
	sz.cy = lpsd->nHeightSrc;
	LEtoDE(lpsd->hSrcDC32,&sz);
	lpsd->nWidthSrc = sz.cx;
	lpsd->nHeightSrc = sz.cy;

	/*
	 *  Some code to take into account a corresponding fix
	 *  in lsd_mm_stretchblt(), which should have been applied
	 *  here as well.
	 */
	if ((lpsd->hSrcDC32->VEy ^ lpsd->hSrcDC32->WEy) < 0  && lpsd->nHeightSrc < 0)
	    lpsd->nHeightSrc = abs(lpsd->nHeightSrc);
	if ((lpsd->hSrcDC32->VEx ^ lpsd->hSrcDC32->WEx) < 0  && lpsd->nWidthSrc < 0)
	    lpsd->nWidthSrc = abs(lpsd->nWidthSrc);

	if (lpsd->hSrcDC32->dwInvalid & IM_BKCOLORMASK)
	    DisplayValidate(lpsd->hSrcDC32,lpStruct, IM_SRCBKCOLORMASK);

	/* this field is overloaded */
	lpsd->hSrcDC32 = (HDC32)(lpsd->hSrcDC32->lpDrvData);
    }

    dwRet = DRVCALL_GRAPHICS(PGH_STRETCHBLT,hDC32->lpDrvData,0L,lpStruct);
    return dwRet;
}