23#define NONAMELESSUNION
28#include "wine/unicode.h"
582 FIXME(
"not implemented for object type %u.\n",
object->type);
587 object->u.object =
NULL;
600 WARN(
"metafile closed while recording\n");
607 IStream_Release(
metafile->record_stream);
626 metafile->comment_data = heap_alloc_zero(data_size);
633 metafile->comment_data_size = data_size;
639 if (size_needed >
metafile->comment_data_size)
641 DWORD data_size = size_needed * 2;
642 BYTE *new_data = heap_alloc_zero(data_size);
649 metafile->comment_data_size = data_size;
672 if (
metafile->comment_data_length > 4)
740 REAL framerect_factor_x, framerect_factor_y;
757 framerect_factor_x = 2540.0 / dpix;
758 framerect_factor_y = 2540.0 / dpiy;
761 framerect_factor_x = framerect_factor_y = 2540.0 / 72.0;
764 framerect_factor_x = framerect_factor_y = 2540.0;
767 framerect_factor_x = framerect_factor_y = 2540.0 / 300.0;
770 framerect_factor_x = framerect_factor_y = 100.0;
773 framerect_factor_x = framerect_factor_y = 1.0;
779 rc.
left = framerect_factor_x * frameRect->X;
780 rc.
top = framerect_factor_y * frameRect->Y;
781 rc.
right = rc.
left + framerect_factor_x * frameRect->Width;
782 rc.
bottom = rc.
top + framerect_factor_y * frameRect->Height;
803 (*metafile)->image.palette =
NULL;
804 (*metafile)->image.xres = dpix;
805 (*metafile)->image.yres = dpiy;
806 (*metafile)->bounds.X = (*metafile)->bounds.Y = 0.0;
807 (*metafile)->bounds.Width = (*metafile)->bounds.Height = 1.0;
809 (*metafile)->metafile_type =
type;
810 (*metafile)->record_dc = record_dc;
811 (*metafile)->comment_data =
NULL;
812 (*metafile)->comment_data_size = 0;
813 (*metafile)->comment_data_length = 0;
814 (*metafile)->hemf =
NULL;
819 (*metafile)->auto_frame =
TRUE;
820 (*metafile)->auto_frame_min.X = 0;
821 (*metafile)->auto_frame_min.Y = 0;
822 (*metafile)->auto_frame_max.X = -1;
823 (*metafile)->auto_frame_max.Y = -1;
845 GpRectF frameRectF, *pFrameRectF;
851 frameRectF.
X = frameRect->X;
852 frameRectF.
Y = frameRect->Y;
853 frameRectF.
Width = frameRect->Width;
854 frameRectF.
Height = frameRect->Height;
855 pFrameRectF = &frameRectF;
877 (*metafile)->record_stream =
stream;
889 if (!
metafile->auto_frame || !num_points)
895 for (
i=0;
i<num_points;
i++)
897 if (
points[
i].X < metafile->auto_frame_min.X)
901 if (
points[
i].Y < metafile->auto_frame_min.Y)
920 metafile->record_graphics->xres = 96.0;
921 metafile->record_graphics->yres = 96.0;
1011 data->BrushData.solid.SolidColor = solid->
color;
1079 integer_rects =
FALSE;
1095 record->BrushID = brushid;
1122 corners[0].
X = rects[
i].X;
1123 corners[0].
Y = rects[
i].Y;
1124 corners[1].
X = rects[
i].X + rects[
i].Width;
1125 corners[1].
Y = rects[
i].Y;
1126 corners[2].
X = rects[
i].X;
1127 corners[2].
Y = rects[
i].Y + rects[
i].Height;
1128 corners[3].
X = rects[
i].X + rects[
i].Width;
1129 corners[3].
Y = rects[
i].Y + rects[
i].Height;
1251 record->Header.Flags = 0;
1390 record->DestRect = *dstrect;
1391 record->SrcRect = *srcrect;
1392 record->StackIndex = StackIndex;
1414 record->Header.Flags = 0;
1415 record->StackIndex = StackIndex;
1437 record->Header.Flags = 0;
1438 record->StackIndex = StackIndex;
1460 record->Header.Flags = 0;
1461 record->StackIndex = StackIndex;
1483 record->Header.Flags = 0;
1484 record->StackIndex = StackIndex;
1522 RECTL bounds_rc, gdi_bounds_rc;
1533 gdi_bounds_rc =
header.u.EmfHeader.rclBounds;
1534 if (gdi_bounds_rc.
right > gdi_bounds_rc.
left && gdi_bounds_rc.
bottom > gdi_bounds_rc.
top)
1546 HENHMETAFILE new_hemf;
1606 IStream_Release(
metafile->record_stream);
1644 XFORM combined,
final;
1747 switch (bitmapdata->
Type)
1776 if (data_size < bitmapdata->
Height * bitmapdata->
Stride)
1802 IWICImagingFactory_Release(
factory);
1811 IWICStream_Release(
stream);
1815 WARN(
"Invalid bitmap type %d.\n", bitmapdata->
Type);
1821 FIXME(
"image type %d not supported.\n",
data->Type);
1842 if (
data->PathPointFlags & 0x800)
1844 FIXME(
"RLE encoded path data is not supported.\n");
1849 if (
data->PathPointFlags & 0x4000)
1857 if (data_size <
size)
1864 (*path)->pathdata.Count =
data->PathPointCount;
1865 (*path)->pathdata.Points =
GdipAlloc(
data->PathPointCount *
sizeof(*(*path)->pathdata.Points));
1866 (*path)->pathdata.Types =
GdipAlloc(
data->PathPointCount *
sizeof(*(*path)->pathdata.Types));
1867 (*path)->datalen = (*path)->pathdata.Count;
1869 if (!(*path)->pathdata.Points || !(*path)->pathdata.Types)
1875 if (
data->PathPointFlags & 0x4000)
1880 (*path)->pathdata.Points[
i].X =
points[
i].X;
1881 (*path)->pathdata.Points[
i].Y =
points[
i].Y;
1918 left = heap_alloc_zero(
sizeof(*
left));
1935 node->elementdata.combine.left =
left;
1936 node->elementdata.combine.right =
right;
1960 const BYTE *path_data;
1961 const UINT *data_size;
1985 FIXME(
"element type %#x is not supported\n", *
type);
2034 if (data_size < header_size)
2050 data->BrushData.hatch.BackColor, (
GpHatch **)brush);
2060 brushflags =
data->BrushData.texture.BrushDataFlags;
2084 UINT position_count = 0;
2090 brushflags =
data->BrushData.lineargradient.BrushDataFlags;
2106 position_count = *(
DWORD *)(record_data +
offset);
2112 if (data_size !=
offset + position_count * (
sizeof(
float) +
sizeof(
EmfPlusARGB)))
2117 if (data_size !=
offset + position_count * 2 *
sizeof(
float))
2121 startpoint.
X =
data->BrushData.lineargradient.RectF.X;
2122 startpoint.
Y =
data->BrushData.lineargradient.RectF.Y;
2123 endpoint.X = startpoint.
X +
data->BrushData.lineargradient.RectF.Width;
2124 endpoint.Y = startpoint.
Y +
data->BrushData.lineargradient.RectF.Height;
2127 data->BrushData.lineargradient.EndColor,
data->BrushData.lineargradient.WrapMode, &gradient);
2137 position_count *
sizeof(
REAL)), (
REAL *)(record_data +
offset), position_count);
2140 (
REAL *)(record_data +
offset), position_count);
2143 FIXME(
"BrushDataIsGammaCorrected is not handled.\n");
2155 FIXME(
"brush type %u is not supported.\n",
data->Type);
2253 void *
object =
NULL;
2289 FIXME(
"PenDataTransform is not supported.\n");
2330 FIXME(
"PenDataDashedLineCap is not supported.\n");
2344 FIXME(
"PenDataDashedLine is not supported.\n");
2350 FIXME(
"PenDataNonCenter is not supported.\n");
2357 FIXME(
"PenDataCompundLine is not supported.\n");
2364 FIXME(
"PenDataCustomStartCap is not supported.\n");
2371 FIXME(
"PenDataCustomEndCap is not supported.\n");
2404 if (!(familyname =
GdipAlloc((
data->Length + 1) *
sizeof(*familyname))))
2407 memcpy(familyname,
data->FamilyName,
data->Length *
sizeof(*familyname));
2408 familyname[
data->Length] = 0;
2424 if (data_size !=
sizeof(*
data))
2431 !!
data->ObjectClamp);
2433 object = attributes;
2439 FIXME(
"not implemented for object type %d.\n",
type);
2472 if (recordType >= 1 && recordType <= 0x7a)
2489 FIXME(
"not implemented for record type %x\n", recordType);
2526 record->iType = recordType;
2532 ERR(
"PlayEnhMetaFileRecord failed\n");
2609 rects = temp_rects = heap_alloc_zero(
sizeof(
GpRectF) *
record->Count);
2614 rects[
i].
X = int_rects[
i].
X;
2615 rects[
i].
Y = int_rects[
i].
Y;
2784 REAL scale_x, scale_y;
2788 cont = heap_alloc_zero(
sizeof(*cont));
2820 scaled_srcrect.
X = scale_x *
record->SrcRect.X;
2821 scaled_srcrect.
Y = scale_y *
record->SrcRect.Y;
2822 scaled_srcrect.
Width = scale_x *
record->SrcRect.Width;
2823 scaled_srcrect.
Height = scale_y *
record->SrcRect.Height;
2842 cont = heap_alloc_zero(
sizeof(*cont));
3017 if (draw->
count != 3)
3020 if ((
flags >> 13) & 1)
3021 FIXME(
"image effects are not supported.\n");
3023 if ((
flags >> 11) & 1)
3033 if ((
flags >> 11) & 1)
3037 for (
i = 1;
i < 3;
i++)
3043 else if ((
flags >> 14) & 1)
3045 for (
i = 0;
i < 3;
i++)
3084 brush = real_metafile->
objtable[
fill->data.BrushId].u.brush;
3104 if (
fill->Count == 0)
3109 else if (
flags & 0x4000)
3132 brush = real_metafile->
objtable[
fill->BrushId].u.brush;
3135 if (
flags & (0x800 | 0x4000))
3142 for (
i = 1;
i <
fill->Count;
i++)
3150 for (
i = 0;
i <
fill->Count;
i++)
3197 brush = real_metafile->
objtable[
fill->BrushId].u.brush;
3202 fill->RectData.rect.Y,
fill->RectData.rect.Width,
fill->RectData.rect.Height);
3205 fill->RectData.rectF.Y,
fill->RectData.rectF.Width,
fill->RectData.rectF.Height);
3236 brush = real_metafile->
objtable[
fill->BrushId].u.brush;
3241 fill->RectData.rect.Y,
fill->RectData.rect.Width,
fill->RectData.rect.Height,
3242 fill->StartAngle,
fill->SweepAngle);
3245 fill->RectData.rectF.Y,
fill->RectData.rectF.Width,
fill->RectData.rectF.Height,
3246 fill->StartAngle,
fill->SweepAngle);
3370 FIXME(
"Not implemented for record type %x\n", recordType);
3393 data->metafile->handle_count = nObj;
3414 pStr,
data->callback_data);
3426 if (lpEMFR->
nSize != 8)
3432 pStr,
data->callback_data);
3446 TRACE(
"(%p,%p,%p,%i,%p,%i,%p,%p,%p)\n", graphics,
metafile,
3447 destPoints,
count, srcRect, srcUnit,
callback, callbackData,
3450 if (!graphics || !
metafile || !destPoints ||
count != 3 || !srcRect)
3464 data.callback_data = callbackData;
3465 data.metafile = real_metafile;
3469 real_metafile->
src_rect = *srcRect;