/*********************************************************************** * MFDRV_SelectBrush */ HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) { INT16 index; index = MFDRV_FindObject(dev, hbrush); if( index < 0 ) { index = MFDRV_CreateBrushIndirect( dev, hbrush ); if( index < 0 ) return 0; GDI_hdc_using_object(hbrush, dev->hdc); } return MFDRV_SelectObject( dev, index ) ? hbrush : 0; }
/*********************************************************************** * MFDRV_SelectBrush */ HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, HBITMAP bitmap, const BITMAPINFO *info, void *bits, UINT usage ) { INT16 index; index = MFDRV_FindObject(dev, hbrush); if( index < 0 ) { index = MFDRV_CreateBrushIndirect( dev, hbrush ); if( index < 0 ) return 0; GDI_hdc_using_object(hbrush, dev->hdc); } return MFDRV_SelectObject( dev, index ) ? hbrush : 0; }
/*********************************************************************** * MFDRV_SelectBrush */ HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) { METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev; INT16 index; index = MFDRV_FindObject(dev, hbrush); if( index < 0 ) { index = MFDRV_CreateBrushIndirect( dev, hbrush ); if( index < 0 ) return 0; GDI_hdc_using_object(hbrush, physDev->hdc); } return MFDRV_SelectObject( dev, index ) ? hbrush : HGDI_ERROR; }
/*********************************************************************** * MFDRV_SelectFont */ HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT hfont ) { LOGFONTW font; INT16 index; index = MFDRV_FindObject(dev, hfont); if( index < 0 ) { if (!GetObjectW( hfont, sizeof(font), &font )) return 0; index = MFDRV_CreateFontIndirect(dev, hfont, &font); if( index < 0 ) return 0; GDI_hdc_using_object(hfont, dev->hdc); } return MFDRV_SelectObject( dev, index ) ? hfont : 0; }
/*********************************************************************** * MFDRV_SelectPen */ HPEN MFDRV_SelectPen( PHYSDEV dev, HPEN hpen ) { METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev; LOGPEN16 logpen; INT16 index; index = MFDRV_FindObject(dev, hpen); if( index < 0 ) { /* must be an extended pen */ INT size = GetObjectW( hpen, 0, NULL ); if (!size) return 0; if (size == sizeof(LOGPEN)) { LOGPEN pen; GetObjectW( hpen, sizeof(pen), &pen ); logpen.lopnStyle = pen.lopnStyle; logpen.lopnWidth.x = pen.lopnWidth.x; logpen.lopnWidth.y = pen.lopnWidth.y; logpen.lopnColor = pen.lopnColor; } else /* must be an extended pen */ { EXTLOGPEN *elp = HeapAlloc( GetProcessHeap(), 0, size ); GetObjectW( hpen, size, elp ); /* FIXME: add support for user style pens */ logpen.lopnStyle = elp->elpPenStyle; logpen.lopnWidth.x = elp->elpWidth; logpen.lopnWidth.y = 0; logpen.lopnColor = elp->elpColor; HeapFree( GetProcessHeap(), 0, elp ); } index = MFDRV_CreatePenIndirect( dev, hpen, &logpen ); if( index < 0 ) return 0; GDI_hdc_using_object(hpen, physDev->hdc); } return MFDRV_SelectObject( dev, index ) ? hpen : HGDI_ERROR; }
/*********************************************************************** * MFDRV_SelectFont */ HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) { METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev; LOGFONTW font; INT16 index; index = MFDRV_FindObject(dev, hfont); if( index < 0 ) { if (!GetObjectW( hfont, sizeof(font), &font )) return HGDI_ERROR; index = MFDRV_CreateFontIndirect(dev, hfont, &font); if( index < 0 ) return HGDI_ERROR; GDI_hdc_using_object(hfont, physDev->hdc); } return MFDRV_SelectObject( dev, index ) ? hfont : HGDI_ERROR; }