Piotr Caban piotr@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?
On 07/13/17 12:17, Dmitry Timoshkov wrote:
Piotr Caban piotr@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
We will also eventually need to store region objects in metafiles. The way paths are stored in metafile regions looks identical to GetRegionData.
AFAICT the metafile format for regions is the same as GetRegionData, except that GetRegionData has additional headers.
I think that ideally we should be sharing code for serializing these object types. I don't think that going through the GdipGetRegionData API is necessarily the way to do it though.