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

📄 init.c

📁 Wine-20031016
💻 C
📖 第 1 页 / 共 2 页
字号:
/* * Enhanced MetaFile driver initialisation functions * * Copyright 1999 Huw D M Davies * * 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 "wingdi.h"#include "gdi.h"#include "enhmfdrv/enhmetafiledrv.h"#include "wine/debug.h"WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);static const DC_FUNCTIONS EMFDRV_Funcs ={    NULL,                            /* pAbortDoc */    EMFDRV_AbortPath,                /* pAbortPath */    NULL,                            /* pAngleArc */    EMFDRV_Arc,                      /* pArc */    NULL,                            /* pArcTo */    EMFDRV_BeginPath,                /* pBeginPath */    EMFDRV_BitBlt,                   /* pBitBlt */    NULL,                            /* pChoosePixelFormat */    EMFDRV_Chord,                    /* pChord */    EMFDRV_CloseFigure,              /* pCloseFigure */    NULL,                            /* pCreateBitmap */    NULL,                            /* pCreateDC */    NULL,                            /* pCreateDIBSection */    NULL,                            /* pDeleteBitmap */    NULL,                            /* pDeleteDC */    NULL,                            /* pDescribePixelFormat */    NULL,                            /* pDeviceCapabilities */    EMFDRV_Ellipse,                  /* pEllipse */    NULL,                            /* pEndDoc */    NULL,                            /* pEndPage */    EMFDRV_EndPath,                  /* pEndPath */    NULL,                            /* pEnumDeviceFonts */    EMFDRV_ExcludeClipRect,          /* pExcludeClipRect */    NULL,                            /* pExtDeviceMode */    NULL,                            /* pExtEscape */    EMFDRV_ExtFloodFill,             /* pExtFloodFill */    EMFDRV_ExtSelectClipRgn,         /* pExtSelectClipRgn */    EMFDRV_ExtTextOut,               /* pExtTextOut */    EMFDRV_FillPath,                 /* pFillPath */    EMFDRV_FillRgn,                  /* pFillRgn */    EMFDRV_FlattenPath,              /* pFlattenPath */    EMFDRV_FrameRgn,                 /* pFrameRgn */    EMFDRV_GdiComment,               /* pGdiComment */    NULL,                            /* pGetBitmapBits */    NULL,                            /* pGetCharWidth */    NULL,                            /* pGetDCOrgEx */    NULL,                            /* pGetDIBColorTable */    NULL,                            /* pGetDIBits */    EMFDRV_GetDeviceCaps,            /* pGetDeviceCaps */    NULL,                            /* pGetDeviceGammaRamp */    NULL,                            /* pGetNearestColor */    NULL,                            /* pGetPixel */    NULL,                            /* pGetPixelFormat */    NULL,                            /* pGetSystemPaletteEntries */    NULL,                            /* pGetTextExtentPoint */    NULL,                            /* pGetTextMetrics */    EMFDRV_IntersectClipRect,        /* pIntersectClipRect */    EMFDRV_InvertRgn,                /* pInvertRgn */    EMFDRV_LineTo,                   /* pLineTo */    EMFDRV_ModifyWorldTransform,     /* pModifyWorldTransform */    EMFDRV_MoveTo,                   /* pMoveTo */    EMFDRV_OffsetClipRgn,            /* pOffsetClipRgn */    EMFDRV_OffsetViewportOrg,        /* pOffsetViewportOrg */    EMFDRV_OffsetWindowOrg,          /* pOffsetWindowOrg */    EMFDRV_PaintRgn,                 /* pPaintRgn */    EMFDRV_PatBlt,                   /* pPatBlt */    EMFDRV_Pie,                      /* pPie */    NULL,                            /* pPolyBezier */    NULL,                            /* pPolyBezierTo */    NULL,                            /* pPolyDraw */    EMFDRV_PolyPolygon,              /* pPolyPolygon */    EMFDRV_PolyPolyline,             /* pPolyPolyline */    EMFDRV_Polygon,                  /* pPolygon */    EMFDRV_Polyline,                 /* pPolyline */    NULL,                            /* pPolylineTo */    NULL,                            /* pRealizeDefaultPalette */    NULL,                            /* pRealizePalette */    EMFDRV_Rectangle,                /* pRectangle */    NULL,                            /* pResetDC */    EMFDRV_RestoreDC,                /* pRestoreDC */    EMFDRV_RoundRect,                /* pRoundRect */    EMFDRV_SaveDC,                   /* pSaveDC */    EMFDRV_ScaleViewportExt,         /* pScaleViewportExt */    EMFDRV_ScaleWindowExt,           /* pScaleWindowExt */    EMFDRV_SelectBitmap,             /* pSelectBitmap */    EMFDRV_SelectBrush,              /* pSelectBrush */    EMFDRV_SelectClipPath,           /* pSelectClipPath */    EMFDRV_SelectFont,               /* pSelectFont */    NULL,                            /* pSelectPalette */    EMFDRV_SelectPen,                /* pSelectPen */    EMFDRV_SetArcDirection,          /* pSetArcDirection */    NULL,                            /* pSetBitmapBits */    EMFDRV_SetBkColor,               /* pSetBkColor */    EMFDRV_SetBkMode,                /* pSetBkMode */    NULL,                            /* pSetDCOrg */    NULL,                            /* pSetDIBColorTable */    NULL,                            /* pSetDIBits */    EMFDRV_SetDIBitsToDevice,        /* pSetDIBitsToDevice */    NULL,                            /* pSetDeviceClipping */    NULL,                            /* pSetDeviceGammaRamp */    EMFDRV_SetMapMode,               /* pSetMapMode */    EMFDRV_SetMapperFlags,           /* pSetMapperFlags */    NULL,                            /* pSetPixel */    NULL,                            /* pSetPixelFormat */    EMFDRV_SetPolyFillMode,          /* pSetPolyFillMode */    EMFDRV_SetROP2,                  /* pSetROP2 */    NULL,                            /* pSetRelAbs */    EMFDRV_SetStretchBltMode,        /* pSetStretchBltMode */    EMFDRV_SetTextAlign,             /* pSetTextAlign */    NULL,                            /* pSetTextCharacterExtra */    EMFDRV_SetTextColor,             /* pSetTextColor */    EMFDRV_SetTextJustification,     /* pSetTextJustification */     EMFDRV_SetViewportExt,           /* pSetViewportExt */    EMFDRV_SetViewportOrg,           /* pSetViewportOrg */    EMFDRV_SetWindowExt,             /* pSetWindowExt */    EMFDRV_SetWindowOrg,             /* pSetWindowOrg */    EMFDRV_SetWorldTransform,        /* pSetWorldTransform */    NULL,                            /* pStartDoc */    NULL,                            /* pStartPage */    EMFDRV_StretchBlt,               /* pStretchBlt */    EMFDRV_StretchDIBits,            /* pStretchDIBits */    EMFDRV_StrokeAndFillPath,        /* pStrokeAndFillPath */    EMFDRV_StrokePath,               /* pStrokePath */    NULL,                            /* pSwapBuffers */    EMFDRV_WidenPath                 /* pWidenPath */};/********************************************************************** *	     EMFDRV_DeleteDC */static BOOL EMFDRV_DeleteDC( PHYSDEV dev ){    EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;    DC *dc = physDev->dc;    if (physDev->emh) HeapFree( GetProcessHeap(), 0, physDev->emh );    HeapFree( GetProcessHeap(), 0, physDev );    dc->physDev = NULL;    GDI_FreeObject( dc->hSelf, dc );    return TRUE;}/****************************************************************** *         EMFDRV_WriteRecord * * Warning: this function can change the pointer to the metafile header. */BOOL EMFDRV_WriteRecord( PHYSDEV dev, EMR *emr ){    DWORD len;    ENHMETAHEADER *emh;    EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;    physDev->emh->nBytes += emr->nSize;    physDev->emh->nRecords++;    if(physDev->hFile) {        TRACE("Writing record to disk\n");	if (!WriteFile(physDev->hFile, (char *)emr, emr->nSize, NULL, NULL))	    return FALSE;    } else {        DWORD nEmfSize = HeapSize(GetProcessHeap(), 0, physDev->emh);        len = physDev->emh->nBytes;        if (len > nEmfSize) {            nEmfSize += (nEmfSize / 2) + emr->nSize;            emh = HeapReAlloc(GetProcessHeap(), 0, physDev->emh, nEmfSize);            if (!emh) return FALSE;            physDev->emh = emh;        }        memcpy((CHAR *)physDev->emh + physDev->emh->nBytes - emr->nSize, emr,               emr->nSize);    }    return TRUE;}/****************************************************************** *         EMFDRV_UpdateBBox */void EMFDRV_UpdateBBox( PHYSDEV dev, RECTL *rect ){    EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;    RECTL *bounds = &physDev->emh->rclBounds;    if(bounds->left > bounds->right) {/* first rect */        *bounds = *rect;	return;    }    bounds->left   = min(bounds->left,   rect->left);    bounds->top    = min(bounds->top,    rect->top);    bounds->right  = max(bounds->right,  rect->right);    bounds->bottom = max(bounds->bottom, rect->bottom);    return;}/****************************************************************** *         EMFDRV_AddHandleDC * * Note: this function assumes that we never delete objects. * If we do someday, we'll need to maintain a table to re-use deleted * handles. */int EMFDRV_AddHandleDC( PHYSDEV dev ){    EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;    physDev->emh->nHandles++;    return physDev->nextHandle++;}

⌨️ 快捷键说明

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