⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 meta.hpp

📁 WinCE5.0部分核心源码
💻 HPP
📖 第 1 页 / 共 5 页
字号:
    //
    // SetFatalError -- Sets the fFatalError member
    //
    void SetFatalError()  { fFatalError = TRUE; }

    //
    // vCommit -- Commit a metafile record to metafile.
    //
    VOID vCommit(ENHMETARECORD &mr)
    {
        ASSERT(mr.iType >= EMR_MIN && mr.iType <= EMR_MAX);
        ASSERT(mr.nSize % 4 == 0);
        ASSERT(!fFatalError);

#ifdef DEBUG
        //
        // Make sure no one wrote pass end of record.  See MDC::pvNewRecord.
        //
        for (ULONG ii = iMem + mr.nSize;
             ii < iMem + mr.nSize + 4 && ii < nMem;
             ii++)
        {
            ASSERT(*((PBYTE) hMem + ii) == 0xCC);
        }
#endif

        iMem        += mr.nSize;
        mrmf.nBytes += mr.nSize;
        mrmf.nRecords++;
    }
};

typedef MDC *PMDC;

PMDC
PmdcFromHdc( 
	HDC	hdc
	);




/*********************************Class************************************\
*
* There is no constructor or destructor for this object.  We do the
* initialization in pmfAllocMF and cleanup in vFreeMF.
*
\**************************************************************************/

class Metafile_t : public GDIOBJ
{
private:


	Metafile_t(
		GdiObjectHandle_t
		);

	friend
	Metafile_t*
	pmfAllocMF(
		ULONG	fl,
		CONST UNALIGNED DWORD *pb,
		LPCWSTR pwszFilename
		);


	friend
	VOID
	vFreeMF(
		Metafile_t*	pmf
		);


	friend
	BOOL
	bInternalPlayEMF(
		HDC	hdc,
		HENHMETAFILE hemf,
		CONST RECT *prectClip
		);


	friend
	HENHMETAFILE
	APIENTRY
	SetEnhMetaFileBitsAlt(
		HLOCAL
		);

public:

    union
		{
		HANDLE			hMem;          // Pointer to the metafile bits.
		PENHMETAHEADER	pmrmf;       // Pointer to MRMETAFILE record.  hMem alias.
		};
	PHANDLETABLE		pht;           // Pointer to the object handle table.
	ULONG				cLevel;        // Saved level.  Init to 1 before play or enum.


	static
	Metafile_t*
	GET_pMF(
		HGDIOBJ
		);

	HENHMETAFILE	
	GetHENHMETAFILE(
		void
		);



private:
	ULONG	iMem;          // Current memory index pointer.


public:
    virtual
	int
	GetObjectW(
		int,
		void*
		);

	virtual
	GDIOBJ*
	SelectObject(
		DC*
		);


#ifdef DEBUG
    virtual int     Dump(void);
#endif
};




//	pmfAllocMF flags
#define ALLOCMF_TRANSFER_BUFFER 0x1

extern const RECTL rclNull;

#define DIB_PAL_INDICES 2

/*********************************Class************************************\
* class MR
*
* Header for metafile records.
*
\**************************************************************************/

class MR        /* mr */
{
protected:
    DWORD   iType;      // Record type EMR_.
    DWORD   nSize;      // Record size in bytes.  Set in MDC::pvNewRecord.

    //
    // The following two fields define the top and bottom of the bounding
    // rectangle for object represented by this record.  This is used
    // by the print banding code to do trivial clipping on metafile records.
    //
    // Note that we don't need a full bounding rectangle for each MR,
    // as print bands always cover the full X extent of the page.
    //
    int yTop;
    int yBottom;

public:

    //
    // vInit -- Initializer.
    //
    VOID vInit(DWORD iType1)    { iType = iType1; }

    //
    // vCommit -- Commit the record to metafile.
    //
    VOID vCommit(PMDC pmdc)
    {
        pmdc->vCommit(*(PENHMETARECORD) this);
    }

    //
    // SetBounds is how we record the Y-only bounds information
    // about this record.  If this method is never called, then the
    // metafile record is assumed to have an infinitely large
    // bounding rectangle.
    //
    void SetBounds(int yTopArg, int yBottomArg)
    {
        ASSERT(yTopArg <= yBottomArg);
        yTop = yTopArg;
        yBottom = yBottomArg;
    }

    //
    // FInRect returns TRUE iff the current MR might intersect
    // the given rectangle at playback time.  The DC's current
    // viewport origin is taken into account.
    //
    BOOL FInRect(HDC hdc, const RECT *prect);

    //
    // bPlay -- Play the record.
    //
    BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht)
    {
        DEBUGMSG(
            TRUE,
            (TEXT("MR::bPlay: Unknown record (type: %d, size: %d)\r\n"),
                (int)iType,
                (int)nSize));
        ASSERT(0);
        return(FALSE);
    };
};

typedef MR *PMR;
#define SIZEOF_MR       (sizeof(MR))

/*********************************Class************************************\
* class MRD : public MR
*
* Metafile record with one DWORD.
*
* History:
*  Wed Jul 31 21:09:28 1991     -by-    Hock San Lee    [hockl]
* Wrote it.
\**************************************************************************/

class MRD : public MR           /* mrd */
{
protected:
    DWORD       d1;

public:
    //
    // Initializer -- Initialize the metafile record.
    //
    VOID vInit(DWORD iType_, DWORD d1_)
    {
        MR::vInit(iType_);
        d1 = d1_;
    }
};

typedef MRD *PMRD;
#define SIZEOF_MRD      (sizeof(MRD))

/*********************************Class************************************\
* class MRDD : public MR
*
* Metafile record with two DWORDs.
*
* History:
*  Wed Jul 17 17:10:28 1991     -by-    Hock San Lee    [hockl]
* Wrote it.
\**************************************************************************/

class MRDD : public MR          /* mrdd */
{
protected:
    DWORD       d1;
    DWORD       d2;

public:
    //
    // Initializer -- Initialize the metafile record.
    //
    VOID vInit(DWORD iType_, DWORD d1_, DWORD d2_)
    {
        MR::vInit(iType_);
        d1 = d1_;
        d2 = d2_;
    }
};

typedef MRDD *PMRDD;
#define SIZEOF_MRDD     (sizeof(MRDD))

/*********************************Class************************************\
* class MRDDDD : public MR
*
* Metafile record with four DWORDs.
*
* History:
*  Wed Jul 31 21:09:28 1991     -by-    Hock San Lee    [hockl]
* Wrote it.
\**************************************************************************/

class MRDDDD : public MR        /* mrdddd */
{
protected:
    DWORD       d1;
    DWORD       d2;
    DWORD       d3;
    DWORD       d4;

public:
    //
    // Initializer -- Initialize the metafile record.
    //
    VOID vInit(DWORD iType_, DWORD d1_, DWORD d2_, DWORD d3_, DWORD d4_)
    {
        MR::vInit(iType_);
        d1 = d1_;
        d2 = d2_;
        d3 = d3_;
        d4 = d4_;
    }
};

typedef MRDDDD *PMRDDDD;
#define SIZEOF_MRDDDD   (sizeof(MRDDDD))


/*********************************Class************************************\
* class MRBP : public MR
*
* Metafile record with Polys.
*
* History:
*  Wed Jul 17 17:10:28 1991     -by-    Hock San Lee    [hockl]
* Wrote it.
\**************************************************************************/

class MRBP : public MR          /* mrbp */
{
protected:
    DWORD       cptl;           // Number of points in the array.
    POINTL      aptl[1];        // Array of POINTL structures.

public:
    //
    // Initializer -- Initialize the metafile Poly(To) record.
    //
    VOID vInit(DWORD iType1, DWORD cptl1, CONST POINTL *aptl1);
};

typedef MRBP *PMRBP;
#define SIZEOF_MRBP(cptl)  (sizeof(MRBP)-sizeof(POINTL)+(cptl)*sizeof(POINTL))


/*********************************Class************************************\
* class MRE : public MR
*
* Metafile record for ellipses and rectangles.
*
* History:
*  Fri Sep 27 15:55:57 1991     -by-    Hock San Lee    [hockl]
* Wrote it.
\**************************************************************************/

class MRE : public MR   /* mre */
{
protected:
    ERECTL      erclBox;        // Inclusive-inclusive box in world units

public:
    //
    // Initializer -- Initialize the metafile record.
    //
    LONG iInit(DWORD iType, HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2);
};

typedef MRE *PMRE;
#define SIZEOF_MRE      (sizeof(MRE))

/*********************************Class************************************\
* class MRFILLRECT : public MR
*
* FILLRECT record.
*
\**************************************************************************/

class MRFILLRECT : public MR
{
protected:
	DWORD       imheBrush;      // Brush index in Metafile Handle Table.
	RECTL       Rect;

public:
	//
	// Initializer -- Initialize the metafile record.
	//
	BOOL
	bInit(
		PMDC	     pmdc,
		const RECTL* rc,
		DWORD	     imheBrush_
		);

	//
	// bPlay -- Play the record.
	//
	BOOL
	bPlay(
		HDC hdc,
		PHANDLETABLE pht,
		UINT cht
		);
};

typedef MRFILLRECT *PMRFILLRECT;
#define SIZEOF_MRFILLRECT (sizeof (MRFILLRECT))


/*********************************Class************************************\
* class MRBR : public MR
*
* Metafile record with a region.  The region data starts at offRgnData
* from the beginning of the record.
*
* History:
*  Tue Oct 29 10:43:25 1991     -by-    Hock San Lee    [hockl]
* Wrote it.
\**************************************************************************/

class MRBR : public MR          /* mrbr */
{
protected:
    DWORD       cRgnData;       // Size of region data in bytes.

public:
    //
    // Initializer -- Initialize the metafile record.
    //
	BOOL
	bInit(
		DWORD   iType,
		PMDC    pmdc,
		HRGN    hrgn,
		DWORD   cRgnData_,
		DWORD   offRgnData_
		);
};

typedef MRBR *PMRBR;
#define SIZEOF_MRBR(cRgnData)   (sizeof(MRBR) + ((cRgnData) + 3) / 4 * 4)

/*********************************Class************************************\
* class MRFILLRGN : public MRBR
*
* FILLRGN record.
*
* History:
*  Tue Oct 29 10:43:25 1991     -by-    Hock San Lee    [hockl]
* Wrote it.
\**************************************************************************/

class MRFILLRGN : public MRBR           /* mrfr */
{
protected:
    DWORD       imheBrush;      // Brush index in Metafile Handle Table.

public:
    //
    // Initializer -- Initialize the metafile record.
    //
	BOOL
	bInit(
		PMDC	pmdc,
		HRGN	hrgn,
		DWORD	cRgnData,
		DWORD	imheBrush_
		);

    //
    // bPlay -- Play the record.
    //
    BOOL bPlay(HDC hdc, PHANDLETABLE pht, UINT cht);
};

typedef MRFILLRGN *PMRFILLRGN;
#define SIZEOF_MRFILLRGN(cRgnData)      \
        (SIZEOF_MRBR(cRgnData) + sizeof(MRFILLRGN) - sizeof(MRBR))

/*********************************Class************************************\
* class MREXTSELECTCLIPRGN : public MR
*
* EXTSELECTCLIPRGN record.  The region data follows iMode immediately.
*
* History:
*  Tue Oct 29 10:43:25 1991     -by-    Hock San Lee    [hockl]
* Wrote it.
\**************************************************************************/

class MREXTSELECTCLIPRGN : public MR    /* mrescr */
{
protected:
    DWORD       cRgnData;       // Size of region data in bytes.
    DWORD       iMode;          // Region combine mode.

public:
    //
    // Initializer -- Initialize the metafile record.
    //
	BOOL
	bInit(
		HRGN	hrgn,
		DWORD	cRgnData_,
		DWORD	iMode_
		);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -