[PATCH 2/6] gdiplus: Add helper for saving path objects in metafile
Piotr Caban
piotr.caban at gmail.com
Thu Jul 13 05:46:14 CDT 2017
On 07/13/17 12:17, Dmitry Timoshkov wrote:
> Piotr Caban <piotr at codeweavers.com> wrote:
>
>> +typedef struct EmfPlusPath
>> +{
>> + DWORD Version;
>> + DWORD PathPointCount;
>> + DWORD PathPointFlags;
>> + /* PathPoints[] */
>> + /* PathPointTypes[] */
>> + /* AlignmentPadding */
>> + BYTE data[1];
>> +} EmfPlusPath;
> ...
>> +static GpStatus METAFILE_AddPathObject(GpMetafile *metafile, GpPath *path, DWORD *id)
>> +{
> ...
>> + object_record->ObjectData.path.Version = 0xDBC01002;
>> + object_record->ObjectData.path.PathPointCount = path->pathdata.Count;
>> + object_record->ObjectData.path.PathPointFlags = 0;
>
> This looks very similar to the buffer format returned by GdipGetRegionData(),
> is it possible to use that API instead of a custom generator?
>
The path bits are identical, header is different. Because of that if we
want to use GdipGetRegionData we'll need to:
- create region from path
- allocate memory for region data
- copy parts of created data to emf+ structures (just the path bits)
There are no nice structures to access parts of GdipGetRegionData data.
Also in theory path objects should support 3 types of points
(EmfPlusPointF, EmfPlusPoint, EmfPlusPointR). I've never seen a file
that uses the EmfPlusPointR format so maybe it's identical to
GdipGetRegionData behavior.
I'm not sure if using GdipGetRegionData makes the code better, thanks to
it only this code will be deleted:
points = (EmfPlusPointF*)object_record->ObjectData.path.data;
for (i=0; i<path->pathdata.Count; i++)
{
points[i].X = path->pathdata.Points[i].X;
points[i].Y = path->pathdata.Points[i].Y;
}
types = (BYTE*)(points + path->pathdata.Count);
for (i=0; i<path->pathdata.Count; i++)
types[i] = path->pathdata.Types[i];
Thanks,
Piotr
More information about the wine-devel
mailing list