⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init.c

📁 Wine-20031016
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * Metafile driver initialisation functions * * Copyright 1996 Alexandre Julliard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#include <stdarg.h>#include <string.h>#include "windef.h"#include "winbase.h"#include "wine/winbase16.h"#include "gdi.h"#include "wownt32.h"#include "mfdrv/metafiledrv.h"#include "wine/debug.h"WINE_DEFAULT_DEBUG_CHANNEL(metafile);static const DC_FUNCTIONS MFDRV_Funcs ={    NULL,                            /* pAbortDoc */    MFDRV_AbortPath,                 /* pAbortPath */    NULL,                            /* pAngleArc */    MFDRV_Arc,                       /* pArc */    NULL,                            /* pArcTo */    MFDRV_BeginPath,                 /* pBeginPath */    MFDRV_BitBlt,                    /* pBitBlt */    NULL,                            /* pChoosePixelFormat */    MFDRV_Chord,                     /* pChord */    MFDRV_CloseFigure,               /* pCloseFigure */    NULL,                            /* pCreateBitmap */    NULL,                            /* pCreateDC */    NULL,                            /* pCreateDIBSection */    NULL,                            /* pDeleteBitmap */    NULL,                            /* pDeleteDC */    NULL,                            /* pDescribePixelFormat */    NULL,                            /* pDeviceCapabilities */    MFDRV_Ellipse,                   /* pEllipse */    NULL,                            /* pEndDoc */    NULL,                            /* pEndPage */    MFDRV_EndPath,                   /* pEndPath */    NULL,                            /* pEnumDeviceFonts */    MFDRV_ExcludeClipRect,           /* pExcludeClipRect */    NULL,                            /* pExtDeviceMode */    MFDRV_ExtEscape,                 /* pExtEscape */    MFDRV_ExtFloodFill,              /* pExtFloodFill */    MFDRV_ExtSelectClipRgn,          /* pExtSelectClipRgn */    MFDRV_ExtTextOut,                /* pExtTextOut */    MFDRV_FillPath,                  /* pFillPath */    MFDRV_FillRgn,                   /* pFillRgn */    MFDRV_FlattenPath,               /* pFlattenPath */    MFDRV_FrameRgn,                  /* pFrameRgn */    NULL,                            /* pGdiComment */    NULL,                            /* pGetBitmapBits */    NULL,                            /* pGetCharWidth */    NULL,                            /* pGetDCOrgEx */    NULL,                            /* pGetDIBColorTable */    NULL,                            /* pGetDIBits */    MFDRV_GetDeviceCaps,             /* pGetDeviceCaps */    NULL,                            /* pGetDeviceGammaRamp */    NULL,                            /* pGetNearestColor */    NULL,                            /* pGetPixel */    NULL,                            /* pGetPixelFormat */    NULL,                            /* pGetSystemPaletteEntries */    NULL,                            /* pGetTextExtentPoint */    NULL,                            /* pGetTextMetrics */    MFDRV_IntersectClipRect,         /* pIntersectClipRect */    MFDRV_InvertRgn,                 /* pInvertRgn */    MFDRV_LineTo,                    /* pLineTo */    NULL,                            /* pModifyWorldTransform */    MFDRV_MoveTo,                    /* pMoveTo */    MFDRV_OffsetClipRgn,             /* pOffsetClipRgn */    MFDRV_OffsetViewportOrg,         /* pOffsetViewportOrg */    MFDRV_OffsetWindowOrg,           /* pOffsetWindowOrg */    MFDRV_PaintRgn,                  /* pPaintRgn */    MFDRV_PatBlt,                    /* pPatBlt */    MFDRV_Pie,                       /* pPie */    MFDRV_PolyBezier,                /* pPolyBezier */    MFDRV_PolyBezierTo,              /* pPolyBezierTo */    NULL,                            /* pPolyDraw */    MFDRV_PolyPolygon,               /* pPolyPolygon */    NULL,                            /* pPolyPolyline */    MFDRV_Polygon,                   /* pPolygon */    MFDRV_Polyline,                  /* pPolyline */    NULL,                            /* pPolylineTo */    NULL,                            /* pRealizeDefaultPalette */    MFDRV_RealizePalette,            /* pRealizePalette */    MFDRV_Rectangle,                 /* pRectangle */    NULL,                            /* pResetDC */    MFDRV_RestoreDC,                 /* pRestoreDC */    MFDRV_RoundRect,                 /* pRoundRect */    MFDRV_SaveDC,                    /* pSaveDC */    MFDRV_ScaleViewportExt,          /* pScaleViewportExt */    MFDRV_ScaleWindowExt,            /* pScaleWindowExt */    MFDRV_SelectBitmap,              /* pSelectBitmap */    MFDRV_SelectBrush,               /* pSelectBrush */    MFDRV_SelectClipPath,            /* pSelectClipPath */    MFDRV_SelectFont,                /* pSelectFont */    MFDRV_SelectPalette,             /* pSelectPalette */    MFDRV_SelectPen,                 /* pSelectPen */    NULL,                            /* pSetArcDirection */    NULL,                            /* pSetBitmapBits */    MFDRV_SetBkColor,                /* pSetBkColor */    MFDRV_SetBkMode,                 /* pSetBkMode */    NULL,                            /* pSetDCOrg */    NULL,                            /* pSetDIBColorTable */    NULL,                            /* pSetDIBits */    MFDRV_SetDIBitsToDevice,         /* pSetDIBitsToDevice */    NULL,                            /* pSetDeviceClipping */    NULL,                            /* pSetDeviceGammaRamp */    MFDRV_SetMapMode,                /* pSetMapMode */    MFDRV_SetMapperFlags,            /* pSetMapperFlags */    MFDRV_SetPixel,                  /* pSetPixel */    NULL,                            /* pSetPixelFormat */    MFDRV_SetPolyFillMode,           /* pSetPolyFillMode */    MFDRV_SetROP2,                   /* pSetROP2 */    MFDRV_SetRelAbs,                 /* pSetRelAbs */    MFDRV_SetStretchBltMode,         /* pSetStretchBltMode */    MFDRV_SetTextAlign,              /* pSetTextAlign */    MFDRV_SetTextCharacterExtra,     /* pSetTextCharacterExtra */    MFDRV_SetTextColor,              /* pSetTextColor */    MFDRV_SetTextJustification,      /* pSetTextJustification */    MFDRV_SetViewportExt,            /* pSetViewportExt */    MFDRV_SetViewportOrg,            /* pSetViewportOrg */    MFDRV_SetWindowExt,              /* pSetWindowExt */    MFDRV_SetWindowOrg,              /* pSetWindowOrg */    NULL,                            /* pSetWorldTransform */    NULL,                            /* pStartDoc */    NULL,                            /* pStartPage */    MFDRV_StretchBlt,                /* pStretchBlt */    MFDRV_StretchDIBits,             /* pStretchDIBits */    MFDRV_StrokeAndFillPath,         /* pStrokeAndFillPath */    MFDRV_StrokePath,                /* pStrokePath */    NULL,                            /* pSwapBuffers */    MFDRV_WidenPath                  /* pWidenPath */};/********************************************************************** *	     MFDRV_AllocMetaFile */static DC *MFDRV_AllocMetaFile(void){    DC *dc;    METAFILEDRV_PDEVICE *physDev;    if (!(dc = DC_AllocDC( &MFDRV_Funcs, METAFILE_DC_MAGIC ))) return NULL;    physDev = (METAFILEDRV_PDEVICE *)HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));    if (!physDev)    {        GDI_FreeObject( dc->hSelf, dc );        return NULL;    }    dc->physDev = (PHYSDEV)physDev;    physDev->hdc = dc->hSelf;    physDev->dc = dc;    if (!(physDev->mh = HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev->mh) )))    {        HeapFree( GetProcessHeap(), 0, physDev );        GDI_FreeObject( dc->hSelf, dc );        return NULL;    }    physDev->nextHandle = 0;    physDev->hFile = 0;    physDev->mh->mtHeaderSize   = sizeof(METAHEADER) / sizeof(WORD);    physDev->mh->mtVersion      = 0x0300;    physDev->mh->mtSize         = physDev->mh->mtHeaderSize;    physDev->mh->mtNoObjects    = 0;    physDev->mh->mtMaxRecord    = 0;    physDev->mh->mtNoParameters = 0;    return dc;}/********************************************************************** *	     MFDRV_DeleteDC */static BOOL MFDRV_DeleteDC( PHYSDEV dev ){    METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;    DC *dc = physDev->dc;    if (physDev->mh) HeapFree( GetProcessHeap(), 0, physDev->mh );    HeapFree( GetProcessHeap(), 0, physDev );    dc->physDev = NULL;    GDI_FreeObject( dc->hSelf, dc );    return TRUE;}/********************************************************************** *	     CreateMetaFileA   (GDI32.@) * *  Create a new DC and associate it with a metafile. Pass a filename *  to create a disk-based metafile, NULL to create a memory metafile. * * RETURNS *  A handle to the metafile DC if successful, NULL on failure. */HDC WINAPI CreateMetaFileA( LPCSTR filename ) /* [in] Filename of disk metafile */{    HDC ret;    DC *dc;    METAFILEDRV_PDEVICE *physDev;    HANDLE hFile;    TRACE("'%s'\n", filename );    if (!(dc = MFDRV_AllocMetaFile())) return 0;    physDev = (METAFILEDRV_PDEVICE *)dc->physDev;    if (filename)  /* disk based metafile */    {        physDev->mh->mtType = METAFILE_DISK;        if ((hFile = CreateFileA(filename, GENERIC_WRITE, 0, NULL,				CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {            MFDRV_DeleteDC( dc->physDev );            return 0;        }        if (!WriteFile( hFile, (LPSTR)physDev->mh, sizeof(*physDev->mh), NULL,			NULL )) {            MFDRV_DeleteDC( dc->physDev );            return 0;	}	physDev->hFile = hFile;	/* Grow METAHEADER to include filename */	physDev->mh = MF_CreateMetaHeaderDisk(physDev->mh, filename);    }    else  /* memory based metafile */	physDev->mh->mtType = METAFILE_MEMORY;    TRACE("returning %p\n", dc->hSelf);    ret = dc->hSelf;    GDI_ReleaseObj( dc->hSelf );    return ret;}/********************************************************************** *          CreateMetaFileW   (GDI32.@) */HDC WINAPI CreateMetaFileW(LPCWSTR filename){    LPSTR filenameA;    DWORD len;    HDC hReturnDC;    if (!filename) return CreateMetaFileA(NULL);    len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );    filenameA = HeapAlloc( GetProcessHeap(), 0, len );    WideCharToMultiByte( CP_ACP, 0, filename, -1, filenameA, len, NULL, NULL );    hReturnDC = CreateMetaFileA(filenameA);    HeapFree( GetProcessHeap(), 0, filenameA );    return hReturnDC;}/********************************************************************** *          MFDRV_CloseMetaFile */static DC *MFDRV_CloseMetaFile( HDC hdc ){    DC *dc;    METAFILEDRV_PDEVICE *physDev;    TRACE("(%p)\n", hdc );    if (!(dc = (DC *) GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ))) return 0;    physDev = (METAFILEDRV_PDEVICE *)dc->physDev;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -