Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

EMF Rotation, reversing, fliping?

Posted on 1998-05-28
2
Medium Priority
?
399 Views
Last Modified: 2011-09-20
How can I EMF(Enhanced Meta File) image rotate?
and how can I reverse or flip the EMF images?
0
Comment
Question by:kjinihl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
AlFa earned 200 total points
ID: 1164883
try this (you can change mapping, org etc...)
void DoMetaFile(CDC *pDC, CRect &Rt, const char *lpFileName)
{
      ALDUSMFHEADER aldusMFHeader; //header of placable metafile
      METAHEADER mfHeader;
    HGLOBAL hMF, hMem;

      HFILE fh = _lopen(lpFileName, OF_READ);
      int iDcSav=pDC->SaveDC();
      _llseek(fh, 0, 0);

      /* read the placeable header */
      _lread(fh, (LPSTR)&aldusMFHeader, sizeof(ALDUSMFHEADER));
      /* return to read metafile header */
      _llseek(fh, sizeof(aldusMFHeader), 0);
      /* read the metafile header */
      _lread(fh, (LPSTR)&mfHeader, sizeof(METAHEADER));

      LPSTR lpMem;
      if (!(hMem = GlobalAlloc(GHND, (mfHeader.mtSize * 2L))))
      {
            return;
      }
      if (!(lpMem = (LPSTR) GlobalLock(hMem)))
      {
//            MessageBox(hWndMain, "Unable to lock memory for metafile bits",              NULL, MB_OK | MB_ICONHAND);
            (void)GlobalFree(hMem);
            return;
      }
      /* seek to the metafile bits */
      _llseek(fh, sizeof(aldusMFHeader), 0);
      /* read metafile bits */
      WORD wBytesRead = _hread(fh, lpMem, (DWORD)mfHeader.mtSize * (DWORD)2);
      /* if there was an error */
      if( wBytesRead == -1 )
      {
//            MessageBox(hWndMain, "Unable to read metafile bits", NULL, MB_OK | MB_ICONHAND);
            (void)GlobalUnlock(hMem);
            (void)GlobalFree(hMem);
            return;
      }

      _lclose(fh);
// Essai de coordonées dans un ordre désordonné
//       CRect R(aldusMFHeader.bbox.left, aldusMFHeader.bbox.bottom, aldusMFHeader.bbox.right, aldusMFHeader.bbox.top);
    CRect R(aldusMFHeader.bbox);
    CRect RT(Rt.left, Rt.top, Rt.right, Rt.bottom);

//      SetWindowScaleRect(pDC, RT, R, -1);
    pDC->LPtoDP(&RT);
      pDC->SetViewportOrg(RT.left, RT.bottom);
      pDC->SetMapMode(MM_ANISOTROPIC);

  /* set the windows origin to correspond to the bounding box origin
      contained in the placeable header */
/*       long lWR=abs(R.left) + abs(R.right),
      lHR=abs(R.top) + abs(R.bottom),
      lWT=abs(RT.right)+abs(RT.left),
      lHT=abs(RT.top)+abs(RT.bottom);*/
    if(cIsPreView*0)
            SetWindowScaleRect(pDC, R, Rt);
      else
      {
            long       lWR=(long)R.left -(long)R.right, //Largeur du rectangle
                        lHR=(long)R.top - (long)R.bottom,//Hauteur du rectangle
                        lWT=(long)RT.right - (long)RT.left,//Largeur de traçage
                        lHT=(long)RT.top - (long)RT.bottom;//Hauteur de traçage
            pDC->SetWindowOrg(R.left, R.bottom);
            /* set the window extents based on the abs value of the bbox coords */
            pDC->SetWindowExt((int)lWR, (int)lHR);
            pDC->SetViewportExt((int)lWT, (int)lHT);
      }
      if (0!=(hMF = SetMetaFileBits(hMem)))
      {
            extern char cIsPreView;
            if (cIsPreView)
                  ::EnumMetaFile(pDC->GetSafeHdc(), (HMETAFILE)hMF, EnumMFProc, (LPARAM)(LPSTR)pDC);
            else
                  BOOL bof = pDC->PlayMetaFile((HMETAFILE) hMF);
      }

      (void)GlobalFree(hMem);

      pDC->RestoreDC(iDcSav);
}

0
 

Author Comment

by:kjinihl
ID: 1164884
I Can't Realize Rotate with 90, 270 degree.
How Can I do this 90, 270 degree rotation of EMF ?
Please Immediately Reply to me.......
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question