static BOOL PSDRV_WriteImageMaskHeader(PHYSDEV dev, const BITMAPINFO *info, INT xDst, INT yDst, INT widthDst, INT heightDst, INT widthSrc, INT heightSrc) { PSCOLOR bkgnd, foregnd; assert(info->bmiHeader.biBitCount == 1); /* We'll write the mask with -ve polarity so that the foregnd color corresponds to a bit equal to 0 in the bitmap. */ PSDRV_CreateColor(dev, &foregnd, RGB(info->bmiColors[0].rgbRed, info->bmiColors[0].rgbGreen, info->bmiColors[0].rgbBlue) ); PSDRV_CreateColor(dev, &bkgnd, RGB(info->bmiColors[1].rgbRed, info->bmiColors[1].rgbGreen, info->bmiColors[1].rgbBlue) ); PSDRV_WriteGSave(dev); PSDRV_WriteNewPath(dev); PSDRV_WriteRectangle(dev, xDst, yDst, widthDst, heightDst); PSDRV_WriteSetColor(dev, &bkgnd); PSDRV_WriteFill(dev); PSDRV_WriteGRestore(dev); PSDRV_WriteSetColor(dev, &foregnd); PSDRV_WriteImage(dev, 1, xDst, yDst, widthDst, heightDst, widthSrc, heightSrc, TRUE, info->bmiHeader.biHeight < 0); return TRUE; }
static BOOL PSDRV_WriteImageHeader(PHYSDEV dev, const BITMAPINFO *info, INT xDst, INT yDst, INT widthDst, INT heightDst, INT widthSrc, INT heightSrc) { switch(info->bmiHeader.biBitCount) { case 1: case 4: case 8: PSDRV_WriteIndexColorSpaceBegin(dev, (1 << info->bmiHeader.biBitCount) - 1); PSDRV_WriteRGBQUAD(dev, info->bmiColors, 1 << info->bmiHeader.biBitCount); PSDRV_WriteIndexColorSpaceEnd(dev); break; case 16: case 24: case 32: { PSCOLOR pscol; pscol.type = PSCOLOR_RGB; pscol.value.rgb.r = pscol.value.rgb.g = pscol.value.rgb.b = 0.0; PSDRV_WriteSetColor(dev, &pscol); break; } } PSDRV_WriteImage(dev, info->bmiHeader.biBitCount, xDst, yDst, widthDst, heightDst, widthSrc, heightSrc, FALSE, info->bmiHeader.biHeight < 0); return TRUE; }
/********************************************************************** * * PSDRV_SetBrush * */ static BOOL PSDRV_SetBrush( PHYSDEV dev ) { PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); LOGBRUSH logbrush; BOOL ret = TRUE; if (!GetObjectA( GetCurrentObject(dev->hdc,OBJ_BRUSH), sizeof(logbrush), &logbrush )) { ERR("Can't get BRUSHOBJ\n"); return FALSE; } switch (logbrush.lbStyle) { case BS_SOLID: case BS_HATCHED: PSDRV_WriteSetColor(dev, &physDev->brush.color); break; case BS_NULL: break; default: ret = FALSE; break; } physDev->brush.set = TRUE; return ret; }
/*********************************************************************** * PSDRV_SetFont */ BOOL PSDRV_SetFont( PHYSDEV dev, BOOL vertical ) { PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); PSDRV_WriteSetColor(dev, &physDev->font.color); if (vertical && (physDev->font.set == VERTICAL_SET)) return TRUE; if (!vertical && (physDev->font.set == HORIZONTAL_SET)) return TRUE; switch(physDev->font.fontloc) { case Builtin: PSDRV_WriteSetBuiltinFont(dev); break; case Download: PSDRV_WriteSetDownloadFont(dev, vertical); break; default: ERR("fontloc = %d\n", physDev->font.fontloc); assert(1); break; } if (vertical) physDev->font.set = VERTICAL_SET; else physDev->font.set = HORIZONTAL_SET; return TRUE; }
/********************************************************************** * * PSDRV_SetPen * */ BOOL PSDRV_SetPen(PSDRV_PDEVICE *physDev) { if (physDev->pen.style != PS_NULL) { PSDRV_WriteSetColor(physDev, &physDev->pen.color); if(!physDev->pen.set) { PSDRV_WriteSetPen(physDev); physDev->pen.set = TRUE; } } return TRUE; }
/*********************************************************************** * PSDRV_ExtTextOut */ BOOL PSDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) { PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); BOOL bResult = TRUE; BOOL bClipped = FALSE; BOOL bOpaque = FALSE; TRACE("(x=%d, y=%d, flags=0x%08x, str=%s, count=%d, lpDx=%p)\n", x, y, flags, debugstr_wn(str, count), count, lpDx); if(physDev->job.id == 0) return FALSE; /* write font if not already written */ PSDRV_SetFont(dev); PSDRV_SetClip(dev); /* set clipping and/or draw background */ if ((flags & (ETO_CLIPPED | ETO_OPAQUE)) && (lprect != NULL)) { PSDRV_WriteGSave(dev); PSDRV_WriteRectangle(dev, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top); if (flags & ETO_OPAQUE) { bOpaque = TRUE; PSDRV_WriteGSave(dev); PSDRV_WriteSetColor(dev, &physDev->bkColor); PSDRV_WriteFill(dev); PSDRV_WriteGRestore(dev); } if (flags & ETO_CLIPPED) { bClipped = TRUE; PSDRV_WriteClip(dev); } bResult = PSDRV_Text(dev, x, y, flags, str, count, !(bClipped && bOpaque), lpDx); PSDRV_WriteGRestore(dev); } else { bResult = PSDRV_Text(dev, x, y, flags, str, count, TRUE, lpDx); } PSDRV_ResetClip(dev); return bResult; }
/*********************************************************************** * PSDRV_SetPixel */ COLORREF PSDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) { PSCOLOR pscolor; POINT pt; pt.x = x; pt.y = y; LPtoDP( dev->hdc, &pt, 1 ); PSDRV_SetClip(dev); /* we bracket the setcolor in gsave/grestore so that we don't trash the current pen colour */ PSDRV_WriteGSave(dev); PSDRV_WriteRectangle( dev, pt.x, pt.y, 0, 0 ); PSDRV_CreateColor( dev, &pscolor, color ); PSDRV_WriteSetColor( dev, &pscolor ); PSDRV_WriteFill( dev ); PSDRV_WriteGRestore(dev); PSDRV_ResetClip(dev); return color; }
/*********************************************************************** * * PSDRV_PatBlt */ BOOL PSDRV_PatBlt(PHYSDEV dev, struct bitblt_coords *dst, DWORD dwRop) { switch(dwRop) { case PATCOPY: PSDRV_SetClip(dev); PSDRV_WriteGSave(dev); PSDRV_WriteRectangle(dev, dst->visrect.left, dst->visrect.top, dst->visrect.right - dst->visrect.left, dst->visrect.bottom - dst->visrect.top ); PSDRV_Brush(dev, FALSE); PSDRV_WriteGRestore(dev); PSDRV_ResetClip(dev); return TRUE; case BLACKNESS: case WHITENESS: { PSCOLOR pscol; PSDRV_SetClip(dev); PSDRV_WriteGSave(dev); PSDRV_WriteRectangle(dev, dst->visrect.left, dst->visrect.top, dst->visrect.right - dst->visrect.left, dst->visrect.bottom - dst->visrect.top ); PSDRV_CreateColor( dev, &pscol, (dwRop == BLACKNESS) ? RGB(0,0,0) : RGB(0xff,0xff,0xff) ); PSDRV_WriteSetColor(dev, &pscol); PSDRV_WriteFill(dev); PSDRV_WriteGRestore(dev); PSDRV_ResetClip(dev); return TRUE; } default: FIXME("Unsupported rop %06x\n", dwRop); return FALSE; } }