🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.ms-windows.programmer.graphics
3 messages
3 total messages Started by Bertrand Lenoir-Welter Fri, 25 Jun 1999 00:00
How to get metric coordinates out of ENHMETARECORD
#19
Author: Bertrand Lenoir-Welter
Date: Fri, 25 Jun 1999 00:00
42 lines
2485 bytes
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
Re: How to get metric coordinates out of ENHMETARECORD
#17
Author: Jesko
Date: Mon, 05 Jul 1999 00:00
14 lines
1246 bytes
I think polyline is defined as follows:
(in brackets the size in bytes)
type   ( 4),
size   ( 4),
bounds (16), -> bounding rect
Count  ( 4), -> count of points
aptl   (  )  -> coordinate values

the polybezier has an equal structure but combines
three points (two directions and one end) in an unit.

Hope i didn't tell you something you already knew.

Jesko.
Re: How to get metric coordinates out of ENHMETARECORD
#18
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads