🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.graphics
Article #18

Re: How to get metric coordinates out of ENHMETARECORD

#18
From: Paul Andre LeBlanc
Date: Mon, 05 Jul 1999 00:00
78 lines
3340 bytes
Bertrand Lenoir-Welter wrote:
> 
> Hi all
> 
> I'm trying to integrate EMF import in a vector graphics program
> that handles its own geometric system (not just paints in a DC),
> so need to extract coordinates out of ENHMETARECORD. I'm able to
> read these coordinates directly from the record as long as it's
> EMR_MOVETOEX or EMR_LINETO types, but cannot find how to get for
> example a EMRPOLYLINE or EMRPOLYLINE18 or other structures from
> the record.
> 
> My code looks like this:
> 
> int CALLBACK EnhMetaFileProc(HDC, HANDLETABLE FAR*,
>                              ENHMETARECORD FAR *lpEMFR,
>                              int, LPARAM) {
>   switch(lpEMFR->iType) {
>     case EMR_MOVETOEX:
>       // this one's ok, coords are picked up from lpEMFR->dParm[]
>       break;
>     case EMR_LINETO:
>       // this one's ok too.
>       break;
>     case EMR_POLYLINE:
>       // How can I get coordinates then? lpEMFR->nSize gives a
>       // variable size, but lpEMFR->dParm[] are not coordinates.
>       // How can I access EMRPOLYLINE structure from here?
>       break;
>     case EMR_POLYLINE16:
>     case EMR_POLYGON:
>       // etc. Same question...
>       break;
>   }
> }
> 
> Note that I have no use of any DC since I just want to load
> vector info and convert it to my own data format.
> 
> Thanks for any help.
> 
> --
> Remove the "stuff" from my address for direct mail

This comes from the Win16 online help (I couldn't locate the equivalent
for Win32).

+++++++++++++++++++++++++

Polyline Metafile Record 

struct {
    DWORD rdSize;
    WORD  rdFunction;
    WORD  rdParm[];
}

Member	Description

rdSize		Specifies the record size, in words. 
rdFunction	Specifies the GDI function number 0x0325. 
rdParm		Contains the following elements: 

	Element		Description

	count		Number of points 
	list of points	List of individual points 

++++++++++++++++

IOW, lpEMFR->dParm[0] gives you the number of points, and successive
pairs of elements of the array give you the  individual coordinates.

The entry for the polygon record type was essentially the same. I would
presume that EMR_POLYLINE16 is the same, except that individual elements
in the array rdParm are 16 bits in size rather than 32 bits.

Paul
Technical Details
Message-ID: <378109E6.6C6F@sympatico.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3773AAFD.EAE@galaad.stuff.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1162da,7e27479009e6262c
X-Google-Attributes: gid1162da,public
X-Google-Thread: 101278,7e27479009e6262c
X-Google-Attributes: gid101278,public
X-Google-Thread: 103bde,7e27479009e6262c
X-Google-Attributes: gid103bde,public
X-Google-Thread: 105df1,7e27479009e6262c
X-Google-Attributes: gid105df1,public
From: Paul Andre LeBlanc <paul.a.leblanc@sympatico.ca>
Subject: Re: How to get metric coordinates out of ENHMETARECORD
Date: 1999/07/05
Message-ID: <378109E6.6C6F@sympatico.ca>
X-Deja-AN: 497473677
Content-Transfer-Encoding: 7bit
References: <3773AAFD.EAE@galaad.stuff.net>
Content-Type: text/plain; charset=us-ascii
X-Trace: news20.bellglobal.com 931203848 206.172.224.205 (Mon, 05 Jul 1999 15:44:08 EDT)
Organization: Sympatico
MIME-Version: 1.0
NNTP-Posting-Date: Mon, 05 Jul 1999 15:44:08 EDT
Newsgroups: comp.os.ms-windows.programmer.graphics,comp.os.ms-windows.programmer.misc,borland.public.cpp.winapi,microsoft.public.win32.programmer.gdi