ReactOS 0.4.16-dev-338-g34e76ad
emfdc.c File Reference
#include "config.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winnls.h"
#include "winerror.h"
#include "gdi_private.h"
#include "wine/wingdi16.h"
#include "wine/debug.h"
#include "winternl.h"
Include dependency graph for emfdc.c:

Go to the source code of this file.

Classes

struct  emf
 

Macros

#define HANDLE_LIST_INC   20
 
#define GdiGetEMFRestorDc   5
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (enhmetafile)
 
static BOOL emfdc_record (struct emf *emf, EMR *emr)
 
static void emfdc_update_bounds (struct emf *emf, RECTL *rect)
 
static UINT get_bitmap_info (HDC *hdc, HBITMAP *bitmap, BITMAPINFO *info)
 
static UINT emfdc_add_handle (struct emf *emf, HGDIOBJ obj)
 
static UINT emfdc_find_object (struct emf *emf, HGDIOBJ obj)
 
void emfdc_delete_object (HDC hdc, HGDIOBJ obj)
 
static DWORD emfdc_create_brush (struct emf *emf, HBRUSH brush)
 
static BOOL emfdc_select_brush (WINEDC *dc_attr, HBRUSH brush)
 
static BOOL emfdc_create_font (struct emf *emf, HFONT font)
 
static BOOL emfdc_select_font (WINEDC *dc_attr, HFONT font)
 
static DWORD emfdc_create_pen (struct emf *emf, HPEN hPen)
 
static BOOL emfdc_select_pen (WINEDC *dc_attr, HPEN pen)
 
static DWORD emfdc_create_palette (struct emf *emf, HPALETTE hPal)
 
BOOL EMFDC_SelectPalette (WINEDC *dc_attr, HPALETTE palette)
 
BOOL EMFDC_SelectObject (WINEDC *dc_attr, HGDIOBJ obj)
 
static BOOL can_use_short_points (const POINT *pts, UINT count)
 
static voidstore_points (POINTL *dest, const POINT *pts, UINT count, BOOL short_points)
 
static void get_points_bounds (RECTL *bounds, const POINT *pts, UINT count, WINEDC *dc_attr)
 
static BOOL emfdrv_stroke_and_fill_path (struct emf *emf, INT type)
 
BOOL EMFDC_MoveTo (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_LineTo (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_ArcChordPie (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD type)
 
BOOL EMFDC_AngleArc (WINEDC *dc_attr, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep)
 
BOOL EMFDC_Ellipse (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDC_Rectangle (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDC_RoundRect (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height)
 
BOOL EMFDC_SetPixel (WINEDC *dc_attr, INT x, INT y, COLORREF color)
 
static BOOL emfdc_polylinegon (WINEDC *dc_attr, const POINT *points, INT count, DWORD type)
 
BOOL EMFDC_Polyline (WINEDC *dc_attr, const POINT *points, INT count)
 
BOOL EMFDC_PolylineTo (WINEDC *dc_attr, const POINT *points, INT count)
 
BOOL EMFDC_Polygon (WINEDC *dc_attr, const POINT *pt, INT count)
 
BOOL EMFDC_PolyBezier (WINEDC *dc_attr, const POINT *pts, DWORD count)
 
BOOL EMFDC_PolyBezierTo (WINEDC *dc_attr, const POINT *pts, DWORD count)
 
static BOOL emfdc_poly_polylinegon (struct emf *emf, const POINT *pt, const INT *counts, UINT polys, DWORD type)
 
BOOL EMFDC_PolyPolyline (WINEDC *dc_attr, const POINT *pt, const DWORD *counts, DWORD polys)
 
BOOL EMFDC_PolyPolygon (WINEDC *dc_attr, const POINT *pt, const INT *counts, UINT polys)
 
BOOL EMFDC_PolyDraw (WINEDC *dc_attr, const POINT *pts, const BYTE *types, DWORD count)
 
BOOL EMFDC_ExtFloodFill (WINEDC *dc_attr, INT x, INT y, COLORREF color, UINT fill_type)
 
BOOL EMFDC_FillRgn (WINEDC *dc_attr, HRGN hrgn, HBRUSH hbrush)
 
BOOL EMFDC_FrameRgn (WINEDC *dc_attr, HRGN hrgn, HBRUSH hbrush, INT width, INT height)
 
static BOOL emfdc_paint_invert_region (struct emf *emf, HRGN hrgn, DWORD iType)
 
BOOL EMFDC_PaintRgn (WINEDC *dc_attr, HRGN hrgn)
 
BOOL EMFDC_InvertRgn (WINEDC *dc_attr, HRGN hrgn)
 
BOOL EMFDC_ExtTextOut (WINEDC *dc_attr, INT x, INT y, UINT flags, const RECT *rect, const WCHAR *str, UINT count, const INT *dx)
 
BOOL EMFDC_GradientFill (WINEDC *dc_attr, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode)
 
BOOL EMFDC_FillPath (WINEDC *dc_attr)
 
BOOL EMFDC_StrokeAndFillPath (WINEDC *dc_attr)
 
BOOL EMFDC_StrokePath (WINEDC *dc_attr)
 
static BOOL emfdrv_stretchblt (struct emf *emf, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, DWORD rop, DWORD type)
 
BOOL EMFDC_AlphaBlend (WINEDC *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, BLENDFUNCTION blend_function)
 
BOOL EMFDC_PatBlt (WINEDC *dc_attr, INT left, INT top, INT width, INT height, DWORD rop)
 
static BOOL rop_uses_src (DWORD rop)
 
BOOL EMFDC_BitBlt (WINEDC *dc_attr, INT x_dst, INT y_dst, INT width, INT height, HDC hdc_src, INT x_src, INT y_src, DWORD rop)
 
BOOL EMFDC_StretchBlt (WINEDC *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, DWORD rop)
 
BOOL EMFDC_TransparentBlt (WINEDC *dc_attr, int x_dst, int y_dst, int width_dst, int height_dst, HDC hdc_src, int x_src, int y_src, int width_src, int height_src, UINT color)
 
BOOL EMFDC_MaskBlt (WINEDC *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, HBITMAP mask, INT x_mask, INT y_mask, DWORD rop)
 
BOOL EMFDC_PlgBlt (WINEDC *dc_attr, const POINT *points, HDC hdc_src, INT x_src, INT y_src, INT width, INT height, HBITMAP mask, INT x_mask, INT y_mask)
 
BOOL EMFDC_StretchDIBits (WINEDC *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst, INT x_src, INT y_src, INT width_src, INT height_src, const void *bits, const BITMAPINFO *info, UINT usage, DWORD rop)
 
BOOL EMFDC_SetDIBitsToDevice (WINEDC *dc_attr, INT x_dst, INT y_dst, DWORD width, DWORD height, INT x_src, INT y_src, UINT startscan, UINT lines, const void *bits, const BITMAPINFO *info, UINT usage)
 
BOOL EMFDC_SetDCBrushColor (WINEDC *dc_attr, COLORREF color)
 
BOOL EMFDC_SetDCPenColor (WINEDC *dc_attr, COLORREF color)
 
BOOL EMFDC_SaveDC (WINEDC *dc_attr)
 
BOOL EMFDC_RestoreDC (WINEDC *dc_attr, INT level)
 
BOOL EMFDC_SetTextAlign (WINEDC *dc_attr, UINT align)
 
BOOL EMFDC_SetTextJustification (WINEDC *dc_attr, INT extra, INT breaks)
 
BOOL EMFDC_SetBkMode (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_SetBkColor (WINEDC *dc_attr, COLORREF color)
 
BOOL EMFDC_SetTextColor (WINEDC *dc_attr, COLORREF color)
 
BOOL EMFDC_SetROP2 (WINEDC *dc_attr, INT rop)
 
BOOL EMFDC_SetPolyFillMode (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_SetStretchBltMode (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_SetArcDirection (WINEDC *dc_attr, INT dir)
 
BOOL EMFDC_ExcludeClipRect (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDC_IntersectClipRect (WINEDC *dc_attr, INT left, INT top, INT right, INT bottom)
 
BOOL EMFDC_OffsetClipRgn (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_ExtSelectClipRgn (WINEDC *dc_attr, HRGN hrgn, INT mode)
 
BOOL EMFDC_SetMapMode (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_SetViewportExtEx (WINEDC *dc_attr, INT cx, INT cy)
 
BOOL EMFDC_SetWindowExtEx (WINEDC *dc_attr, INT cx, INT cy)
 
BOOL EMFDC_SetViewportOrgEx (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_SetWindowOrgEx (WINEDC *dc_attr, INT x, INT y)
 
BOOL EMFDC_ScaleViewportExtEx (WINEDC *dc_attr, INT x_num, INT x_denom, INT y_num, INT y_denom)
 
BOOL EMFDC_ScaleWindowExtEx (WINEDC *dc_attr, INT x_num, INT x_denom, INT y_num, INT y_denom)
 
BOOL EMFDC_SetLayout (WINEDC *dc_attr, DWORD layout)
 
BOOL EMFDC_SetWorldTransform (WINEDC *dc_attr, const XFORM *xform)
 
BOOL EMFDC_ModifyWorldTransform (WINEDC *dc_attr, const XFORM *xform, DWORD mode)
 
BOOL EMFDC_SetMapperFlags (WINEDC *dc_attr, DWORD flags)
 
BOOL EMFDC_AbortPath (WINEDC *dc_attr)
 
BOOL EMFDC_BeginPath (WINEDC *dc_attr)
 
BOOL EMFDC_CloseFigure (WINEDC *dc_attr)
 
BOOL EMFDC_EndPath (WINEDC *dc_attr)
 
BOOL EMFDC_FlattenPath (WINEDC *dc_attr)
 
BOOL EMFDC_SelectClipPath (WINEDC *dc_attr, INT mode)
 
BOOL EMFDC_WidenPath (WINEDC *dc_attr)
 
BOOL EMFDC_DeleteDC (WINEDC *dc_attr)
 
BOOL EMFDC_WriteEscape (WINEDC *dc_attr, INT nEscape, INT cbInput, LPSTR lpszInData, DWORD emrType)
 
BOOL EMFDC_WriteNamedEscape (WINEDC *dc_attr, PWCHAR pDriver, INT nEscape, INT cbInput, LPCSTR lpszInData)
 
BOOL EMFDC_SetMetaRgn (WINEDC *dc_attr)
 
BOOL EMFDC_SetBrushOrg (WINEDC *dc_attr, INT x, INT y)
 
BOOL WINAPI EMFDC_GdiComment (HDC hdc, UINT bytes, const BYTE *buffer)
 
HDC WINAPI CreateEnhMetaFileA (HDC hdc, const char *filename, const RECT *rect, const char *description)
 
HDC WINAPI CreateEnhMetaFileW (HDC hdc, const WCHAR *filename, const RECT *rect, const WCHAR *description)
 
HENHMETAFILE WINAPI CloseEnhMetaFile (HDC hdc)
 

Variables

static const RECTL empty_bounds = { 0, 0, -1, -1 }
 

Macro Definition Documentation

◆ GdiGetEMFRestorDc

#define GdiGetEMFRestorDc   5

Definition at line 1836 of file emfdc.c.

◆ HANDLE_LIST_INC

#define HANDLE_LIST_INC   20

Definition at line 56 of file emfdc.c.

Function Documentation

◆ can_use_short_points()

static BOOL can_use_short_points ( const POINT pts,
UINT  count 
)
static

Definition at line 571 of file emfdc.c.

572{
573 UINT i;
574
575 for (i = 0; i < count; i++)
576 if (((pts[i].x + 0x8000) & ~0xffff) || ((pts[i].y + 0x8000) & ~0xffff))
577 return FALSE;
578 return TRUE;
579}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50

Referenced by emfdc_poly_polylinegon(), EMFDC_PolyDraw(), and emfdc_polylinegon().

◆ CloseEnhMetaFile()

HENHMETAFILE WINAPI CloseEnhMetaFile ( HDC  hdc)

Definition at line 2509 of file emfdc.c.

2510{
2511 HENHMETAFILE hmf;
2512 struct emf *emf;
2513 WINEDC *dc_attr;
2514 EMREOF emr;
2515 HANDLE mapping = 0;
2516
2517 if (!(dc_attr = get_dc_ptr( hdc )) || !dc_attr->emf) return 0;
2518 emf = dc_attr->emf;
2519
2520 if (dc_attr->save_level)
2521 RestoreDC( hdc, 1 );
2522
2524 if (emf->dc_pen) DeleteObject( emf->dc_pen );
2525
2526 emr.emr.iType = EMR_EOF;
2527 emr.emr.nSize = sizeof(emr);
2528 emr.nPalEntries = 0;
2529 emr.offPalEntries = FIELD_OFFSET(EMREOF, nSizeLast);
2530 emr.nSizeLast = emr.emr.nSize;
2531 emfdc_record( emf, &emr.emr );
2532
2534
2535 /* Update rclFrame if not initialized in CreateEnhMetaFile */
2537 {
2539 emf->emh->szlMillimeters.cx * 100 / emf->emh->szlDevice.cx;
2541 emf->emh->szlMillimeters.cy * 100 / emf->emh->szlDevice.cy;
2543 emf->emh->szlMillimeters.cx * 100 / emf->emh->szlDevice.cx;
2545 emf->emh->szlMillimeters.cy * 100 / emf->emh->szlDevice.cy;
2546 }
2547
2548 if (emf->file) /* disk based metafile */
2549 {
2550 DWORD bytes_written;
2551
2552 if (!WriteFile( emf->file, emf->emh, emf->emh->nBytes, &bytes_written, NULL ))
2553 {
2554 CloseHandle( emf->file );
2555 return 0;
2556 }
2557 HeapFree( GetProcessHeap(), 0, emf->emh );
2559 TRACE( "mapping = %p\n", mapping );
2560 emf->emh = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
2561 TRACE( "view = %p\n", emf->emh );
2563 CloseHandle( emf->file );
2564 }
2565
2566 hmf = EMF_Create_HENHMETAFILE( emf->emh, emf->emh->nBytes, emf->file != 0 );
2567 emf->emh = NULL; /* So it won't be deleted */
2568 DeleteDC( hdc );
2569 return hmf;
2570}
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define PAGE_READONLY
Definition: compat.h:138
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static BOOL emfdc_record(struct emf *emf, EMR *emr)
Definition: emfdc.c:59
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
Definition: filemap.c:23
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
DC * get_dc_ptr(HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:147
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
HDC hdc
Definition: main.c:9
#define TRACE(s)
Definition: solgame.cpp:4
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
Definition: emfdc.c:45
HPEN dc_pen
Definition: emfdc.c:52
WINEDC * dc_attr
Definition: emfdc.c:47
HBRUSH dc_brush
Definition: emfdc.c:51
ENHMETAHEADER * emh
Definition: emfdc.c:46
HANDLE file
Definition: emfdc.c:50
EMR emr
Definition: wingdi.h:1859
DWORD nSizeLast
Definition: wingdi.h:1862
DWORD offPalEntries
Definition: wingdi.h:1861
DWORD nPalEntries
Definition: wingdi.h:1860
DWORD iType
Definition: wingdi.h:1690
DWORD nSize
Definition: wingdi.h:1691
RECTL rclFrame
Definition: wingdi.h:2323
SIZEL szlDevice
Definition: wingdi.h:2333
SIZEL szlMillimeters
Definition: wingdi.h:2334
RECTL rclBounds
Definition: wingdi.h:2322
INT save_level
Definition: gdi_private.h:131
RECTL emf_bounds
Definition: gdi_private.h:132
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, DWORD filesize, BOOL on_disk)
Definition: enhmetafile.c:259
#define EMR_EOF
Definition: wingdi.h:88
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)
BOOL WINAPI DeleteDC(_In_ HDC)

◆ CreateEnhMetaFileA()

HDC WINAPI CreateEnhMetaFileA ( HDC  hdc,
const char filename,
const RECT rect,
const char description 
)

Definition at line 2355 of file emfdc.c.

2357{
2358 WCHAR *filenameW = NULL;
2360 DWORD len1, len2, total;
2361 HDC ret;
2362
2363 if (filename)
2364 {
2365 total = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
2366 filenameW = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) );
2368 }
2369
2370 if(description)
2371 {
2372 len1 = (DWORD)strlen(description);
2373 len2 = (DWORD)strlen(description + len1 + 1);
2374 total = MultiByteToWideChar( CP_ACP, 0, description, len1 + len2 + 3, NULL, 0 );
2375 descriptionW = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) );
2376 MultiByteToWideChar( CP_ACP, 0, description, len1 + len2 + 3, descriptionW, total );
2377 }
2378
2380
2383 return ret;
2384}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define MultiByteToWideChar
Definition: compat.h:110
static const WCHAR descriptionW[]
Definition: error.c:32
HDC WINAPI CreateEnhMetaFileW(HDC hdc, const WCHAR *filename, const RECT *rect, const WCHAR *description)
Definition: emfdc.c:2389
size_t total
const char * filename
Definition: ioapi.h:137
static const WCHAR filenameW[]
Definition: amstream.c:41
static HDC
Definition: imagelist.c:88
#define DWORD
Definition: nt_native.h:44
& rect
Definition: startmenu.cpp:1413
int ret
const char * description
Definition: directx.c:2497
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ CreateEnhMetaFileW()

HDC WINAPI CreateEnhMetaFileW ( HDC  hdc,
const WCHAR filename,
const RECT rect,
const WCHAR description 
)

(dc_attr = get_dc_ptr( ret )) ||

Definition at line 2389 of file emfdc.c.

2391{
2392 HDC ret;
2393 struct emf *emf;
2394 WINEDC *dc_attr;
2395 HANDLE file;
2396 DWORD size = 0, length = 0;
2397
2398 TRACE( "(%p %s %s %s)\n", hdc, debugstr_w(filename), wine_dbgstr_rect(rect),
2400
2401 //if (!(ret = NtGdiCreateMetafileDC( hdc ))) return 0;
2403 {
2404 if (dc_attr->hdc) DeleteDC( dc_attr->hdc );
2405 return 0;
2406 }
2407
2408 ret = dc_attr->hdc;
2409
2410 if ( !(emf = HeapAlloc( GetProcessHeap(), 0, sizeof(*emf) )))
2411 {
2412 DeleteDC( ret );
2413 return 0;
2414 }
2415
2416 emf->dc_attr = dc_attr;
2417 dc_attr->emf = emf;
2418
2419 if (description) /* App name\0Title\0\0 */
2420 {
2422 length += lstrlenW( description + length + 1 );
2423 length += 3;
2424 length *= 2;
2425 }
2426 size = sizeof(ENHMETAHEADER) + (length + 3) / 4 * 4;
2427
2429 {
2430 DeleteDC( ret );
2431 return 0;
2432 }
2433 emf->dc_attr = dc_attr;
2434
2436 HANDLE_LIST_INC * sizeof(emf->handles[0]) );
2438 emf->cur_handles = 1;
2439 emf->file = 0;
2440 emf->dc_brush = 0;
2441 emf->dc_pen = 0;
2442 emf->path = FALSE;
2443
2444 emf->emh->iType = EMR_HEADER;
2445 emf->emh->nSize = size;
2446
2449
2450 if (rect)
2451 {
2452 emf->emh->rclFrame.left = rect->left;
2453 emf->emh->rclFrame.top = rect->top;
2454 emf->emh->rclFrame.right = rect->right;
2455 emf->emh->rclFrame.bottom = rect->bottom;
2456 }
2457 else
2458 {
2459 /* Set this to {0,0 - -1,-1} and update it at the end */
2460 emf->emh->rclFrame.left = emf->emh->rclFrame.top = 0;
2462 }
2463
2465 emf->emh->nVersion = 0x10000;
2466 emf->emh->nBytes = emf->emh->nSize;
2467 emf->emh->nRecords = 1;
2468 emf->emh->nHandles = 1;
2469
2470 emf->emh->sReserved = 0; /* According to docs, this is reserved and must be 0 */
2471 emf->emh->nDescription = length / 2;
2472
2473 emf->emh->offDescription = length ? sizeof(ENHMETAHEADER) : 0;
2474
2475 emf->emh->nPalEntries = 0; /* I guess this should start at 0 */
2476
2477 /* Size in pixels */
2480
2481 /* Size in millimeters */
2484
2485 /* Size in micrometers */
2486 emf->emh->szlMicrometers.cx = emf->emh->szlMillimeters.cx * 1000;
2487 emf->emh->szlMicrometers.cy = emf->emh->szlMillimeters.cy * 1000;
2488
2489 memcpy( (char *)emf->emh + sizeof(ENHMETAHEADER), description, length );
2490
2491 if (filename) /* disk based metafile */
2492 {
2495 {
2496 DeleteDC( ret );
2497 return 0;
2498 }
2499 emf->file = file;
2500 }
2501
2502 TRACE( "returning %p\n", ret );
2503 return ret;
2504}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrlenW
Definition: compat.h:750
#define HANDLE_LIST_INC
Definition: emfdc.c:56
DC * alloc_dc_ptr(WORD magic) DECLSPEC_HIDDEN
Definition: rosglue.c:106
GLsizeiptr size
Definition: glext.h:5919
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
#define OBJ_ENHMETADC
Definition: objidl.idl:1420
UINT cur_handles
Definition: emfdc.c:48
UINT handles_size
Definition: emfdc.c:48
HGDIOBJ * handles
Definition: emfdc.c:49
BOOL path
Definition: emfdc.c:53
Definition: fci.c:127
DWORD nRecords
Definition: wingdi.h:2327
DWORD nDescription
Definition: wingdi.h:2330
DWORD dSignature
Definition: wingdi.h:2324
DWORD nPalEntries
Definition: wingdi.h:2332
DWORD offDescription
Definition: wingdi.h:2331
DWORD nVersion
Definition: wingdi.h:2325
#define HORZRES
Definition: wingdi.h:716
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define VERTSIZE
Definition: wingdi.h:715
#define HORZSIZE
Definition: wingdi.h:714
#define VERTRES
Definition: wingdi.h:717
#define ENHMETA_SIGNATURE
Definition: wingdi.h:204
struct tagENHMETAHEADER ENHMETAHEADER
#define EMR_HEADER
Definition: wingdi.h:75

Referenced by CreateEnhMetaFileA().

◆ EMFDC_AbortPath()

BOOL EMFDC_AbortPath ( WINEDC dc_attr)

Definition at line 2144 of file emfdc.c.

2145{
2146 struct emf *emf = dc_attr->emf;
2147 EMRABORTPATH emr;
2148
2149 emr.emr.iType = EMR_ABORTPATH;
2150 emr.emr.nSize = sizeof(emr);
2151
2152 emf->path = FALSE;
2153 return emfdc_record( dc_attr->emf, &emr.emr );
2154}
#define EMR_ABORTPATH
Definition: wingdi.h:142

◆ emfdc_add_handle()

static UINT emfdc_add_handle ( struct emf emf,
HGDIOBJ  obj 
)
static

Definition at line 199 of file emfdc.c.

200{
201 UINT index;
202
203 for (index = 0; index < emf->handles_size; index++)
204 if (emf->handles[index] == 0) break;
205
206 if (index == emf->handles_size)
207 {
210 emf->handles,
211 emf->handles_size * sizeof(emf->handles[0]) );
212 }
214
215 emf->cur_handles++;
216 if (emf->cur_handles > emf->emh->nHandles)
217 emf->emh->nHandles++;
218
219 return index + 1; /* index 0 is reserved for the hmf, so we increment everything by 1 */
220}
#define index(s, c)
Definition: various.h:29
#define HeapReAlloc
Definition: compat.h:734
#define get_full_gdi_handle
Definition: gdi_private.h:229
GLuint index
Definition: glext.h:6031

Referenced by emfdc_create_brush(), emfdc_create_font(), emfdc_create_palette(), and emfdc_create_pen().

◆ EMFDC_AlphaBlend()

BOOL EMFDC_AlphaBlend ( WINEDC dc_attr,
INT  x_dst,
INT  y_dst,
INT  width_dst,
INT  height_dst,
HDC  hdc_src,
INT  x_src,
INT  y_src,
INT  width_src,
INT  height_src,
BLENDFUNCTION  blend_function 
)

Definition at line 1399 of file emfdc.c.

1402{
1403 return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width_dst, height_dst, hdc_src,
1404 x_src, y_src, width_src, height_src, *(DWORD *)&blend_function,
1405 EMR_ALPHABLEND );
1406}
static BOOL emfdrv_stretchblt(struct emf *emf, INT x_dst, INT y_dst, INT width_dst, INT height_dst, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, DWORD rop, DWORD type)
Definition: emfdc.c:1320

◆ EMFDC_AngleArc()

BOOL EMFDC_AngleArc ( WINEDC dc_attr,
INT  x,
INT  y,
DWORD  radius,
FLOAT  start,
FLOAT  sweep 
)

Definition at line 745 of file emfdc.c.

746{
747 EMRANGLEARC emr;
748
749 emr.emr.iType = EMR_ANGLEARC;
750 emr.emr.nSize = sizeof( emr );
751 emr.ptlCenter.x = x;
752 emr.ptlCenter.y = y;
753 emr.nRadius = radius;
754 emr.eStartAngle = start;
755 emr.eSweepAngle = sweep;
756 return emfdc_record( dc_attr->emf, &emr.emr );
757}
GLuint start
Definition: gl.h:1545
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
FLOAT eSweepAngle
Definition: wingdi.h:1712
FLOAT eStartAngle
Definition: wingdi.h:1711
DWORD nRadius
Definition: wingdi.h:1710
POINTL ptlCenter
Definition: wingdi.h:1709
#define EMR_ANGLEARC
Definition: wingdi.h:115

◆ EMFDC_ArcChordPie()

BOOL EMFDC_ArcChordPie ( WINEDC dc_attr,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  xstart,
INT  ystart,
INT  xend,
INT  yend,
DWORD  type 
)

Definition at line 711 of file emfdc.c.

713{
714 struct emf *emf = dc_attr->emf;
715 EMRARC emr;
716 INT temp;
717 BOOL Ret;
718
719 if (left == right || top == bottom) return FALSE;
720
721 if (left > right) { temp = left; left = right; right = temp; }
722 if (top > bottom) { temp = top; top = bottom; bottom = temp; }
723
725 {
726 right--;
727 bottom--;
728 }
729
730 emr.emr.iType = type;
731 emr.emr.nSize = sizeof(emr);
732 emr.rclBox.left = left;
733 emr.rclBox.top = top;
734 emr.rclBox.right = right;
735 emr.rclBox.bottom = bottom;
736 emr.ptlStart.x = xstart;
737 emr.ptlStart.y = ystart;
738 emr.ptlEnd.x = xend;
739 emr.ptlEnd.y = yend;
740 Ret = emfdc_record( emf, &emr.emr );
741 EMFDRV_ArcChordPie( dc_attr, left, top, right, bottom, xstart, ystart, xend, yend, type );
742 return Ret;
743}
BOOL EMFDRV_ArcChordPie(WINEDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, DWORD type)
Definition: emfdrv.c:120
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
static calc_node_t temp
Definition: rpn_ieee.c:38
POINTL ptlStart
Definition: wingdi.h:1717
RECTL rclBox
Definition: wingdi.h:1716
POINTL ptlEnd
Definition: wingdi.h:1718
EMR emr
Definition: wingdi.h:1715
int32_t INT
Definition: typedefs.h:58
#define GM_COMPATIBLE
Definition: wingdi.h:864
int WINAPI GetGraphicsMode(_In_ HDC)

◆ EMFDC_BeginPath()

BOOL EMFDC_BeginPath ( WINEDC dc_attr)

Definition at line 2156 of file emfdc.c.

2157{
2158 struct emf *emf = dc_attr->emf;
2159 EMRBEGINPATH emr;
2160
2161 emr.emr.iType = EMR_BEGINPATH;
2162 emr.emr.nSize = sizeof(emr);
2163 if (!emfdc_record( emf, &emr.emr )) return FALSE;
2164
2165 emf->path = TRUE;
2166 return TRUE;
2167}
#define EMR_BEGINPATH
Definition: wingdi.h:133

◆ EMFDC_BitBlt()

BOOL EMFDC_BitBlt ( WINEDC dc_attr,
INT  x_dst,
INT  y_dst,
INT  width,
INT  height,
HDC  hdc_src,
INT  x_src,
INT  y_src,
DWORD  rop 
)

Definition at line 1450 of file emfdc.c.

1452{
1453 if (!rop_uses_src( rop )) return EMFDC_PatBlt( dc_attr, x_dst, y_dst, width, height, rop );
1454 return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width, height,
1455 hdc_src, x_src, y_src, width, height, rop, EMR_BITBLT );
1456}
BOOL EMFDC_PatBlt(WINEDC *dc_attr, INT left, INT top, INT width, INT height, DWORD rop)
Definition: emfdc.c:1408
static BOOL rop_uses_src(DWORD rop)
Definition: emfdc.c:1445
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
static int rop(int rop, int src, int dst)
Definition: nanoxwin.c:124
#define EMR_BITBLT
Definition: wingdi.h:149

◆ EMFDC_CloseFigure()

BOOL EMFDC_CloseFigure ( WINEDC dc_attr)

Definition at line 2169 of file emfdc.c.

2170{
2171 EMRCLOSEFIGURE emr;
2172
2174 emr.emr.nSize = sizeof(emr);
2175 return emfdc_record( dc_attr->emf, &emr.emr );
2176}
#define EMR_CLOSEFIGURE
Definition: wingdi.h:135

◆ emfdc_create_brush()

static DWORD emfdc_create_brush ( struct emf emf,
HBRUSH  brush 
)
static

Definition at line 251 of file emfdc.c.

252{
253 DWORD index = 0;
254 LOGBRUSH logbrush;
255
256 if (!GetObjectA( brush, sizeof(logbrush), &logbrush )) return 0;
257
258 switch (logbrush.lbStyle) {
259 case BS_SOLID:
260 case BS_HATCHED:
261 case BS_NULL:
262 {
265 emr.emr.nSize = sizeof(emr);
266 emr.ihBrush = index = emfdc_add_handle( emf, brush );
267 emr.lb.lbStyle = logbrush.lbStyle;
268 emr.lb.lbColor = logbrush.lbColor;
269 emr.lb.lbHatch = logbrush.lbHatch;
270
271 if(!emfdc_record( emf, &emr.emr ))
272 index = 0;
273 }
274 break;
275 case BS_PATTERN:
276 case BS_DIBPATTERN:
277 {
278 unsigned char buffer[FIELD_OFFSET(BITMAPINFO, bmiColors)
279 + 256*RTL_FIELD_SIZE(BITMAPINFO, bmiColors)];
282 DWORD info_size;
283 UINT usage;
284
285 if (!get_brush_bitmap_info( brush, info, NULL, &usage )) break;
286 info_size = get_dib_info_size( info, usage );
287
288 emr = HeapAlloc( GetProcessHeap(), 0,
289 sizeof(EMRCREATEDIBPATTERNBRUSHPT) + sizeof(DWORD) +
290 info_size+info->bmiHeader.biSizeImage );
291 if(!emr) break;
292
293 /* FIXME: There is an extra DWORD written by native before the BMI.
294 * Not sure what it's meant to contain.
295 */
296 emr->offBmi = sizeof( EMRCREATEDIBPATTERNBRUSHPT ) + sizeof(DWORD);
297 *(DWORD *)(emr + 1) = 0x20000000;
298
299 if (logbrush.lbStyle == BS_PATTERN && info->bmiHeader.biBitCount == 1)
300 {
301 /* Presumably to reduce the size of the written EMF, MS supports an
302 * undocumented iUsage value of 2, indicating a mono bitmap without the
303 * 8 byte 2 entry black/white palette. Stupidly, they could have saved
304 * over 20 bytes more by also ignoring the BITMAPINFO fields that are
305 * irrelevant/constant for monochrome bitmaps.
306 * FIXME: It may be that the DIB functions themselves accept this value.
307 */
310 emr->cbBmi = sizeof( BITMAPINFOHEADER );
311 }
312 else
313 {
315 emr->cbBmi = info_size;
316 }
317 emr->ihBrush = index = emfdc_add_handle( emf, brush );
318 emr->iUsage = usage;
319 emr->offBits = emr->offBmi + emr->cbBmi;
320 emr->cbBits = info->bmiHeader.biSizeImage;
321 emr->emr.nSize = emr->offBits + emr->cbBits;
322
323 if (info->bmiHeader.biClrUsed == 1 << info->bmiHeader.biBitCount)
324 info->bmiHeader.biClrUsed = 0;
325 memcpy( (BYTE *)emr + emr->offBmi, info, emr->cbBmi );
326 get_brush_bitmap_info( brush, NULL, (char *)emr + emr->offBits, NULL );
327
328 if (!emfdc_record( emf, &emr->emr )) index = 0;
329 HeapFree( GetProcessHeap(), 0, emr );
330 }
331 break;
332
333 default:
334 FIXME("Unknown style %x\n", logbrush.lbStyle);
335 break;
336 }
337
338 return index;
339}
#define FIXME(fmt,...)
Definition: precomp.h:53
static UINT emfdc_add_handle(struct emf *emf, HGDIOBJ obj)
Definition: emfdc.c:199
static int get_dib_info_size(const BITMAPINFO *info, UINT coloruse)
Definition: gdi_private.h:212
BOOL get_brush_bitmap_info(HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage) DECLSPEC_HIDDEN
#define DIB_PAL_MONO
Definition: gdi_private.h:196
GLuint buffer
Definition: glext.h:5915
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define RTL_FIELD_SIZE(type, field)
Definition: kdb_expr.c:86
ULONG lbHatch
Definition: wingdi.h:1755
UINT lbStyle
Definition: wingdi.h:1753
COLORREF lbColor
Definition: wingdi.h:1754
UINT lbStyle
Definition: wingdi.h:1747
ULONG_PTR lbHatch
Definition: wingdi.h:1749
COLORREF lbColor
Definition: wingdi.h:1748
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define BS_HATCHED
Definition: wingdi.h:1089
#define BS_PATTERN
Definition: wingdi.h:1090
#define EMR_CREATEMONOBRUSH
Definition: wingdi.h:166
#define BS_DIBPATTERN
Definition: wingdi.h:1092
#define BS_NULL
Definition: wingdi.h:1087
struct tagEMRCREATEDIBPATTERNBRUSHPT EMRCREATEDIBPATTERNBRUSHPT
#define EMR_CREATEDIBPATTERNBRUSHPT
Definition: wingdi.h:167
#define EMR_CREATEBRUSHINDIRECT
Definition: wingdi.h:113
#define BS_SOLID
Definition: wingdi.h:1086
unsigned char BYTE
Definition: xxhash.c:193

Referenced by EMFDC_FillRgn(), EMFDC_FrameRgn(), emfdc_select_brush(), and EMFDC_SetDCBrushColor().

◆ emfdc_create_font()

static BOOL emfdc_create_font ( struct emf emf,
HFONT  font 
)
static

Definition at line 374 of file emfdc.c.

375{
376 DWORD index = 0;
378 int i;
379
380 if (!GetObjectW( font, sizeof(emr.elfw.elfLogFont), &emr.elfw.elfLogFont )) return FALSE;
381
383 emr.emr.nSize = (sizeof(emr) + 3) / 4 * 4;
385 emr.elfw.elfFullName[0] = '\0';
386 emr.elfw.elfStyle[0] = '\0';
387 emr.elfw.elfVersion = 0;
388 emr.elfw.elfStyleSize = 0;
389 emr.elfw.elfMatch = 0;
390 emr.elfw.elfReserved = 0;
391 for (i = 0; i < ELF_VENDOR_SIZE; i++)
392 emr.elfw.elfVendorId[i] = 0;
404
405 return emfdc_record( emf, &emr.emr ) ? index : 0;
406}
Definition: mk_font.cpp:20
DWORD elfStyleSize
Definition: wingdi.h:1929
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:1926
BYTE elfVendorId[ELF_VENDOR_SIZE]
Definition: wingdi.h:1932
PANOSE elfPanose
Definition: wingdi.h:1934
LOGFONTW elfLogFont
Definition: wingdi.h:1925
DWORD elfCulture
Definition: wingdi.h:1933
DWORD elfVersion
Definition: wingdi.h:1928
DWORD elfMatch
Definition: wingdi.h:1930
DWORD elfReserved
Definition: wingdi.h:1931
WCHAR elfStyle[LF_FACESIZE]
Definition: wingdi.h:1927
BYTE bMidline
Definition: wingdi.h:1877
BYTE bSerifStyle
Definition: wingdi.h:1870
BYTE bContrast
Definition: wingdi.h:1873
BYTE bArmStyle
Definition: wingdi.h:1875
BYTE bProportion
Definition: wingdi.h:1872
BYTE bWeight
Definition: wingdi.h:1871
BYTE bXHeight
Definition: wingdi.h:1878
BYTE bLetterform
Definition: wingdi.h:1876
BYTE bFamilyType
Definition: wingdi.h:1869
BYTE bStrokeVariation
Definition: wingdi.h:1874
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define PAN_NO_FIT
Definition: wingdi.h:466
#define EMR_EXTCREATEFONTINDIRECTW
Definition: wingdi.h:155
#define PAN_CULTURE_LATIN
Definition: wingdi.h:464
#define ELF_VENDOR_SIZE
Definition: wingdi.h:293

Referenced by emfdc_select_font().

◆ emfdc_create_palette()

static DWORD emfdc_create_palette ( struct emf emf,
HPALETTE  hPal 
)
static

Definition at line 507 of file emfdc.c.

508{
509 WORD i;
510 struct {
512 PALETTEENTRY entry[255];
513 } pal;
514
515 memset( &pal, 0, sizeof(pal) );
516
517 if (!GetObjectW( hPal, sizeof(pal.hdr.lgpl) + sizeof(pal.entry), &pal.hdr.lgpl ))
518 return 0;
519
520 for (i = 0; i < pal.hdr.lgpl.palNumEntries; i++)
521 pal.hdr.lgpl.palPalEntry[i].peFlags = 0;
522
523 pal.hdr.emr.iType = EMR_CREATEPALETTE;
524 pal.hdr.emr.nSize = sizeof(pal.hdr) + pal.hdr.lgpl.palNumEntries * sizeof(PALETTEENTRY);
525 pal.hdr.ihPal = emfdc_add_handle( emf, hPal );
526
527 if (!emfdc_record( emf, &pal.hdr.emr ))
528 pal.hdr.ihPal = 0;
529 return pal.hdr.ihPal;
530}
unsigned short WORD
Definition: ntddk_ex.h:93
char hdr[14]
Definition: iptest.cpp:33
uint32_t entry
Definition: isohybrid.c:63
#define memset(x, y, z)
Definition: compat.h:39
#define EMR_CREATEPALETTE
Definition: wingdi.h:123
struct tagPALETTEENTRY PALETTEENTRY

Referenced by EMFDC_SelectPalette().

◆ emfdc_create_pen()

static DWORD emfdc_create_pen ( struct emf emf,
HPEN  hPen 
)
static

Definition at line 443 of file emfdc.c.

444{
445 EMRCREATEPEN emr;
446 DWORD index = 0;
447
448 if (!GetObjectW( hPen, sizeof(emr.lopn), &emr.lopn ))
449 {
450 /* must be an extended pen */
451 EXTLOGPEN *elp;
452 INT size = GetObjectW( hPen, 0, NULL );
453
454 if (!size) return 0;
455
456 elp = HeapAlloc( GetProcessHeap(), 0, size );
457
458 GetObjectW( hPen, size, elp );
459 /* FIXME: add support for user style pens */
460 emr.lopn.lopnStyle = elp->elpPenStyle;
461 emr.lopn.lopnWidth.x = elp->elpWidth;
462 emr.lopn.lopnWidth.y = 0;
463 emr.lopn.lopnColor = elp->elpColor;
464
465 HeapFree( GetProcessHeap(), 0, elp );
466 }
467
468 emr.emr.iType = EMR_CREATEPEN;
469 emr.emr.nSize = sizeof(emr);
470 emr.ihPen = index = emfdc_add_handle( emf, hPen );
471 return emfdc_record( emf, &emr.emr ) ? index : 0;
472}
LOGPEN lopn
Definition: wingdi.h:1852
DWORD elpWidth
Definition: wingdi.h:1943
DWORD elpPenStyle
Definition: wingdi.h:1942
COLORREF elpColor
Definition: wingdi.h:1945
COLORREF lopnColor
Definition: wingdi.h:1847
POINT lopnWidth
Definition: wingdi.h:1846
UINT lopnStyle
Definition: wingdi.h:1845
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define EMR_CREATEPEN
Definition: wingdi.h:112

Referenced by emfdc_select_pen(), and EMFDC_SetDCPenColor().

◆ emfdc_delete_object()

void emfdc_delete_object ( HDC  hdc,
HGDIOBJ  obj 
)

Definition at line 232 of file emfdc.c.

233{
234 WINEDC *dc_attr = get_dc_ptr( hdc );
235 struct emf *emf = dc_attr->emf;
236 EMRDELETEOBJECT emr;
237 UINT index;
238
239 if(!(index = emfdc_find_object( emf, obj ))) return;
240
242 emr.emr.nSize = sizeof(emr);
243 emr.ihObject = index;
244
245 emfdc_record( emf, &emr.emr );
246
247 emf->handles[index - 1] = 0;
248 emf->cur_handles--;
249}
static UINT emfdc_find_object(struct emf *emf, HGDIOBJ obj)
Definition: emfdc.c:222
#define EMR_DELETEOBJECT
Definition: wingdi.h:114

Referenced by METADC_RosGlueDeleteObject().

◆ EMFDC_DeleteDC()

BOOL EMFDC_DeleteDC ( WINEDC dc_attr)

Definition at line 2218 of file emfdc.c.

2219{
2220 struct emf *emf = dc_attr->emf;
2221 UINT index;
2222
2223 HeapFree( GetProcessHeap(), 0, emf->emh );
2224 for (index = 0; index < emf->handles_size; index++)
2225 if (emf->handles[index])
2228 return TRUE;
2229}
void GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:182

◆ EMFDC_Ellipse()

BOOL EMFDC_Ellipse ( WINEDC dc_attr,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 759 of file emfdc.c.

760{
761 struct emf *emf = dc_attr->emf;
762 EMRELLIPSE emr;
763 BOOL Ret;
764
765 if (left == right || top == bottom) return FALSE;
766
767 emr.emr.iType = EMR_ELLIPSE;
768 emr.emr.nSize = sizeof(emr);
769 emr.rclBox.left = min( left, right );
770 emr.rclBox.top = min( top, bottom );
771 emr.rclBox.right = max( left, right );
772 emr.rclBox.bottom = max( top, bottom );
774 {
775 emr.rclBox.right--;
776 emr.rclBox.bottom--;
777 }
778 Ret = emfdc_record( emf, &emr.emr );
780 return Ret;
781}
BOOL EMFDRV_Ellipse(WINEDC *dc, INT left, INT top, INT right, INT bottom)
Definition: emfdrv.c:255
#define min(a, b)
Definition: monoChain.cc:55
RECTL rclBox
Definition: wingdi.h:1856
#define max(a, b)
Definition: svc.c:63
#define EMR_ELLIPSE
Definition: wingdi.h:116

◆ EMFDC_EndPath()

BOOL EMFDC_EndPath ( WINEDC dc_attr)

Definition at line 2178 of file emfdc.c.

2179{
2180 struct emf *emf = dc_attr->emf;
2181 EMRENDPATH emr;
2182
2183 emf->path = FALSE;
2184
2185 emr.emr.iType = EMR_ENDPATH;
2186 emr.emr.nSize = sizeof(emr);
2187 return emfdc_record( emf, &emr.emr );
2188}
#define EMR_ENDPATH
Definition: wingdi.h:134

◆ EMFDC_ExcludeClipRect()

BOOL EMFDC_ExcludeClipRect ( WINEDC dc_attr,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 1947 of file emfdc.c.

1948{
1950
1952 emr.emr.nSize = sizeof(emr);
1953 emr.rclClip.left = left;
1954 emr.rclClip.top = top;
1955 emr.rclClip.right = right;
1956 emr.rclClip.bottom = bottom;
1957 return emfdc_record( dc_attr->emf, &emr.emr );
1958}
#define EMR_EXCLUDECLIPRECT
Definition: wingdi.h:103

◆ EMFDC_ExtFloodFill()

BOOL EMFDC_ExtFloodFill ( WINEDC dc_attr,
INT  x,
INT  y,
COLORREF  color,
UINT  fill_type 
)

Definition at line 998 of file emfdc.c.

999{
1000 EMREXTFLOODFILL emr;
1001
1003 emr.emr.nSize = sizeof(emr);
1004 emr.ptlStart.x = x;
1005 emr.ptlStart.y = y;
1006 emr.crColor = color;
1007 emr.iMode = fill_type;
1008 return emfdc_record( dc_attr->emf, &emr.emr );
1009}
GLuint color
Definition: glext.h:6243
COLORREF crColor
Definition: wingdi.h:1962
#define EMR_EXTFLOODFILL
Definition: wingdi.h:127

◆ EMFDC_ExtSelectClipRgn()

BOOL EMFDC_ExtSelectClipRgn ( WINEDC dc_attr,
HRGN  hrgn,
INT  mode 
)

Definition at line 1984 of file emfdc.c.

1985{
1987 DWORD size, rgnsize;
1988 BOOL ret;
1989
1990 if (!hrgn)
1991 {
1992 if (mode != RGN_COPY) return ERROR;
1993 rgnsize = 0;
1994 }
1995 else rgnsize = /*NtGdi*/GetRegionData( hrgn, 0, NULL );
1996
1997 size = rgnsize + offsetof(EMREXTSELECTCLIPRGN,RgnData);
1998 emr = HeapAlloc( GetProcessHeap(), 0, size );
1999 if (rgnsize) /*NtGdi*/GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
2000
2002 emr->emr.nSize = size;
2003 emr->cbRgnData = rgnsize;
2004 emr->iMode = mode;
2005
2006 ret = emfdc_record( dc_attr->emf, &emr->emr );
2007 HeapFree( GetProcessHeap(), 0, emr );
2008 return ret;
2009}
static HRGN hrgn
#define ERROR(name)
Definition: error_private.h:53
GLenum mode
Definition: glext.h:6217
#define offsetof(TYPE, MEMBER)
#define EMR_EXTSELECTCLIPRGN
Definition: wingdi.h:148
#define RGN_COPY
Definition: wingdi.h:357
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)

◆ EMFDC_ExtTextOut()

BOOL EMFDC_ExtTextOut ( WINEDC dc_attr,
INT  x,
INT  y,
UINT  flags,
const RECT rect,
const WCHAR str,
UINT  count,
const INT dx 
)

Definition at line 1110 of file emfdc.c.

1112{
1113 struct emf *emf = dc_attr->emf;
1114 FLOAT ex_scale, ey_scale;
1115 EMREXTTEXTOUTW *emr;
1116 int text_height = 0;
1117 int text_width = 0;
1119 DWORD size;
1120 BOOL ret;
1121
1122 if (count > INT_MAX) return FALSE;
1123
1124 size = sizeof(*emr) + ((count+1) & ~1) * sizeof(WCHAR) + count * sizeof(INT);
1125
1126 TRACE( "%s %s count %d size = %d\n", debugstr_wn(str, count),
1129
1131 {
1132 const INT horzSize = GetDeviceCaps( dc_attr->hdc, HORZSIZE );
1133 const INT horzRes = GetDeviceCaps( dc_attr->hdc, HORZRES );
1134 const INT vertSize = GetDeviceCaps( dc_attr->hdc, VERTSIZE );
1135 const INT vertRes = GetDeviceCaps( dc_attr->hdc, VERTRES );
1136 SIZE wndext, vportext;
1137
1138 GetViewportExtEx( dc_attr->hdc, &vportext );
1139 GetWindowExtEx( dc_attr->hdc, &wndext );
1140 ex_scale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) /
1141 ((FLOAT)wndext.cx / (FLOAT)vportext.cx);
1142 ey_scale = 100.0 * ((FLOAT)vertSize / (FLOAT)vertRes) /
1143 ((FLOAT)wndext.cy / (FLOAT)vportext.cy);
1144 }
1145 else
1146 {
1147 ex_scale = 0.0;
1148 ey_scale = 0.0;
1149 }
1150
1151 emr->emr.iType = EMR_EXTTEXTOUTW;
1152 emr->emr.nSize = size;
1154 emr->exScale = ex_scale;
1155 emr->eyScale = ey_scale;
1156 emr->emrtext.ptlReference.x = x;
1157 emr->emrtext.ptlReference.y = y;
1158 emr->emrtext.nChars = count;
1159 emr->emrtext.offString = sizeof(*emr);
1160 memcpy( (char*)emr + emr->emrtext.offString, str, count * sizeof(WCHAR) );
1161 emr->emrtext.fOptions = flags;
1162 if (!rect)
1163 {
1164 emr->emrtext.rcl.left = emr->emrtext.rcl.top = 0;
1165 emr->emrtext.rcl.right = emr->emrtext.rcl.bottom = -1;
1166 }
1167 else
1168 {
1169 emr->emrtext.rcl.left = rect->left;
1170 emr->emrtext.rcl.top = rect->top;
1171 emr->emrtext.rcl.right = rect->right;
1172 emr->emrtext.rcl.bottom = rect->bottom;
1173 }
1174
1175 emr->emrtext.offDx = emr->emrtext.offString + ((count+1) & ~1) * sizeof(WCHAR);
1176 if (dx)
1177 {
1178 UINT i;
1179 SIZE str_size;
1180 memcpy( (char*)emr + emr->emrtext.offDx, dx, count * sizeof(INT) );
1181 for (i = 0; i < count; i++) text_width += dx[i];
1182 if (GetTextExtentPoint32W( dc_attr->hdc, str, count, &str_size ))
1183 text_height = str_size.cy;
1184 }
1185 else
1186 {
1187 UINT i;
1188 INT *emf_dx = (INT *)((char*)emr + emr->emrtext.offDx);
1189 SIZE charSize;
1190 for (i = 0; i < count; i++)
1191 {
1192 if (GetTextExtentPoint32W( dc_attr->hdc, str + i, 1, &charSize ))
1193 {
1194 emf_dx[i] = charSize.cx;
1195 text_width += charSize.cx;
1196 text_height = max( text_height, charSize.cy );
1197 }
1198 }
1199 }
1200
1201 if (emf->path)
1202 {
1203 emr->rclBounds.left = emr->rclBounds.top = 0;
1204 emr->rclBounds.right = emr->rclBounds.bottom = -1;
1205 goto no_bounds;
1206 }
1207
1208 /* FIXME: handle font escapement */
1210 {
1211 case TA_CENTER:
1212 emr->rclBounds.left = x - (text_width / 2) - 1;
1213 emr->rclBounds.right = x + (text_width / 2) + 1;
1214 break;
1215
1216 case TA_RIGHT:
1217 emr->rclBounds.left = x - text_width - 1;
1218 emr->rclBounds.right = x;
1219 break;
1220
1221 default: /* TA_LEFT */
1222 emr->rclBounds.left = x;
1223 emr->rclBounds.right = x + text_width + 1;
1224 }
1225
1227 {
1228 case TA_BASELINE:
1229 if (!GetTextMetricsW( dc_attr->hdc, &tm )) tm.tmDescent = 0;
1230 /* Play safe here... it's better to have a bounding box */
1231 /* that is too big than too small. */
1232 emr->rclBounds.top = y - text_height - 1;
1233 emr->rclBounds.bottom = y + tm.tmDescent + 1;
1234 break;
1235
1236 case TA_BOTTOM:
1237 emr->rclBounds.top = y - text_height - 1;
1238 emr->rclBounds.bottom = y;
1239 break;
1240
1241 default: /* TA_TOP */
1242 emr->rclBounds.top = y;
1243 emr->rclBounds.bottom = y + text_height + 1;
1244 }
1246
1247no_bounds:
1248 ret = emfdc_record( emf, &emr->emr );
1249 HeapFree( GetProcessHeap(), 0, emr );
1250 return ret;
1251}
static void emfdc_update_bounds(struct emf *emf, RECTL *rect)
Definition: emfdc.c:84
GLbitfield flags
Definition: glext.h:7161
#define FLOAT
Definition: i386-dis.c:525
#define INT_MAX
Definition: intsafe.h:150
#define debugstr_wn
Definition: kernel32.h:33
GLint dx
Definition: linetemp.h:97
const WCHAR * str
DWORD iGraphicsMode
Definition: wingdi.h:1982
EMRTEXT emrtext
Definition: wingdi.h:1985
DWORD fOptions
Definition: wingdi.h:1975
DWORD offDx
Definition: wingdi.h:1977
DWORD nChars
Definition: wingdi.h:1973
RECTL rcl
Definition: wingdi.h:1976
POINTL ptlReference
Definition: wingdi.h:1972
DWORD offString
Definition: wingdi.h:1974
Definition: time.h:68
float FLOAT
Definition: typedefs.h:69
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
UINT WINAPI GetTextAlign(_In_ HDC)
Definition: text.c:838
#define EMR_EXTTEXTOUTW
Definition: wingdi.h:157
#define TA_RIGHT
Definition: wingdi.h:933
#define TA_LEFT
Definition: wingdi.h:932
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:411
#define TA_TOP
Definition: wingdi.h:930
#define TA_BOTTOM
Definition: wingdi.h:929
#define TA_BASELINE
Definition: wingdi.h:928
#define TA_CENTER
Definition: wingdi.h:931
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:351
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

◆ EMFDC_FillPath()

BOOL EMFDC_FillPath ( WINEDC dc_attr)

Definition at line 1304 of file emfdc.c.

1305{
1306 return emfdrv_stroke_and_fill_path( dc_attr->emf, EMR_FILLPATH );
1307}
static BOOL emfdrv_stroke_and_fill_path(struct emf *emf, INT type)
Definition: emfdc.c:665
#define EMR_FILLPATH
Definition: wingdi.h:136

◆ EMFDC_FillRgn()

BOOL EMFDC_FillRgn ( WINEDC dc_attr,
HRGN  hrgn,
HBRUSH  hbrush 
)

Definition at line 1011 of file emfdc.c.

1012{
1013 struct emf *emf = dc_attr->emf;
1014 EMRFILLRGN *emr;
1015 DWORD size, rgnsize, index;
1016 BOOL ret;
1017
1018 if (!(index = emfdc_create_brush( emf, hbrush ))) return FALSE;
1019
1020 rgnsize = /*NtGdi*/GetRegionData( hrgn, 0, NULL );
1021 size = rgnsize + offsetof(EMRFILLRGN,RgnData);
1022 emr = HeapAlloc( GetProcessHeap(), 0, size );
1023
1024 /*NtGdi*/GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
1025
1026 emr->emr.iType = EMR_FILLRGN;
1027 emr->emr.nSize = size;
1028 emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
1029 emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
1030 emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
1031 emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
1032 emr->cbRgnData = rgnsize;
1033 emr->ihBrush = index;
1034
1035 ret = emfdc_record( emf, &emr->emr );
1036 if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1037 HeapFree( GetProcessHeap(), 0, emr );
1038 return ret;
1039}
static HBRUSH hbrush
static DWORD emfdc_create_brush(struct emf *emf, HBRUSH brush)
Definition: emfdc.c:251
BYTE RgnData[1]
Definition: wingdi.h:1996
DWORD cbRgnData
Definition: wingdi.h:1994
RECTL rclBounds
Definition: wingdi.h:1993
DWORD ihBrush
Definition: wingdi.h:1995
#define EMR_FILLRGN
Definition: wingdi.h:144

◆ emfdc_find_object()

static UINT emfdc_find_object ( struct emf emf,
HGDIOBJ  obj 
)
static

Definition at line 222 of file emfdc.c.

223{
224 UINT index;
225
226 for (index = 0; index < emf->handles_size; index++)
227 if (emf->handles[index] == obj) return index + 1;
228
229 return 0;
230}

Referenced by emfdc_delete_object(), emfdc_select_brush(), emfdc_select_font(), emfdc_select_pen(), and EMFDC_SelectPalette().

◆ EMFDC_FlattenPath()

BOOL EMFDC_FlattenPath ( WINEDC dc_attr)

Definition at line 2190 of file emfdc.c.

2191{
2192 EMRFLATTENPATH emr;
2193
2195 emr.emr.nSize = sizeof(emr);
2196 return emfdc_record( dc_attr->emf, &emr.emr );
2197}
#define EMR_FLATTENPATH
Definition: wingdi.h:139

◆ EMFDC_FrameRgn()

BOOL EMFDC_FrameRgn ( WINEDC dc_attr,
HRGN  hrgn,
HBRUSH  hbrush,
INT  width,
INT  height 
)

Definition at line 1041 of file emfdc.c.

1042{
1043 struct emf *emf = dc_attr->emf;
1044 EMRFRAMERGN *emr;
1045 DWORD size, rgnsize, index;
1046 BOOL ret;
1047
1049 if(!index) return FALSE;
1050
1051 rgnsize = /*NtGdi*/GetRegionData( hrgn, 0, NULL );
1052 size = rgnsize + offsetof(EMRFRAMERGN,RgnData);
1053 emr = HeapAlloc( GetProcessHeap(), 0, size );
1054
1055 /*NtGdi*/GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
1056
1057 emr->emr.iType = EMR_FRAMERGN;
1058 emr->emr.nSize = size;
1059 emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
1060 emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
1061 emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
1062 emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
1063 emr->cbRgnData = rgnsize;
1064 emr->ihBrush = index;
1065 emr->szlStroke.cx = width;
1066 emr->szlStroke.cy = height;
1067
1068 ret = emfdc_record( emf, &emr->emr );
1069 if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1070 HeapFree( GetProcessHeap(), 0, emr );
1071 return ret;
1072}
SIZEL szlStroke
Definition: wingdi.h:2018
RECTL rclBounds
Definition: wingdi.h:2015
DWORD ihBrush
Definition: wingdi.h:2017
DWORD cbRgnData
Definition: wingdi.h:2016
BYTE RgnData[1]
Definition: wingdi.h:2019
#define EMR_FRAMERGN
Definition: wingdi.h:145

◆ EMFDC_GdiComment()

BOOL WINAPI EMFDC_GdiComment ( HDC  hdc,
UINT  bytes,
const BYTE buffer 
)

Definition at line 2326 of file emfdc.c.

2327{
2328 WINEDC *dc_attr;
2329 EMRGDICOMMENT *emr;
2330 UINT total, rounded_size;
2331 BOOL ret;
2332
2333 if (!(dc_attr = get_dc_ptr( hdc )) || !dc_attr->emf) return FALSE;
2334
2335 rounded_size = (bytes+3) & ~3;
2336 total = offsetof(EMRGDICOMMENT,Data) + rounded_size;
2337
2338 emr = HeapAlloc(GetProcessHeap(), 0, total);
2339 emr->emr.iType = EMR_GDICOMMENT;
2340 emr->emr.nSize = total;
2341 emr->cbData = bytes;
2342 memset(&emr->Data[bytes], 0, rounded_size - bytes);
2343 memcpy(&emr->Data[0], buffer, bytes);
2344
2345 ret = emfdc_record( dc_attr->emf, &emr->emr );
2346
2347 HeapFree(GetProcessHeap(), 0, emr);
2348
2349 return ret;
2350}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
BYTE Data[1]
Definition: wingdi.h:2024
#define EMR_GDICOMMENT
Definition: wingdi.h:143

Referenced by GdiComment().

◆ EMFDC_GradientFill()

BOOL EMFDC_GradientFill ( WINEDC dc_attr,
TRIVERTEX vert_array,
ULONG  nvert,
void grad_array,
ULONG  ngrad,
ULONG  mode 
)

Definition at line 1253 of file emfdc.c.

1255{
1256 EMRGRADIENTFILL *emr;
1257 ULONG i, pt, size, num_pts = ngrad * (mode == GRADIENT_FILL_TRIANGLE ? 3 : 2);
1258 const ULONG *pts = (const ULONG *)grad_array;
1259 BOOL ret;
1260
1261 size = FIELD_OFFSET(EMRGRADIENTFILL, Ver[nvert]) + num_pts * sizeof(pts[0]);
1262
1263 emr = HeapAlloc( GetProcessHeap(), 0, size );
1264 if (!emr) return FALSE;
1265
1266 for (i = 0; i < num_pts; i++)
1267 {
1268 pt = pts[i];
1269
1270 if (i == 0)
1271 {
1272 emr->rclBounds.left = emr->rclBounds.right = vert_array[pt].x;
1273 emr->rclBounds.top = emr->rclBounds.bottom = vert_array[pt].y;
1274 }
1275 else
1276 {
1277 if (vert_array[pt].x < emr->rclBounds.left)
1278 emr->rclBounds.left = vert_array[pt].x;
1279 else if (vert_array[pt].x > emr->rclBounds.right)
1280 emr->rclBounds.right = vert_array[pt].x;
1281 if (vert_array[pt].y < emr->rclBounds.top)
1282 emr->rclBounds.top = vert_array[pt].y;
1283 else if (vert_array[pt].y > emr->rclBounds.bottom)
1284 emr->rclBounds.bottom = vert_array[pt].y;
1285 }
1286 }
1287 emr->rclBounds.right--;
1288 emr->rclBounds.bottom--;
1289
1290 emr->emr.iType = EMR_GRADIENTFILL;
1291 emr->emr.nSize = size;
1292 emr->nVer = nvert;
1293 emr->nTri = ngrad;
1294 emr->ulMode = mode;
1295 memcpy( emr->Ver, vert_array, nvert * sizeof(vert_array[0]) );
1296 memcpy( emr->Ver + nvert, pts, num_pts * sizeof(pts[0]) );
1297
1298 emfdc_update_bounds( dc_attr->emf, &emr->rclBounds );
1299 ret = emfdc_record( dc_attr->emf, &emr->emr );
1300 HeapFree( GetProcessHeap(), 0, emr );
1301 return ret;
1302}
#define pt(x, y)
Definition: drawing.c:79
LONG y
Definition: wingdi.h:2785
LONG x
Definition: wingdi.h:2784
TRIVERTEX Ver[1]
Definition: wingdi.h:2797
uint32_t ULONG
Definition: typedefs.h:59

◆ EMFDC_IntersectClipRect()

BOOL EMFDC_IntersectClipRect ( WINEDC dc_attr,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 1960 of file emfdc.c.

1961{
1963
1965 emr.emr.nSize = sizeof(emr);
1966 emr.rclClip.left = left;
1967 emr.rclClip.top = top;
1968 emr.rclClip.right = right;
1969 emr.rclClip.bottom = bottom;
1970 return emfdc_record( dc_attr->emf, &emr.emr );
1971}
#define EMR_INTERSECTCLIPRECT
Definition: wingdi.h:104

◆ EMFDC_InvertRgn()

BOOL EMFDC_InvertRgn ( WINEDC dc_attr,
HRGN  hrgn 
)

Definition at line 1105 of file emfdc.c.

1106{
1107 return emfdc_paint_invert_region( dc_attr->emf, hrgn, EMR_INVERTRGN );
1108}
static BOOL emfdc_paint_invert_region(struct emf *emf, HRGN hrgn, DWORD iType)
Definition: emfdc.c:1074
#define EMR_INVERTRGN
Definition: wingdi.h:146

◆ EMFDC_LineTo()

BOOL EMFDC_LineTo ( WINEDC dc_attr,
INT  x,
INT  y 
)

Definition at line 697 of file emfdc.c.

698{
699 EMRLINETO emr;
700 BOOL Ret;
701
702 emr.emr.iType = EMR_LINETO;
703 emr.emr.nSize = sizeof(emr);
704 emr.ptl.x = x;
705 emr.ptl.y = y;
706 Ret = emfdc_record( dc_attr->emf, &emr.emr );
707 EMFDRV_LineTo( dc_attr, x, y );
708 return Ret;
709}
BOOL EMFDRV_LineTo(WINEDC *dc, INT x, INT y)
Definition: emfdrv.c:83
POINTL ptl
Definition: wingdi.h:2034
#define EMR_LINETO
Definition: wingdi.h:128

◆ EMFDC_MaskBlt()

BOOL EMFDC_MaskBlt ( WINEDC dc_attr,
INT  x_dst,
INT  y_dst,
INT  width_dst,
INT  height_dst,
HDC  hdc_src,
INT  x_src,
INT  y_src,
HBITMAP  mask,
INT  x_mask,
INT  y_mask,
DWORD  rop 
)

Definition at line 1477 of file emfdc.c.

1480{
1481 unsigned char mask_info_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors)
1482 + 256*RTL_FIELD_SIZE(BITMAPINFO, bmiColors)];
1483 BITMAPINFO *mask_bits_info = (BITMAPINFO *)mask_info_buffer;
1484 struct emf *emf = dc_attr->emf;
1485 BITMAPINFO mask_info = {{ sizeof( mask_info.bmiHeader ) }};
1486 BITMAPINFO src_info = {{ sizeof( src_info.bmiHeader ) }};
1487 HBITMAP bitmap, blit_bitmap = NULL, mask_bitmap = NULL;
1488 UINT bmi_size, size, mask_info_size = 0;
1489 EMRMASKBLT *emr = NULL;
1490 BITMAPINFO *bmi;
1491 HDC blit_dc, mask_dc = NULL;
1492 BOOL ret = FALSE;
1493
1494 if (!rop_uses_src( rop ))
1495 return EMFDC_PatBlt( dc_attr, x_dst, y_dst, width_dst, height_dst, rop );
1496
1497 if (hdc_src && GDI_HANDLE_GET_TYPE(hdc_src) == GDILoObjType_LO_ALTDC_TYPE)
1498 {
1499 WINEDC * pldc = get_dc_ptr(hdc_src);
1500
1501 if (pldc->iType == LDC_EMFLDC)
1502 {
1503 return FALSE;
1504 }
1505 }
1506
1507 if (!(bitmap = GetCurrentObject( hdc_src, OBJ_BITMAP ))) return FALSE;
1508 blit_dc = hdc_src;
1509 blit_bitmap = bitmap;
1510 if (!(bmi_size = get_bitmap_info( &blit_dc, &blit_bitmap, &src_info ))) return FALSE;
1511
1512 if (mask)
1513 {
1514 mask_dc = hdc_src;
1515 mask_bitmap = mask;
1516 if (!(mask_info_size = get_bitmap_info( &mask_dc, &mask_bitmap, &mask_info ))) goto err;
1517 if (mask_info.bmiHeader.biBitCount == 1)
1518 mask_info_size = sizeof(BITMAPINFOHEADER); /* don't include colors */
1519 }
1520 else mask_info.bmiHeader.biSizeImage = 0;
1521
1522 size = sizeof(*emr) + bmi_size + src_info.bmiHeader.biSizeImage +
1523 mask_info_size + mask_info.bmiHeader.biSizeImage;
1524
1525 if (!(emr = HeapAlloc(GetProcessHeap(), 0, size))) goto err;
1526
1527 emr->emr.iType = EMR_MASKBLT;
1528 emr->emr.nSize = size;
1529 emr->rclBounds.left = x_dst;
1530 emr->rclBounds.top = y_dst;
1531 emr->rclBounds.right = x_dst + width_dst - 1;
1532 emr->rclBounds.bottom = y_dst + height_dst - 1;
1533 emr->xDest = x_dst;
1534 emr->yDest = y_dst;
1535 emr->cxDest = width_dst;
1536 emr->cyDest = height_dst;
1537 emr->dwRop = rop;
1538 emr->xSrc = x_src;
1539 emr->ySrc = y_src;
1541 emr->crBkColorSrc = GetBkColor( hdc_src );
1543 emr->offBmiSrc = sizeof(*emr);
1544 emr->cbBmiSrc = bmi_size;
1545 emr->offBitsSrc = emr->offBmiSrc + bmi_size;
1546 emr->cbBitsSrc = src_info.bmiHeader.biSizeImage;
1547 emr->xMask = x_mask;
1548 emr->yMask = y_mask;
1549 emr->iUsageMask = DIB_PAL_MONO;
1550 emr->offBmiMask = mask_info_size ? emr->offBitsSrc + emr->cbBitsSrc : 0;
1551 emr->cbBmiMask = mask_info_size;
1552 emr->offBitsMask = emr->offBmiMask + emr->cbBmiMask;
1553 emr->cbBitsMask = mask_info.bmiHeader.biSizeImage;
1554
1555 bmi = (BITMAPINFO *)((char *)emr + emr->offBmiSrc);
1556 bmi->bmiHeader = src_info.bmiHeader;
1557 ret = GetDIBits( blit_dc, blit_bitmap, 0, src_info.bmiHeader.biHeight,
1558 (char *)emr + emr->offBitsSrc, bmi, DIB_RGB_COLORS );
1559 if (!ret) goto err;
1560
1561 if (mask_info_size)
1562 {
1563 mask_bits_info->bmiHeader = mask_info.bmiHeader;
1564 ret = GetDIBits( blit_dc, mask_bitmap, 0, mask_info.bmiHeader.biHeight,
1565 (char *)emr + emr->offBitsMask, mask_bits_info, DIB_RGB_COLORS );
1566 if (ret) memcpy( (char *)emr + emr->offBmiMask, mask_bits_info, mask_info_size );
1567 }
1568
1569 if (ret)
1570 {
1571 ret = emfdc_record( emf, (EMR *)emr );
1572 if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1573 }
1574
1575err:
1576 HeapFree( GetProcessHeap(), 0, emr );
1577 if (mask_bitmap != mask) DeleteObject( mask_bitmap );
1578 if (mask_dc != hdc_src) DeleteObject( mask_dc );
1579 if (blit_bitmap != bitmap) DeleteObject( blit_bitmap );
1580 if (blit_dc != hdc_src) DeleteDC( blit_dc );
1581 return ret;
1582}
static UINT get_bitmap_info(HDC *hdc, HBITMAP *bitmap, BITMAPINFO *info)
Definition: emfdc.c:120
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
BOOL APIENTRY NtGdiGetTransform(_In_ HDC hdc, _In_ DWORD iXform, _Out_ LPXFORM pxf)
#define LDC_EMFLDC
Definition: gdi_private.h:105
@ GDILoObjType_LO_ALTDC_TYPE
Definition: gdi_private.h:43
#define GdiWorldSpaceToDeviceSpace
Definition: gdi_private.h:221
GLenum GLint GLuint mask
Definition: glext.h:6028
static HBITMAP
Definition: button.c:44
#define OBJ_BITMAP
Definition: objidl.idl:1415
#define err(...)
Definition: uimain.c:89
USHORT biBitCount
Definition: precomp.h:46
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
RECTL rclBounds
Definition: wingdi.h:2038
DWORD offBitsSrc
Definition: wingdi.h:2051
DWORD offBitsMask
Definition: wingdi.h:2058
DWORD cbBmiSrc
Definition: wingdi.h:2050
DWORD offBmiSrc
Definition: wingdi.h:2049
LONG yMask
Definition: wingdi.h:2054
COLORREF crBkColorSrc
Definition: wingdi.h:2047
DWORD cbBmiMask
Definition: wingdi.h:2057
DWORD iUsageMask
Definition: wingdi.h:2055
LONG yDest
Definition: wingdi.h:2040
LONG xMask
Definition: wingdi.h:2053
DWORD dwRop
Definition: wingdi.h:2043
DWORD cbBitsSrc
Definition: wingdi.h:2052
DWORD iUsageSrc
Definition: wingdi.h:2048
DWORD cbBitsMask
Definition: wingdi.h:2059
LONG cyDest
Definition: wingdi.h:2042
LONG xDest
Definition: wingdi.h:2039
XFORM xformSrc
Definition: wingdi.h:2046
DWORD offBmiMask
Definition: wingdi.h:2056
LONG cxDest
Definition: wingdi.h:2041
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
#define EMR_MASKBLT
Definition: wingdi.h:151

◆ EMFDC_ModifyWorldTransform()

BOOL EMFDC_ModifyWorldTransform ( WINEDC dc_attr,
const XFORM xform,
DWORD  mode 
)

Definition at line 2111 of file emfdc.c.

2112{
2114
2116 emr.emr.nSize = sizeof(emr);
2117 if (mode == MWT_IDENTITY)
2118 {
2119 emr.xform.eM11 = 1.0f;
2120 emr.xform.eM12 = 0.0f;
2121 emr.xform.eM21 = 0.0f;
2122 emr.xform.eM22 = 1.0f;
2123 emr.xform.eDx = 0.0f;
2124 emr.xform.eDy = 0.0f;
2125 }
2126 else
2127 {
2128 emr.xform = *xform;
2129 }
2130 emr.iMode = mode;
2131 return emfdc_record( dc_attr->emf, &emr.emr );
2132}
FLOAT eDy
Definition: wingdi.h:1726
FLOAT eM11
Definition: wingdi.h:1721
FLOAT eM21
Definition: wingdi.h:1723
FLOAT eM22
Definition: wingdi.h:1724
FLOAT eM12
Definition: wingdi.h:1722
FLOAT eDx
Definition: wingdi.h:1725
#define MWT_IDENTITY
Definition: wingdi.h:944
#define EMR_MODIFYWORLDTRANSFORM
Definition: wingdi.h:110

◆ EMFDC_MoveTo()

BOOL EMFDC_MoveTo ( WINEDC dc_attr,
INT  x,
INT  y 
)

Definition at line 685 of file emfdc.c.

686{
687 struct emf *emf = dc_attr->emf;
688 EMRMOVETOEX emr;
689
690 emr.emr.iType = EMR_MOVETOEX;
691 emr.emr.nSize = sizeof(emr);
692 emr.ptl.x = x;
693 emr.ptl.y = y;
694 return emfdc_record( emf, &emr.emr );
695}
#define EMR_MOVETOEX
Definition: wingdi.h:101

◆ EMFDC_OffsetClipRgn()

BOOL EMFDC_OffsetClipRgn ( WINEDC dc_attr,
INT  x,
INT  y 
)

Definition at line 1973 of file emfdc.c.

1974{
1975 EMROFFSETCLIPRGN emr;
1976
1978 emr.emr.nSize = sizeof(emr);
1979 emr.ptlOffset.x = x;
1980 emr.ptlOffset.y = y;
1981 return emfdc_record( dc_attr->emf, &emr.emr );
1982}
#define EMR_OFFSETCLIPRGN
Definition: wingdi.h:100

◆ emfdc_paint_invert_region()

static BOOL emfdc_paint_invert_region ( struct emf emf,
HRGN  hrgn,
DWORD  iType 
)
static

Definition at line 1074 of file emfdc.c.

1075{
1076 EMRINVERTRGN *emr;
1077 DWORD size, rgnsize;
1078 BOOL ret;
1079
1080 rgnsize = /*NtGdi*/GetRegionData( hrgn, 0, NULL );
1081 size = rgnsize + offsetof(EMRINVERTRGN,RgnData);
1082 emr = HeapAlloc( GetProcessHeap(), 0, size );
1083
1084 /*NtGdi*/GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData );
1085
1086 emr->emr.iType = iType;
1087 emr->emr.nSize = size;
1088 emr->rclBounds.left = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.left;
1089 emr->rclBounds.top = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.top;
1090 emr->rclBounds.right = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.right - 1;
1091 emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
1092 emr->cbRgnData = rgnsize;
1093
1094 ret = emfdc_record( emf, &emr->emr );
1095 if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1096 HeapFree( GetProcessHeap(), 0, emr );
1097 return ret;
1098}
RECTL rclBounds
Definition: wingdi.h:2028
BYTE RgnData[1]
Definition: wingdi.h:2030
DWORD cbRgnData
Definition: wingdi.h:2029
_In_ ULONG iType
Definition: winddi.h:3748

Referenced by EMFDC_InvertRgn(), and EMFDC_PaintRgn().

◆ EMFDC_PaintRgn()

BOOL EMFDC_PaintRgn ( WINEDC dc_attr,
HRGN  hrgn 
)

Definition at line 1100 of file emfdc.c.

1101{
1102 return emfdc_paint_invert_region( dc_attr->emf, hrgn, EMR_PAINTRGN );
1103}
#define EMR_PAINTRGN
Definition: wingdi.h:147

◆ EMFDC_PatBlt()

BOOL EMFDC_PatBlt ( WINEDC dc_attr,
INT  left,
INT  top,
INT  width,
INT  height,
DWORD  rop 
)

Definition at line 1408 of file emfdc.c.

1409{
1410 struct emf *emf = dc_attr->emf;
1411 EMRBITBLT emr;
1412 BOOL ret;
1413
1414 emr.emr.iType = EMR_BITBLT;
1415 emr.emr.nSize = sizeof(emr);
1416 emr.rclBounds.left = left;
1417 emr.rclBounds.top = top;
1418 emr.rclBounds.right = left + width - 1;
1419 emr.rclBounds.bottom = top + height - 1;
1420 emr.xDest = left;
1421 emr.yDest = top;
1422 emr.cxDest = width;
1423 emr.cyDest = height;
1424 emr.dwRop = rop;
1425 emr.xSrc = 0;
1426 emr.ySrc = 0;
1427 emr.xformSrc.eM11 = 1.0;
1428 emr.xformSrc.eM12 = 0.0;
1429 emr.xformSrc.eM21 = 0.0;
1430 emr.xformSrc.eM22 = 1.0;
1431 emr.xformSrc.eDx = 0.0;
1432 emr.xformSrc.eDy = 0.0;
1433 emr.crBkColorSrc = 0;
1434 emr.iUsageSrc = 0;
1435 emr.offBmiSrc = 0;
1436 emr.cbBmiSrc = 0;
1437 emr.offBitsSrc = 0;
1438 emr.cbBitsSrc = 0;
1439
1440 ret = emfdc_record( emf, &emr.emr );
1441 if (ret) emfdc_update_bounds( emf, &emr.rclBounds );
1442 return ret;
1443}
LONG cyDest
Definition: wingdi.h:1734
DWORD dwRop
Definition: wingdi.h:1735
XFORM xformSrc
Definition: wingdi.h:1738
DWORD cbBitsSrc
Definition: wingdi.h:1744
COLORREF crBkColorSrc
Definition: wingdi.h:1739
LONG ySrc
Definition: wingdi.h:1737
LONG xSrc
Definition: wingdi.h:1736
RECTL rclBounds
Definition: wingdi.h:1730
DWORD offBitsSrc
Definition: wingdi.h:1743
LONG xDest
Definition: wingdi.h:1731
DWORD iUsageSrc
Definition: wingdi.h:1740
LONG cxDest
Definition: wingdi.h:1733
DWORD offBmiSrc
Definition: wingdi.h:1741
LONG yDest
Definition: wingdi.h:1732
DWORD cbBmiSrc
Definition: wingdi.h:1742

Referenced by EMFDC_BitBlt(), EMFDC_MaskBlt(), and EMFDC_StretchBlt().

◆ EMFDC_PlgBlt()

BOOL EMFDC_PlgBlt ( WINEDC dc_attr,
const POINT points,
HDC  hdc_src,
INT  x_src,
INT  y_src,
INT  width,
INT  height,
HBITMAP  mask,
INT  x_mask,
INT  y_mask 
)

Definition at line 1584 of file emfdc.c.

1586{
1587 unsigned char mask_info_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors)
1588 + 256*RTL_FIELD_SIZE(BITMAPINFO, bmiColors)];
1589 BITMAPINFO *mask_bits_info = (BITMAPINFO *)mask_info_buffer;
1590 struct emf *emf = dc_attr->emf;
1591 BITMAPINFO mask_info = {{ sizeof( mask_info.bmiHeader ) }};
1592 BITMAPINFO src_info = {{ sizeof( src_info.bmiHeader ) }};
1593 HBITMAP bitmap, blit_bitmap = NULL, mask_bitmap = NULL;
1594 UINT bmi_size, size, mask_info_size = 0;
1595 EMRPLGBLT *emr = NULL;
1596 BITMAPINFO *bmi;
1597 HDC blit_dc, mask_dc = NULL;
1598 int x_min, y_min, x_max, y_max, i;
1599 BOOL ret = FALSE;
1600
1601 if (hdc_src && GDI_HANDLE_GET_TYPE(hdc_src) == GDILoObjType_LO_ALTDC_TYPE)
1602 {
1603 WINEDC * pldc = get_dc_ptr(hdc_src);
1604
1605 if (pldc->iType == LDC_EMFLDC)
1606 {
1607 return FALSE;
1608 }
1609 }
1610
1611 if (!(bitmap = GetCurrentObject( hdc_src, OBJ_BITMAP ))) return FALSE;
1612
1613 blit_dc = hdc_src;
1614 blit_bitmap = bitmap;
1615 if (!(bmi_size = get_bitmap_info( &blit_dc, &blit_bitmap, &src_info ))) return FALSE;
1616
1617 if (mask)
1618 {
1619 mask_dc = hdc_src;
1620 mask_bitmap = mask;
1621 if (!(mask_info_size = get_bitmap_info( &mask_dc, &mask_bitmap, &mask_info ))) goto err;
1622 if (mask_info.bmiHeader.biBitCount == 1)
1623 mask_info_size = sizeof(BITMAPINFOHEADER); /* don't include colors */
1624 }
1625 else mask_info.bmiHeader.biSizeImage = 0;
1626
1627 size = sizeof(*emr) + bmi_size + src_info.bmiHeader.biSizeImage +
1628 mask_info_size + mask_info.bmiHeader.biSizeImage;
1629
1630 if (!(emr = HeapAlloc(GetProcessHeap(), 0, size))) goto err;
1631
1632 emr->emr.iType = EMR_PLGBLT;
1633 emr->emr.nSize = size;
1634
1635 /* FIXME: not exactly what native does */
1636 x_min = x_max = points[1].x + points[2].x - points[0].x;
1637 y_min = y_max = points[1].y + points[2].y - points[0].y;
1638 for (i = 0; i < ARRAYSIZE(emr->aptlDest); i++)
1639 {
1640 x_min = min( x_min, points[i].x );
1641 y_min = min( y_min, points[i].y );
1642 x_max = max( x_max, points[i].x );
1643 y_max = max( y_min, points[i].y );
1644 }
1645 emr->rclBounds.left = x_min;
1646 emr->rclBounds.top = y_min;
1647 emr->rclBounds.right = x_max;
1648 emr->rclBounds.bottom = y_max;
1649 memcpy( emr->aptlDest, points, sizeof(emr->aptlDest) );
1650 emr->xSrc = x_src;
1651 emr->ySrc = y_src;
1652 emr->cxSrc = width;
1653 emr->cySrc = height;
1655 emr->crBkColorSrc = GetBkColor( hdc_src );
1657 emr->offBmiSrc = sizeof(*emr);
1658 emr->cbBmiSrc = bmi_size;
1659 emr->offBitsSrc = emr->offBmiSrc + bmi_size;
1660 emr->cbBitsSrc = src_info.bmiHeader.biSizeImage;
1661 emr->xMask = x_mask;
1662 emr->yMask = y_mask;
1663 emr->iUsageMask = DIB_PAL_MONO;
1664 emr->offBmiMask = mask_info_size ? emr->offBitsSrc + emr->cbBitsSrc : 0;
1665 emr->cbBmiMask = mask_info_size;
1666 emr->offBitsMask = emr->offBmiMask + emr->cbBmiMask;
1667 emr->cbBitsMask = mask_info.bmiHeader.biSizeImage;
1668
1669 bmi = (BITMAPINFO *)((char *)emr + emr->offBmiSrc);
1670 bmi->bmiHeader = src_info.bmiHeader;
1671 ret = GetDIBits( blit_dc, blit_bitmap, 0, src_info.bmiHeader.biHeight,
1672 (char *)emr + emr->offBitsSrc, bmi, DIB_RGB_COLORS );
1673 if (!ret) goto err;
1674
1675 if (mask_info_size)
1676 {
1677 mask_bits_info->bmiHeader = mask_info.bmiHeader;
1678 ret = GetDIBits( blit_dc, mask_bitmap, 0, mask_info.bmiHeader.biHeight,
1679 (char *)emr + emr->offBitsMask, mask_bits_info, DIB_RGB_COLORS );
1680 if (ret) memcpy( (char *)emr + emr->offBmiMask, mask_bits_info, mask_info_size );
1681 }
1682
1683 if (ret)
1684 {
1685 ret = emfdc_record( emf, (EMR *)emr );
1686 if (ret) emfdc_update_bounds( emf, &emr->rclBounds );
1687 }
1688
1689err:
1690 HeapFree( GetProcessHeap(), 0, emr );
1691 if (mask_bitmap != mask) DeleteObject( mask_bitmap );
1692 if (mask_dc != hdc_src) DeleteObject( mask_dc );
1693 if (blit_bitmap != bitmap) DeleteObject( blit_bitmap );
1694 if (blit_dc != hdc_src) DeleteDC( blit_dc );
1695 return ret;
1696}
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
GLsizei const GLfloat * points
Definition: glext.h:8112
DWORD offBmiMask
Definition: wingdi.h:2088
DWORD cbBitsMask
Definition: wingdi.h:2091
LONG xMask
Definition: wingdi.h:2085
DWORD cbBmiMask
Definition: wingdi.h:2089
LONG cySrc
Definition: wingdi.h:2077
DWORD offBitsSrc
Definition: wingdi.h:2083
RECTL rclBounds
Definition: wingdi.h:2072
DWORD iUsageSrc
Definition: wingdi.h:2080
COLORREF crBkColorSrc
Definition: wingdi.h:2079
XFORM xformSrc
Definition: wingdi.h:2078
LONG xSrc
Definition: wingdi.h:2074
DWORD offBmiSrc
Definition: wingdi.h:2081
LONG cxSrc
Definition: wingdi.h:2076
DWORD cbBitsSrc
Definition: wingdi.h:2084
DWORD cbBmiSrc
Definition: wingdi.h:2082
POINTL aptlDest[3]
Definition: wingdi.h:2073
LONG yMask
Definition: wingdi.h:2086
DWORD offBitsMask
Definition: wingdi.h:2090
DWORD iUsageMask
Definition: wingdi.h:2087
LONG ySrc
Definition: wingdi.h:2075
#define EMR_PLGBLT
Definition: wingdi.h:152

◆ emfdc_poly_polylinegon()

static BOOL emfdc_poly_polylinegon ( struct emf emf,
const POINT pt,
const INT counts,
UINT  polys,
DWORD  type 
)
static

Definition at line 903 of file emfdc.c.

905{
906 EMRPOLYPOLYLINE *emr;
907 DWORD cptl = 0, poly, size;
908 BOOL ret, use_small_emr, bounds_valid = TRUE;
909
910 for(poly = 0; poly < polys; poly++) {
911 cptl += counts[poly];
912 if(counts[poly] < 2) bounds_valid = FALSE;
913 }
914 if(!cptl) bounds_valid = FALSE;
915 use_small_emr = can_use_short_points( pt, cptl );
916
917 size = FIELD_OFFSET(EMRPOLYPOLYLINE, aPolyCounts[polys]);
918 if(use_small_emr)
919 size += cptl * sizeof(POINTS);
920 else
921 size += cptl * sizeof(POINTL);
922
923 emr = HeapAlloc( GetProcessHeap(), 0, size );
924
925 emr->emr.iType = type;
926 if(use_small_emr) emr->emr.iType += EMR_POLYPOLYLINE16 - EMR_POLYPOLYLINE;
927
928 emr->emr.nSize = size;
929 if(bounds_valid && !emf->path)
930 get_points_bounds( &emr->rclBounds, pt, cptl, 0 );
931 else
932 emr->rclBounds = empty_bounds;
933 emr->nPolys = polys;
934 emr->cptl = cptl;
935
936 if(polys)
937 {
938 memcpy( emr->aPolyCounts, counts, polys * sizeof(DWORD) );
939 store_points( (POINTL *)(emr->aPolyCounts + polys), pt, cptl, use_small_emr );
940 }
941
942 ret = emfdc_record( emf, &emr->emr );
943 if(ret && !bounds_valid)
944 {
945 ret = FALSE;
947 }
948 if(ret && !emf->path)
949 emfdc_update_bounds( emf, &emr->rclBounds );
950 HeapFree( GetProcessHeap(), 0, emr );
951 return ret;
952}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
static void get_points_bounds(RECTL *bounds, const POINT *pts, UINT count, WINEDC *dc_attr)
Definition: emfdc.c:604
static void * store_points(POINTL *dest, const POINT *pts, UINT count, BOOL short_points)
Definition: emfdc.c:582
static const RECTL empty_bounds
Definition: emfdc.c:57
static BOOL can_use_short_points(const POINT *pts, UINT count)
Definition: emfdc.c:571
struct _POINTL POINTL
struct tagPOINTS POINTS
#define EMR_POLYPOLYLINE
Definition: wingdi.h:81
#define EMR_POLYPOLYLINE16
Definition: wingdi.h:163

Referenced by EMFDC_PolyPolygon(), and EMFDC_PolyPolyline().

◆ EMFDC_PolyBezier()

BOOL EMFDC_PolyBezier ( WINEDC dc_attr,
const POINT pts,
DWORD  count 
)

Definition at line 893 of file emfdc.c.

894{
895 return emfdc_polylinegon( dc_attr, pts, count, EMR_POLYBEZIER );
896}
static BOOL emfdc_polylinegon(WINEDC *dc_attr, const POINT *points, INT count, DWORD type)
Definition: emfdc.c:849
#define EMR_POLYBEZIER
Definition: wingdi.h:76

◆ EMFDC_PolyBezierTo()

BOOL EMFDC_PolyBezierTo ( WINEDC dc_attr,
const POINT pts,
DWORD  count 
)

Definition at line 898 of file emfdc.c.

899{
900 return emfdc_polylinegon( dc_attr, pts, count, EMR_POLYBEZIERTO );
901}
#define EMR_POLYBEZIERTO
Definition: wingdi.h:79

◆ EMFDC_PolyDraw()

BOOL EMFDC_PolyDraw ( WINEDC dc_attr,
const POINT pts,
const BYTE types,
DWORD  count 
)

Definition at line 964 of file emfdc.c.

965{
966 struct emf *emf = dc_attr->emf;
967 EMRPOLYDRAW *emr;
968 BOOL ret;
969 BYTE *types_dest;
970 BOOL use_small_emr = can_use_short_points( pts, count );
971 DWORD size;
972
973 size = use_small_emr ? (DWORD)offsetof( EMRPOLYDRAW16, apts[count] )
974 : (DWORD)offsetof( EMRPOLYDRAW, aptl[count] );
975 size += (count + 3) & ~3;
976
977 if (!(emr = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
978
979 emr->emr.iType = use_small_emr ? EMR_POLYDRAW16 : EMR_POLYDRAW;
980 emr->emr.nSize = size;
981 emr->cptl = count;
982
983 types_dest = store_points( emr->aptl, pts, count, use_small_emr );
984 memcpy( types_dest, types, count );
985 if (count & 3) memset( types_dest + count, 0, 4 - (count & 3) );
986
987 if (!emf->path)
988 get_points_bounds( &emr->rclBounds, pts, count, 0 );
989 else
990 emr->rclBounds = empty_bounds;
991
992 ret = emfdc_record( emf, &emr->emr );
993 if (ret && !emf->path) emfdc_update_bounds( emf, &emr->rclBounds );
994 HeapFree( GetProcessHeap(), 0, emr );
995 return ret;
996}
static struct list apts
Definition: compobj.c:78
POINTL aptl[1]
Definition: wingdi.h:2097
RECTL rclBounds
Definition: wingdi.h:2095
DWORD cptl
Definition: wingdi.h:2096
Definition: cmds.c:130
#define EMR_POLYDRAW16
Definition: wingdi.h:165
#define EMR_POLYDRAW
Definition: wingdi.h:130

◆ EMFDC_Polygon()

BOOL EMFDC_Polygon ( WINEDC dc_attr,
const POINT pt,
INT  count 
)

Definition at line 887 of file emfdc.c.

888{
889 if(count < 2) return FALSE;
890 return emfdc_polylinegon( dc_attr, pt, count, EMR_POLYGON );
891}
#define EMR_POLYGON
Definition: wingdi.h:77

◆ EMFDC_Polyline()

BOOL EMFDC_Polyline ( WINEDC dc_attr,
const POINT points,
INT  count 
)

Definition at line 877 of file emfdc.c.

878{
879 return emfdc_polylinegon( dc_attr, points, count, EMR_POLYLINE );
880}
#define EMR_POLYLINE
Definition: wingdi.h:78

◆ emfdc_polylinegon()

static BOOL emfdc_polylinegon ( WINEDC dc_attr,
const POINT points,
INT  count,
DWORD  type 
)
static

Definition at line 849 of file emfdc.c.

850{
851 struct emf *emf = dc_attr->emf;
852 EMRPOLYLINE *emr;
853 DWORD size;
854 BOOL ret, use_small_emr = can_use_short_points( points, count );
855
856 size = use_small_emr ? (DWORD)offsetof( EMRPOLYLINE16, apts[count] ) : (DWORD)offsetof( EMRPOLYLINE, aptl[count] );
857
858 emr = HeapAlloc( GetProcessHeap(), 0, size );
859 emr->emr.iType = use_small_emr ? type + EMR_POLYLINE16 - EMR_POLYLINE : type;
860 emr->emr.nSize = size;
861 emr->cptl = count;
862
863 store_points( emr->aptl, points, count, use_small_emr );
864
865 if (!emf->path)
868 else
869 emr->rclBounds = empty_bounds;
870
871 ret = emfdc_record( emf, &emr->emr );
872 if (ret && !emf->path) emfdc_update_bounds( emf, &emr->rclBounds );
873 HeapFree( GetProcessHeap(), 0, emr );
874 return ret;
875}
RECTL rclBounds
Definition: wingdi.h:2109
DWORD cptl
Definition: wingdi.h:2110
POINTL aptl[1]
Definition: wingdi.h:2111
#define EMR_POLYLINE16
Definition: wingdi.h:160
#define EMR_POLYLINETO
Definition: wingdi.h:80

Referenced by EMFDC_PolyBezier(), EMFDC_PolyBezierTo(), EMFDC_Polygon(), EMFDC_Polyline(), and EMFDC_PolylineTo().

◆ EMFDC_PolylineTo()

BOOL EMFDC_PolylineTo ( WINEDC dc_attr,
const POINT points,
INT  count 
)

Definition at line 882 of file emfdc.c.

883{
884 return emfdc_polylinegon( dc_attr, points, count, EMR_POLYLINETO );
885}

◆ EMFDC_PolyPolygon()

BOOL EMFDC_PolyPolygon ( WINEDC dc_attr,
const POINT pt,
const INT counts,
UINT  polys 
)

Definition at line 959 of file emfdc.c.

960{
961 return emfdc_poly_polylinegon( dc_attr->emf, pt, counts, polys, EMR_POLYPOLYGON );
962}
static BOOL emfdc_poly_polylinegon(struct emf *emf, const POINT *pt, const INT *counts, UINT polys, DWORD type)
Definition: emfdc.c:903
#define EMR_POLYPOLYGON
Definition: wingdi.h:82

◆ EMFDC_PolyPolyline()

BOOL EMFDC_PolyPolyline ( WINEDC dc_attr,
const POINT pt,
const DWORD counts,
DWORD  polys 
)

Definition at line 954 of file emfdc.c.

955{
956 return emfdc_poly_polylinegon( dc_attr->emf, pt, (const INT *)counts, polys, EMR_POLYPOLYLINE );
957}

◆ emfdc_record()

static BOOL emfdc_record ( struct emf emf,
EMR emr 
)
static

Definition at line 59 of file emfdc.c.

60{
61 DWORD len, size;
62 ENHMETAHEADER *emh;
63
64 TRACE( "record %d, size %d\n", emr->iType, emr->nSize );
65
66 assert( !(emr->nSize & 3) );
67
68 emf->emh->nBytes += emr->nSize;
69 emf->emh->nRecords++;
70
72 len = emf->emh->nBytes;
73 if (len > size)
74 {
75 size += (size / 2) + emr->nSize;
76 emh = HeapReAlloc( GetProcessHeap(), 0, emf->emh, size );
77 if (!emh) return FALSE;
78 emf->emh = emh;
79 }
80 memcpy( (char *)emf->emh + emf->emh->nBytes - emr->nSize, emr, emr->nSize );
81 return TRUE;
82}
#define assert(x)
Definition: debug.h:53
GLenum GLsizei len
Definition: glext.h:6722
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)

Referenced by CloseEnhMetaFile(), EMFDC_AbortPath(), EMFDC_AngleArc(), EMFDC_ArcChordPie(), EMFDC_BeginPath(), EMFDC_CloseFigure(), emfdc_create_brush(), emfdc_create_font(), emfdc_create_palette(), emfdc_create_pen(), emfdc_delete_object(), EMFDC_Ellipse(), EMFDC_EndPath(), EMFDC_ExcludeClipRect(), EMFDC_ExtFloodFill(), EMFDC_ExtSelectClipRgn(), EMFDC_ExtTextOut(), EMFDC_FillRgn(), EMFDC_FlattenPath(), EMFDC_FrameRgn(), EMFDC_GdiComment(), EMFDC_GradientFill(), EMFDC_IntersectClipRect(), EMFDC_LineTo(), EMFDC_MaskBlt(), EMFDC_ModifyWorldTransform(), EMFDC_MoveTo(), EMFDC_OffsetClipRgn(), emfdc_paint_invert_region(), EMFDC_PatBlt(), EMFDC_PlgBlt(), emfdc_poly_polylinegon(), EMFDC_PolyDraw(), emfdc_polylinegon(), EMFDC_Rectangle(), EMFDC_RestoreDC(), EMFDC_RoundRect(), EMFDC_SaveDC(), EMFDC_ScaleViewportExtEx(), EMFDC_ScaleWindowExtEx(), emfdc_select_brush(), emfdc_select_font(), emfdc_select_pen(), EMFDC_SelectClipPath(), EMFDC_SelectPalette(), EMFDC_SetArcDirection(), EMFDC_SetBkColor(), EMFDC_SetBkMode(), EMFDC_SetBrushOrg(), EMFDC_SetDCBrushColor(), EMFDC_SetDCPenColor(), EMFDC_SetDIBitsToDevice(), EMFDC_SetLayout(), EMFDC_SetMapMode(), EMFDC_SetMapperFlags(), EMFDC_SetMetaRgn(), EMFDC_SetPixel(), EMFDC_SetPolyFillMode(), EMFDC_SetROP2(), EMFDC_SetStretchBltMode(), EMFDC_SetTextAlign(), EMFDC_SetTextColor(), EMFDC_SetTextJustification(), EMFDC_SetViewportExtEx(), EMFDC_SetViewportOrgEx(), EMFDC_SetWindowExtEx(), EMFDC_SetWindowOrgEx(), EMFDC_SetWorldTransform(), EMFDC_StretchDIBits(), EMFDC_WidenPath(), EMFDC_WriteEscape(), EMFDC_WriteNamedEscape(), emfdrv_stretchblt(), and emfdrv_stroke_and_fill_path().

◆ EMFDC_Rectangle()

BOOL EMFDC_Rectangle ( WINEDC dc_attr,
INT  left,
INT  top,
INT  right,
INT  bottom 
)

Definition at line 783 of file emfdc.c.

784{
785 struct emf *emf = dc_attr->emf;
786 EMRRECTANGLE emr;
787 BOOL Ret;
788
789 if(left == right || top == bottom) return FALSE;
790
791 emr.emr.iType = EMR_RECTANGLE;
792 emr.emr.nSize = sizeof(emr);
793 emr.rclBox.left = min( left, right );
794 emr.rclBox.top = min( top, bottom );
795 emr.rclBox.right = max( left, right );
796 emr.rclBox.bottom = max( top, bottom );
798 {
799 emr.rclBox.right--;
800 emr.rclBox.bottom--;
801 }
802 Ret = emfdc_record( emf, &emr.emr );
804 return Ret;
805}
BOOL EMFDRV_Rectangle(WINEDC *dc, INT left, INT top, INT right, INT bottom)
Definition: emfdrv.c:275
#define EMR_RECTANGLE
Definition: wingdi.h:117

◆ EMFDC_RestoreDC()

BOOL EMFDC_RestoreDC ( WINEDC dc_attr,
INT  level 
)

Definition at line 1837 of file emfdc.c.

1838{
1839 EMRRESTOREDC emr;
1840
1841 /* The Restore DC function needs the save level to be set correctly.
1842 Note that wine's level is 0 based, while our's is (like win) 1 based. */
1843 dc_attr->save_level = GetDCDWord(dc_attr->hdc, GdiGetEMFRestorDc, 0) - 1;
1844
1845 if (abs(level) > dc_attr->save_level || level == 0) return FALSE;
1846
1847 emr.emr.iType = EMR_RESTOREDC;
1848 emr.emr.nSize = sizeof(emr);
1849 if (level < 0)
1850 emr.iRelative = level;
1851 else
1852 emr.iRelative = level - dc_attr->save_level - 1;
1853 return emfdc_record( dc_attr->emf, &emr.emr );
1854}
#define GdiGetEMFRestorDc
Definition: emfdc.c:1836
#define abs(i)
Definition: fconv.c:206
DWORD WINAPI GetDCDWord(_In_ HDC hdc, _In_ UINT u, _In_ DWORD dwError)
Definition: dc.c:787
GLint level
Definition: gl.h:1546
LONG iRelative
Definition: wingdi.h:2151
#define EMR_RESTOREDC
Definition: wingdi.h:108

◆ EMFDC_RoundRect()

BOOL EMFDC_RoundRect ( WINEDC dc_attr,
INT  left,
INT  top,
INT  right,
INT  bottom,
INT  ell_width,
INT  ell_height 
)

Definition at line 807 of file emfdc.c.

809{
810 struct emf *emf = dc_attr->emf;
811 EMRROUNDRECT emr;
812 BOOL Ret;
813
814 if (left == right || top == bottom) return FALSE;
815
816 emr.emr.iType = EMR_ROUNDRECT;
817 emr.emr.nSize = sizeof(emr);
818 emr.rclBox.left = min( left, right );
819 emr.rclBox.top = min( top, bottom );
820 emr.rclBox.right = max( left, right );
821 emr.rclBox.bottom = max( top, bottom );
822 emr.szlCorner.cx = ell_width;
823 emr.szlCorner.cy = ell_height;
825 {
826 emr.rclBox.right--;
827 emr.rclBox.bottom--;
828 }
829 Ret = emfdc_record( emf, &emr.emr );
830 EMFDRV_RoundRect( dc_attr, left, top, right, bottom, ell_width, ell_height );
831 return Ret;
832}
BOOL EMFDRV_RoundRect(WINEDC *dc, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height)
Definition: emfdrv.c:99
RECTL rclBox
Definition: wingdi.h:2155
SIZEL szlCorner
Definition: wingdi.h:2156
#define EMR_ROUNDRECT
Definition: wingdi.h:118

◆ EMFDC_SaveDC()

BOOL EMFDC_SaveDC ( WINEDC dc_attr)

Definition at line 1828 of file emfdc.c.

1829{
1830 EMRSAVEDC emr;
1831
1832 emr.emr.iType = EMR_SAVEDC;
1833 emr.emr.nSize = sizeof(emr);
1834 return emfdc_record( dc_attr->emf, &emr.emr );
1835}
#define EMR_SAVEDC
Definition: wingdi.h:107

◆ EMFDC_ScaleViewportExtEx()

BOOL EMFDC_ScaleViewportExtEx ( WINEDC dc_attr,
INT  x_num,
INT  x_denom,
INT  y_num,
INT  y_denom 
)

Definition at line 2065 of file emfdc.c.

2066{
2068
2070 emr.emr.nSize = sizeof(emr);
2071 emr.xNum = x_num;
2072 emr.xDenom = x_denom;
2073 emr.yNum = y_num;
2074 emr.yDenom = y_denom;
2075 return emfdc_record( dc_attr->emf, &emr.emr );
2076}
#define EMR_SCALEVIEWPORTEXTEX
Definition: wingdi.h:105

◆ EMFDC_ScaleWindowExtEx()

BOOL EMFDC_ScaleWindowExtEx ( WINEDC dc_attr,
INT  x_num,
INT  x_denom,
INT  y_num,
INT  y_denom 
)

Definition at line 2078 of file emfdc.c.

2079{
2081
2083 emr.emr.nSize = sizeof(emr);
2084 emr.xNum = x_num;
2085 emr.xDenom = x_denom;
2086 emr.yNum = y_num;
2087 emr.yDenom = y_denom;
2088 return emfdc_record( dc_attr->emf, &emr.emr );
2089}
#define EMR_SCALEWINDOWEXTEX
Definition: wingdi.h:106

◆ emfdc_select_brush()

static BOOL emfdc_select_brush ( WINEDC dc_attr,
HBRUSH  brush 
)
static

Definition at line 341 of file emfdc.c.

342{
343 struct emf *emf = dc_attr->emf;
344 EMRSELECTOBJECT emr;
345 DWORD index = 0;
346 int i;
347
348 /* If the object is a stock brush object, do not need to create it.
349 * See definitions in wingdi.h for range of stock brushes.
350 * We do however have to handle setting the higher order bit to
351 * designate that this is a stock object.
352 */
353 for (i = WHITE_BRUSH; i <= DC_BRUSH; i++)
354 {
355 if (brush == GetStockObject(i))
356 {
357 index = i | 0x80000000;
358 break;
359 }
360 }
361
362 if (!index && !(index = emfdc_find_object( emf, brush )))
363 {
364 if (!(index = emfdc_create_brush( emf, brush ))) return 0;
365 GDI_hdc_using_object( brush, dc_attr->hdc);//, emfdc_delete_object );
366 }
367
369 emr.emr.nSize = sizeof(emr);
370 emr.ihObject = index;
371 return emfdc_record( emf, &emr.emr );
372}
void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN
Definition: rosglue.c:166
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define EMR_SELECTOBJECT
Definition: wingdi.h:111
#define WHITE_BRUSH
Definition: wingdi.h:902

Referenced by EMFDC_SelectObject().

◆ emfdc_select_font()

static BOOL emfdc_select_font ( WINEDC dc_attr,
HFONT  font 
)
static

Definition at line 408 of file emfdc.c.

409{
410 struct emf *emf = dc_attr->emf;
411 EMRSELECTOBJECT emr;
412 DWORD index;
413 int i;
414
415 /* If the object is a stock font object, do not need to create it.
416 * See definitions in wingdi.h for range of stock fonts.
417 * We do however have to handle setting the higher order bit to
418 * designate that this is a stock object.
419 */
420
421 for (i = OEM_FIXED_FONT; i <= DEFAULT_GUI_FONT; i++)
422 {
423 if (i != DEFAULT_PALETTE && font == GetStockObject(i))
424 {
425 index = i | 0x80000000;
426 goto found;
427 }
428 }
429
430 if (!(index = emfdc_find_object( emf, font )))
431 {
432 if (!(index = emfdc_create_font( emf, font ))) return FALSE;
433 GDI_hdc_using_object( font, dc_attr->hdc);//, emfdc_delete_object );
434 }
435
436 found:
438 emr.emr.nSize = sizeof(emr);
439 emr.ihObject = index;
440 return emfdc_record( emf, &emr.emr );
441}
static BOOL emfdc_create_font(struct emf *emf, HFONT font)
Definition: emfdc.c:374
#define DEFAULT_PALETTE
Definition: wingdi.h:913
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
#define OEM_FIXED_FONT
Definition: wingdi.h:910

Referenced by EMFDC_SelectObject().

◆ emfdc_select_pen()

static BOOL emfdc_select_pen ( WINEDC dc_attr,
HPEN  pen 
)
static

Definition at line 474 of file emfdc.c.

475{
476 struct emf *emf = dc_attr->emf;
477 EMRSELECTOBJECT emr;
478 DWORD index = 0;
479 int i;
480
481 /* If the object is a stock pen object, do not need to create it.
482 * See definitions in wingdi.h for range of stock pens.
483 * We do however have to handle setting the higher order bit to
484 * designate that this is a stock object.
485 */
486
487 for (i = WHITE_PEN; i <= DC_PEN; i++)
488 {
489 if (pen == GetStockObject(i))
490 {
491 index = i | 0x80000000;
492 break;
493 }
494 }
495 if (!index && !(index = emfdc_find_object( emf, pen )))
496 {
497 if (!(index = emfdc_create_pen( emf, pen ))) return FALSE;
498 GDI_hdc_using_object( pen, dc_attr->hdc);//, emfdc_delete_object );
499 }
500
502 emr.emr.nSize = sizeof(emr);
503 emr.ihObject = index;
504 return emfdc_record( emf, &emr.emr );
505}
static DWORD emfdc_create_pen(struct emf *emf, HPEN hPen)
Definition: emfdc.c:443
#define WHITE_PEN
Definition: wingdi.h:905

Referenced by EMFDC_SelectObject().

◆ EMFDC_SelectClipPath()

BOOL EMFDC_SelectClipPath ( WINEDC dc_attr,
INT  mode 
)

Definition at line 2199 of file emfdc.c.

2200{
2202
2204 emr.emr.nSize = sizeof(emr);
2205 emr.iMode = mode;
2206 return emfdc_record( dc_attr->emf, &emr.emr );
2207}
#define EMR_SELECTCLIPPATH
Definition: wingdi.h:141

◆ EMFDC_SelectObject()

BOOL EMFDC_SelectObject ( WINEDC dc_attr,
HGDIOBJ  obj 
)

Definition at line 554 of file emfdc.c.

555{
556 switch (GDI_HANDLE_GET_TYPE( obj ))
557 {
559 return emfdc_select_brush( dc_attr, obj );
561 return emfdc_select_font( dc_attr, obj );
564 return emfdc_select_pen( dc_attr, obj );
565 default:
566 return TRUE;
567 }
568}
static BOOL emfdc_select_font(WINEDC *dc_attr, HFONT font)
Definition: emfdc.c:408
static BOOL emfdc_select_brush(WINEDC *dc_attr, HBRUSH brush)
Definition: emfdc.c:341
static BOOL emfdc_select_pen(WINEDC *dc_attr, HPEN pen)
Definition: emfdc.c:474
@ GDILoObjType_LO_FONT_TYPE
Definition: gdi_private.h:37
@ GDILoObjType_LO_BRUSH_TYPE
Definition: gdi_private.h:33
@ GDILoObjType_LO_EXTPEN_TYPE
Definition: gdi_private.h:45
@ GDILoObjType_LO_PEN_TYPE
Definition: gdi_private.h:44

◆ EMFDC_SelectPalette()

BOOL EMFDC_SelectPalette ( WINEDC dc_attr,
HPALETTE  palette 
)

Definition at line 532 of file emfdc.c.

533{
534 struct emf *emf = dc_attr->emf;
536 DWORD index = 0;
537
539 {
540 index = DEFAULT_PALETTE | 0x80000000;
541 }
542 else if (!(index = emfdc_find_object( emf, palette )))
543 {
544 if (!(index = emfdc_create_palette( emf, palette ))) return 0;
545 GDI_hdc_using_object( palette, dc_attr->hdc);//, emfdc_delete_object );
546 }
547
549 emr.emr.nSize = sizeof(emr);
550 emr.ihPal = index;
551 return emfdc_record( emf, &emr.emr );
552}
static DWORD emfdc_create_palette(struct emf *emf, HPALETTE hPal)
Definition: emfdc.c:507
static HPALETTE palette
Definition: clipboard.c:1345
#define EMR_SELECTPALETTE
Definition: wingdi.h:122

◆ EMFDC_SetArcDirection()

BOOL EMFDC_SetArcDirection ( WINEDC dc_attr,
INT  dir 
)

Definition at line 1937 of file emfdc.c.

1938{
1940
1942 emr.emr.nSize = sizeof(emr);
1943 emr.iArcDirection = dir;
1944 return emfdc_record( dc_attr->emf, &emr.emr );
1945}
unsigned int dir
Definition: maze.c:112
#define EMR_SETARCDIRECTION
Definition: wingdi.h:131

◆ EMFDC_SetBkColor()

BOOL EMFDC_SetBkColor ( WINEDC dc_attr,
COLORREF  color 
)

Definition at line 1887 of file emfdc.c.

1888{
1889 EMRSETBKCOLOR emr;
1890
1891 emr.emr.iType = EMR_SETBKCOLOR;
1892 emr.emr.nSize = sizeof(emr);
1893 emr.crColor = color;
1894 return emfdc_record( dc_attr->emf, &emr.emr );
1895}
COLORREF crColor
Definition: wingdi.h:2181
#define EMR_SETBKCOLOR
Definition: wingdi.h:99

◆ EMFDC_SetBkMode()

BOOL EMFDC_SetBkMode ( WINEDC dc_attr,
INT  mode 
)

Definition at line 1877 of file emfdc.c.

1878{
1879 EMRSETBKMODE emr;
1880
1881 emr.emr.iType = EMR_SETBKMODE;
1882 emr.emr.nSize = sizeof(emr);
1883 emr.iMode = mode;
1884 return emfdc_record( dc_attr->emf, &emr.emr );
1885}
#define EMR_SETBKMODE
Definition: wingdi.h:92

◆ EMFDC_SetBrushOrg()

BOOL EMFDC_SetBrushOrg ( WINEDC dc_attr,
INT  x,
INT  y 
)

Definition at line 2311 of file emfdc.c.

2312{
2313 EMRSETBRUSHORGEX emr;
2314
2316 emr.emr.nSize = sizeof(emr);
2317 emr.ptlOrigin.x = x;
2318 emr.ptlOrigin.y = y;
2319
2320 return emfdc_record( dc_attr->emf, &emr.emr );
2321}
#define EMR_SETBRUSHORGEX
Definition: wingdi.h:87

◆ EMFDC_SetDCBrushColor()

BOOL EMFDC_SetDCBrushColor ( WINEDC dc_attr,
COLORREF  color 
)

Definition at line 1791 of file emfdc.c.

1792{
1793 struct emf *emf = dc_attr->emf;
1794 EMRSELECTOBJECT emr;
1795 DWORD index;
1796
1797 if (GetCurrentObject( dc_attr->hdc, OBJ_BRUSH ) != GetStockObject( DC_BRUSH )) return TRUE;
1798
1800 if (!(emf->dc_brush = CreateSolidBrush( color ))) return FALSE;
1801 if (!(index = emfdc_create_brush( emf, emf->dc_brush ))) return FALSE;
1802 GDI_hdc_using_object( emf->dc_brush, dc_attr->hdc);//, emfdc_delete_object );
1804 emr.emr.nSize = sizeof(emr);
1805 emr.ihObject = index;
1806 return emfdc_record( emf, &emr.emr );
1807}
#define OBJ_BRUSH
Definition: objidl.idl:1410
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

◆ EMFDC_SetDCPenColor()

BOOL EMFDC_SetDCPenColor ( WINEDC dc_attr,
COLORREF  color 
)

Definition at line 1809 of file emfdc.c.

1810{
1811 struct emf *emf = dc_attr->emf;
1812 EMRSELECTOBJECT emr;
1813 DWORD index;
1814 LOGPEN logpen = { PS_SOLID, { 0, 0 }, color };
1815
1816 if (GetCurrentObject( dc_attr->hdc, OBJ_PEN ) != GetStockObject( DC_PEN )) return TRUE;
1817
1818 if (emf->dc_pen) DeleteObject( emf->dc_pen );
1819 if (!(emf->dc_pen = CreatePenIndirect( &logpen ))) return FALSE;
1820 if (!(index = emfdc_create_pen( emf, emf->dc_pen ))) return FALSE;
1821 GDI_hdc_using_object( emf->dc_pen, dc_attr->hdc);//, emfdc_delete_object );
1823 emr.emr.nSize = sizeof(emr);
1824 emr.ihObject = index;
1825 return emfdc_record( emf, &emr.emr );
1826}
#define OBJ_PEN
Definition: objidl.idl:1409
HPEN WINAPI CreatePenIndirect(_In_ const LOGPEN *)
#define PS_SOLID
Definition: wingdi.h:586

◆ EMFDC_SetDIBitsToDevice()

BOOL EMFDC_SetDIBitsToDevice ( WINEDC dc_attr,
INT  x_dst,
INT  y_dst,
DWORD  width,
DWORD  height,
INT  x_src,
INT  y_src,
UINT  startscan,
UINT  lines,
const void bits,
const BITMAPINFO info,
UINT  usage 
)

Definition at line 1751 of file emfdc.c.

1754{
1756 DWORD bmiSize = get_dib_info_size( info, usage );
1757 DWORD size = sizeof(EMRSETDIBITSTODEVICE) + bmiSize + info->bmiHeader.biSizeImage;
1758 BOOL ret;
1759
1760 if (!(emr = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
1761
1763 emr->emr.nSize = size;
1764 emr->rclBounds.left = x_dst;
1765 emr->rclBounds.top = y_dst;
1766 emr->rclBounds.right = x_dst + width - 1;
1767 emr->rclBounds.bottom = y_dst + height - 1;
1768 emr->xDest = x_dst;
1769 emr->yDest = y_dst;
1770 emr->xSrc = x_src;
1771 emr->ySrc = y_src;
1772 emr->cxSrc = width;
1773 emr->cySrc = height;
1774 emr->offBmiSrc = sizeof(EMRSETDIBITSTODEVICE);
1775 emr->cbBmiSrc = bmiSize;
1776 emr->offBitsSrc = sizeof(EMRSETDIBITSTODEVICE) + bmiSize;
1777 emr->cbBitsSrc = info->bmiHeader.biSizeImage;
1778 emr->iUsageSrc = usage;
1779 emr->iStartScan = startscan;
1780 emr->cScans = lines;
1781 memcpy( (BYTE*)emr + emr->offBmiSrc, info, bmiSize );
1782 memcpy( (BYTE*)emr + emr->offBitsSrc, bits, info->bmiHeader.biSizeImage );
1783
1784 if ((ret = emfdc_record( dc_attr->emf, (EMR*)emr )))
1785 emfdc_update_bounds( dc_attr->emf, &emr->rclBounds );
1786
1787 HeapFree( GetProcessHeap(), 0, emr );
1788 return ret;
1789}
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
if(dx< 0)
Definition: linetemp.h:194
eMaj lines
Definition: tritemp.h:206
struct tagEMRSETDIBITSTODEVICE EMRSETDIBITSTODEVICE
#define EMR_SETDIBITSTODEVICE
Definition: wingdi.h:153

◆ EMFDC_SetLayout()

BOOL EMFDC_SetLayout ( WINEDC dc_attr,
DWORD  layout 
)

Definition at line 2091 of file emfdc.c.

2092{
2093 EMRSETLAYOUT emr;
2094
2095 emr.emr.iType = EMR_SETLAYOUT;
2096 emr.emr.nSize = sizeof(emr);
2097 emr.iMode = layout;
2098 return emfdc_record( dc_attr->emf, &emr.emr );
2099}
static DWORD layout
Definition: bitmap.c:46

◆ EMFDC_SetMapMode()

BOOL EMFDC_SetMapMode ( WINEDC dc_attr,
INT  mode 
)

Definition at line 2011 of file emfdc.c.

2012{
2013 EMRSETMAPMODE emr;
2014
2015 emr.emr.iType = EMR_SETMAPMODE;
2016 emr.emr.nSize = sizeof(emr);
2017 emr.iMode = mode;
2018 return emfdc_record( dc_attr->emf, &emr.emr );
2019}
#define EMR_SETMAPMODE
Definition: wingdi.h:91

◆ EMFDC_SetMapperFlags()

BOOL EMFDC_SetMapperFlags ( WINEDC dc_attr,
DWORD  flags 
)

Definition at line 2134 of file emfdc.c.

2135{
2137
2139 emr.emr.nSize = sizeof(emr);
2140 emr.dwFlags = flags;
2141 return emfdc_record( dc_attr->emf, &emr.emr );
2142}
#define EMR_SETMAPPERFLAGS
Definition: wingdi.h:90

◆ EMFDC_SetMetaRgn()

BOOL EMFDC_SetMetaRgn ( WINEDC dc_attr)

Definition at line 2301 of file emfdc.c.

2302{
2303 EMRSETMETARGN emr;
2304
2305 emr.emr.iType = EMR_SETMETARGN;
2306 emr.emr.nSize = sizeof(emr);
2307
2308 return emfdc_record( dc_attr->emf, &emr.emr );
2309}
#define EMR_SETMETARGN
Definition: wingdi.h:102

◆ EMFDC_SetPixel()

BOOL EMFDC_SetPixel ( WINEDC dc_attr,
INT  x,
INT  y,
COLORREF  color 
)

Definition at line 834 of file emfdc.c.

835{
836 EMRSETPIXELV emr;
837 BOOL Ret;
838
839 emr.emr.iType = EMR_SETPIXELV;
840 emr.emr.nSize = sizeof(emr);
841 emr.ptlPixel.x = x;
842 emr.ptlPixel.y = y;
843 emr.crColor = color;
844 Ret = emfdc_record( dc_attr->emf, &emr.emr );
845 EMFDRV_SetPixel( dc_attr, x, y, color );
846 return Ret;
847}
COLORREF EMFDRV_SetPixel(WINEDC *dc, INT x, INT y, COLORREF color)
Definition: emfdrv.c:295
POINTL ptlPixel
Definition: wingdi.h:2221
COLORREF crColor
Definition: wingdi.h:2222
#define EMR_SETPIXELV
Definition: wingdi.h:89

◆ EMFDC_SetPolyFillMode()

BOOL EMFDC_SetPolyFillMode ( WINEDC dc_attr,
INT  mode 
)

Definition at line 1917 of file emfdc.c.

1918{
1920
1922 emr.emr.nSize = sizeof(emr);
1923 emr.iMode = mode;
1924 return emfdc_record( dc_attr->emf, &emr.emr );
1925}
#define EMR_SETPOLYFILLMODE
Definition: wingdi.h:93

◆ EMFDC_SetROP2()

BOOL EMFDC_SetROP2 ( WINEDC dc_attr,
INT  rop 
)

Definition at line 1907 of file emfdc.c.

1908{
1909 EMRSETROP2 emr;
1910
1911 emr.emr.iType = EMR_SETROP2;
1912 emr.emr.nSize = sizeof(emr);
1913 emr.iMode = rop;
1914 return emfdc_record( dc_attr->emf, &emr.emr );
1915}
#define EMR_SETROP2
Definition: wingdi.h:94

◆ EMFDC_SetStretchBltMode()

BOOL EMFDC_SetStretchBltMode ( WINEDC dc_attr,
INT  mode 
)

Definition at line 1927 of file emfdc.c.

1928{
1930
1932 emr.emr.nSize = sizeof(emr);
1933 emr.iMode = mode;
1934 return emfdc_record( dc_attr->emf, &emr.emr );
1935}
#define EMR_SETSTRETCHBLTMODE
Definition: wingdi.h:95

◆ EMFDC_SetTextAlign()

BOOL EMFDC_SetTextAlign ( WINEDC dc_attr,
UINT  align 
)

Definition at line 1856 of file emfdc.c.

1857{
1858 EMRSETTEXTALIGN emr;
1859
1861 emr.emr.nSize = sizeof(emr);
1862 emr.iMode = align;
1863 return emfdc_record( dc_attr->emf, &emr.emr );
1864}
int align(int length, int align)
Definition: dsound8.c:36
#define EMR_SETTEXTALIGN
Definition: wingdi.h:96

◆ EMFDC_SetTextColor()

BOOL EMFDC_SetTextColor ( WINEDC dc_attr,
COLORREF  color 
)

Definition at line 1897 of file emfdc.c.

1898{
1899 EMRSETTEXTCOLOR emr;
1900
1902 emr.emr.nSize = sizeof(emr);
1903 emr.crColor = color;
1904 return emfdc_record( dc_attr->emf, &emr.emr );
1905}
#define EMR_SETTEXTCOLOR
Definition: wingdi.h:98

◆ EMFDC_SetTextJustification()

BOOL EMFDC_SetTextJustification ( WINEDC dc_attr,
INT  extra,
INT  breaks 
)

Definition at line 1866 of file emfdc.c.

1867{
1869
1870 emr.emr.iType = EMR_SETTEXTJUSTIFICATION;
1871 emr.emr.nSize = sizeof(emr);
1872 emr.nBreakExtra = extra;
1873 emr.nBreakCount = breaks;
1874 return emfdc_record( dc_attr->emf, &emr.emr );
1875}
@ extra
Definition: id3.c:95

◆ EMFDC_SetViewportExtEx()

BOOL EMFDC_SetViewportExtEx ( WINEDC dc_attr,
INT  cx,
INT  cy 
)

Definition at line 2021 of file emfdc.c.

2022{
2024
2026 emr.emr.nSize = sizeof(emr);
2027 emr.szlExtent.cx = cx;
2028 emr.szlExtent.cy = cy;
2029 return emfdc_record( dc_attr->emf, &emr.emr );
2030}
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define EMR_SETVIEWPORTEXTEX
Definition: wingdi.h:85

◆ EMFDC_SetViewportOrgEx()

BOOL EMFDC_SetViewportOrgEx ( WINEDC dc_attr,
INT  x,
INT  y 
)

Definition at line 2043 of file emfdc.c.

2044{
2046
2048 emr.emr.nSize = sizeof(emr);
2049 emr.ptlOrigin.x = x;
2050 emr.ptlOrigin.y = y;
2051 return emfdc_record( dc_attr->emf, &emr.emr );
2052}
#define EMR_SETVIEWPORTORGEX
Definition: wingdi.h:86

◆ EMFDC_SetWindowExtEx()

BOOL EMFDC_SetWindowExtEx ( WINEDC dc_attr,
INT  cx,
INT  cy 
)

Definition at line 2032 of file emfdc.c.

2033{
2035
2037 emr.emr.nSize = sizeof(emr);
2038 emr.szlExtent.cx = cx;
2039 emr.szlExtent.cy = cy;
2040 return emfdc_record( dc_attr->emf, &emr.emr );
2041}
#define EMR_SETWINDOWEXTEX
Definition: wingdi.h:83

◆ EMFDC_SetWindowOrgEx()

BOOL EMFDC_SetWindowOrgEx ( WINEDC dc_attr,
INT  x,
INT  y 
)

Definition at line 2054 of file emfdc.c.

2055{
2057
2059 emr.emr.nSize = sizeof(emr);
2060 emr.ptlOrigin.x = x;
2061 emr.ptlOrigin.y = y;
2062 return emfdc_record( dc_attr->