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

📄 scemftxtutils.cpp

📁 Source code for EMFexplorer 1.0
💻 CPP
📖 第 1 页 / 共 2 页
字号:

	return _T("DIB_??");
}

CString SCBmiText(BITMAPINFOHEADER *pBmi)
{
	ASSERT(pBmi);
	CString sBmiText;

	sBmiText.Format(
		_T("biSize:%d, ")
		_T("biWidth:%d, ")
		_T("biHeight:%d, ")
		_T("biPlanes:%d, ")
		_T("biBitCount:%d, ")
		_T("biCompression:%d, ")
		_T("biSizeImage:%d, ")
		_T("biXPelsPerMeter:%d, ")
		_T("biYPelsPerMeter:%d, ")
		_T("biClrUsed:%d, ")
		_T("biClrImportant:%d"),

		pBmi->biSize, 
		pBmi->biWidth, 
		pBmi->biHeight, 
		pBmi->biPlanes,
		pBmi->biBitCount, 
		pBmi->biCompression, 
		pBmi->biSizeImage, 
		pBmi->biXPelsPerMeter, 
		pBmi->biYPelsPerMeter, 
		pBmi->biClrUsed, 
		pBmi->biClrImportant);

	return sBmiText;
}

////////////////////////////////////////////////////////////////////////
// Modes

CString SCMapModeText(int iMode)
{
	switch (iMode)
	{
	case MM_TEXT:			return _T("MM_TEXT");
	case MM_LOMETRIC:		return _T("MM_LOMETRIC");
	case MM_HIMETRIC:		return _T("MM_HIMETRIC");
	case MM_LOENGLISH:		return _T("MM_LOENGLISH");
	case MM_HIENGLISH:		return _T("MM_HIENGLISH");
	case MM_TWIPS:			return _T("MM_TWIPS");
	case MM_ISOTROPIC:		return _T("MM_ISOTROPIC");
	case MM_ANISOTROPIC:	return _T("MM_ANISOTROPIC");
	}
	
	return _T("MM_??");
}

CString SCBkModeText(int iMode)
{
	switch (iMode)
	{
	case OPAQUE:		return	_T("OPAQUE");
	case TRANSPARENT:	return	_T("TRANSPARENT");
	}

	return _T("??");
}

CString SCStretchBltModeText(int iMode)
{
	switch (iMode)
	{
	case BLACKONWHITE:	return	_T("BLACKONWHITE");	
	case WHITEONBLACK:	return	_T("WHITEONBLACK");
	case COLORONCOLOR:	return	_T("COLORONCOLOR");
	case HALFTONE:		return	_T("HALFTONE");
	}
	
	return _T("??");
}

CString SCTextAlignModeText(int iMode)
{
	CString strMode = _T("");

	// way
	if (iMode & TA_RTLREADING)
		strMode += _T(" TA_RTLREADING");

	// horizontal
	switch (iMode & SC_VTXTALIGN_MASK)
	{
	case TA_CENTER:	strMode += _T(" TA_CENTER"); break;
	case TA_RIGHT:	strMode += _T(" TA_RIGHT"); break;
	case TA_LEFT:	strMode += _T(" TA_LEFT"); break;
	}

	// vertical
	switch (iMode & SC_VTXTALIGN_MASK)
	{
	case TA_BASELINE:	strMode += _T(" TA_BASELINE"); break;
	case TA_BOTTOM:		strMode += _T(" TA_BOTTOM"); break;
	case TA_TOP:		strMode += _T(" TA_TOP"); break;
	}

	// update pos
	if (iMode & TA_UPDATECP)
		strMode += _T(" TA_UPDATECP");

	if (!strMode.IsEmpty())
		strMode.Right(strMode.GetLength()-1);
	return strMode;
}

CString SCPolyFillModeText(int iMode)
{
	switch (iMode)
	{
	case ALTERNATE:	return	_T("ALTERNATE");	
	case WINDING:	return	_T("WINDING");
	}
	
	return _T("??");
}

CString SCFloodFillModeText(int iMode)
{
	switch (iMode)
	{
	case FLOODFILLBORDER:	return	_T("FLOODFILLBORDER");	
	case FLOODFILLSURFACE:	return	_T("FLOODFILLSURFACE");
	}
	
	return _T("??");
}

CString SCRgnModeText(int iMode)
{
	switch (iMode)
	{
	case RGN_AND:	return	_T("RGN_AND");	
	case RGN_COPY:	return	_T("RGN_COPY");
	case RGN_DIFF:	return	_T("RGN_DIFF");	
	case RGN_OR:	return	_T("RGN_OR");
	case RGN_XOR:	return	_T("RGN_XOR");
	}
	
	return _T("RGN_??");
}

CString SCFormatRgnModeText(int iMode)
{
	CString strMode;
	strMode.Format(SC_STRFMT_MODE2,
		iMode, SCRgnModeText(iMode));
	return strMode;
}

CString SCGradientFillModeText(int iMode)
{
	switch (iMode)
	{
	case GRADIENT_FILL_RECT_H:		return	_T("GRADIENT_FILL_RECT_H");	
	case GRADIENT_FILL_RECT_V:		return	_T("GRADIENT_FILL_RECT_V");
	case GRADIENT_FILL_TRIANGLE:	return	_T("GRADIENT_FILL_TRIANGLE");	
	}
	
	return _T("GRADIENT_FILL_??");
}

CString SCLayoutModeText(int iMode)
{
	CString strMode;
	
	if (iMode & LAYOUT_ORIENTATIONMASK)
	{
		if (iMode & LAYOUT_RTL)
			strMode += _T("LAYOUT_RTL|");

		if (iMode & LAYOUT_BTT)
			strMode += _T("LAYOUT_BTT|");

		if (iMode & LAYOUT_VBH)
			strMode += _T("LAYOUT_VBH|");
	}
	if (iMode & LAYOUT_BITMAPORIENTATIONPRESERVED)
		strMode += _T("LAYOUT_BITMAPORIENTATIONPRESERVED|");

	if (strMode.IsEmpty())
		return  _T("<default>");
	
	strMode.TrimRight(_T("|"));
	
	return strMode;
}

CString SCModifyWorldTransformModeText(int iMode)
{
	switch (iMode)
	{
	case MWT_IDENTITY:		return _T("MWT_IDENTITY");
	case MWT_LEFTMULTIPLY:	return _T("MWT_LEFTMULTIPLY");
	case MWT_RIGHTMULTIPLY: return _T("MWT_RIGHTMULTIPLY");
	}
	return _T("MWT_??");
}

CString SCFormatModifyWorldTransformModeText(int iMode)
{
	CString strMode;
	strMode.Format(SC_STRFMT_MODE2,
		iMode, SCModifyWorldTransformModeText(iMode));
	return strMode;
}

CString SCICMModeText(int iMode)
{
	switch (iMode)
	{
	case ICM_ON:				return _T("ICM_ON");
	case ICM_OFF:				return _T("ICM_OFF");
	case ICM_QUERY:				return _T("ICM_QUERY");
	case ICM_DONE_OUTSIDEDC:	return _T("ICM_DONE_OUTSIDEDC"); 
	}
	return _T("ICM_??");
}

CString SCFormatICMModeText(int iMode)
{
	CString strMode;
	strMode.Format(SC_STRFMT_MODE2,
		iMode, SCICMModeText(iMode));
	return strMode;
}

////////////////////////////////////////////////////////////////////////
// Polygons

CString SCBoundsText(RECTL& rclBounds)
{
	CString strText;
	strText.Format(SC_STRFMT_RCLBOUNDS,
		SC_PARAM_RCLBOUNDS(rclBounds));
	
	return strText;
}


CString SCPolygonText(RECTL& rclBounds, POINTL* pPoints, DWORD dwCount)
{
	ASSERT(pPoints);

	CString strText;
	strText.Format(SC_STRFMT_RCLBOUNDS _T(", %s"),
		SC_PARAM_RCLBOUNDS(rclBounds),
		SCPointsText(pPoints, dwCount));
	
	return strText;
}

CString SCPolygonTextS(RECTL& rclBounds, POINTS* pPoints, DWORD dwCount)
{
	ASSERT(pPoints);

	CString strText;
	strText.Format(SC_STRFMT_RCLBOUNDS _T(", %s"),
		SC_PARAM_RCLBOUNDS(rclBounds),
		SCPointsText(pPoints, dwCount));
	
	return strText;
}


CString SCFormatEmrPolygon(EMRPOLYGON* pRec)
{
	ASSERT(pRec);

	CString strText;
	strText.Format(SC_STRFMT_RCLBOUNDS _T(", %s"),
		SC_PARAM_RCLBOUNDS(pRec->rclBounds),
		SCPointsText(pRec->aptl, pRec->cptl));
	
	return strText;
}

CString SCFormatEmrPolygonS(EMRPOLYGON16* pRec)
{
	ASSERT(pRec);

	CString strText;
	strText.Format(SC_STRFMT_RCLBOUNDS _T(", %s"),
		SC_PARAM_RCLBOUNDS(pRec->rclBounds),
		SCPointsText(pRec->apts, pRec->cpts));
	
	return strText;
}

CString SCFormatEmrPolyPolygon(EMRPOLYPOLYGON* pRec)
{
	ASSERT(pRec);

	CString strText;
	strText.Format(SC_STRFMT_RCLBOUNDS _T(", nPolys:%d, %s"),
		SC_PARAM_RCLBOUNDS(pRec->rclBounds),
		pRec->nPolys,
		SCPointsText(pRec->aptl, pRec->cptl));
	
	return strText;
}

CString SCFormatEmrPolyPolygonS(EMRPOLYPOLYGON16* pRec)
{
	ASSERT(pRec);

	CString strText;
	strText.Format(SC_STRFMT_RCLBOUNDS _T(", nPolys:%d, %s"),
		SC_PARAM_RCLBOUNDS(pRec->rclBounds),
		pRec->nPolys,
		SCPointsText(pRec->apts, pRec->cpts));
	
	return strText;
}


////////////////////////////////////////////////////////////////////////
// Regions

CString SCRegionDataText(RGNDATA* pRgnData, DWORD dwSize)
{
	CString strBox;
	if (pRgnData && dwSize)
	{
		CRect rect(0, 0, 0, 0);
		HRGN hRgn = ::ExtCreateRegion(NULL, dwSize, pRgnData);
		if (hRgn)
		{
			::GetRgnBox(hRgn, &rect);
			::DeleteObject(hRgn);

			strBox.Format(_T("%d,%d,%d,%d"),
				SC_PARAM_RECT(rect));
		}
	}
	
	CString strText;
	strText.Format(_T("RGNDATA[ptr:0x%08x, size:%d, box(%s)]"),
		pRgnData,
		dwSize,
		strBox);
	
	return strText;
}

////////////////////////////////////////////////////////////////////////
// Color space

CString SCColorSpaceTypeText(LCSCSTYPE lcsCSType)
{
	switch (lcsCSType)
	{
	case LCS_CALIBRATED_RGB:		return	_T("LCS_CALIBRATED_RGB");	
	case LCS_sRGB:					return	_T("LCS_sRGB");
	case LCS_WINDOWS_COLOR_SPACE:	return	_T("LCS_WINDOWS_COLOR_SPACE");	
	}

	return _T("LCS_??");
}

CString SCColorSpaceIntentText(LCSGAMUTMATCH lcsIntent)
{
	switch (lcsIntent)
	{
	case LCS_GM_ABS_COLORIMETRIC:	return	_T("LCS_GM_ABS_COLORIMETRIC");	
	case LCS_GM_BUSINESS:			return	_T("LCS_GM_BUSINESS");
	case LCS_GM_GRAPHICS:			return	_T("LCS_GM_GRAPHICS");	
	case LCS_GM_IMAGES:				return	_T("LCS_GM_IMAGES");	
	}

	return _T("LCS_GM_??");
}

// Calculate floating point from fixed point
#define SC_INV_FXPT32(dw, f)	(((int)dw + 0.0f) / (1 << f))

#define SCFloatFrom2Dot30(dw)	SC_INV_FXPT32(dw, 30)
#define SCFloatFrom16Dot16(dw)  SC_INV_FXPT32(dw, 16)

CString SCCie2Text(CIEXYZ xyz)
{
	CString strText;
	strText.Format(_T("(x:%.4f, y:%.4f, z:%.4f)"),
		SCFloatFrom2Dot30(xyz.ciexyzX),
		SCFloatFrom2Dot30(xyz.ciexyzY),
		SCFloatFrom2Dot30(xyz.ciexyzZ));
	return strText;
}

template <class T>
CString T_SCFormatLogColorSpaceAsText(T& rlcs)
{
	CString strText;

	CIEXYZTRIPLE& rEP = rlcs.lcsEndpoints;

	CString strAdd;
	strAdd.Format(_T("signature:0x%08X, ver:0x%04X, size:%d, type(%d=%s), intent(%d=%s),")
		_T(" EndPoints[R:%s, G:%s, B:%s], Gamma(R:%.4f, G:%.4f, B:%.4f)"),
		rlcs.lcsSignature,
		rlcs.lcsVersion, 
		rlcs.lcsSize, 
		rlcs.lcsCSType, SCColorSpaceTypeText(rlcs.lcsCSType),
		rlcs.lcsIntent,	SCColorSpaceIntentText(rlcs.lcsIntent), 
		SCCie2Text(rEP.ciexyzRed), SCCie2Text(rEP.ciexyzGreen), SCCie2Text(rEP.ciexyzBlue),
		SCFloatFrom16Dot16(rlcs.lcsGammaRed),
		SCFloatFrom16Dot16(rlcs.lcsGammaGreen), 
		SCFloatFrom16Dot16(rlcs.lcsGammaBlue));

	if (rlcs.lcsFilename)
	{
		strAdd += _T(", file:");
		strAdd += rlcs.lcsFilename;
	}

	strText.Format(_T("LCS[%s]"), strAdd);
	return strText;
}

CString SCFormatLogColorSpaceAsTextA(LOGCOLORSPACEA& rlcs)
{
	return T_SCFormatLogColorSpaceAsText(rlcs);
}

CString SCFormatLogColorSpaceAsTextW(LOGCOLORSPACEW& rlcs)
{
	return T_SCFormatLogColorSpaceAsText(rlcs);
}

CString SCPixelFormatText(PIXELFORMATDESCRIPTOR& rPfd)
{
	CString strText;

	strText.Format(
	 _T("Size:%d, ")
	 _T("Version:%d, ")
	 _T("Flags:%d, ")
	 _T("PixelType:%d, ")
	 _T("ColorBits:%d, ")
	 _T("RedBits:%d, ")
	 _T("RedShift:%d, ")
     _T("GreenBits:%d, ")
     _T("GreenShift:%d, ")
     _T("BlueBits:%d, ")
     _T("BlueShift:%d, ")
     _T("AlphaBits:%d, ")
     _T("AlphaShift:%d, ")
     _T("AccumBits:%d, ")
     _T("AccumRedBits:%d, ")
     _T("AccumGreenBits:%d, ")
     _T("AccumBlueBits:%d, ")
     _T("AccumAlphaBits:%d, ")
     _T("DepthBits:%d, ")
     _T("StencilBits:%d, ")
     _T("AuxBuffers:%d, ")
     _T("LayerType:%d, ")
     _T("Reserved:%d, ")
     _T("LayerMask:%d, ")
     _T("VisibleMask:%d, ")
     _T("DamageMask:%d"),

     rPfd.nSize,
     rPfd.nVersion,
     rPfd.dwFlags,
     rPfd.iPixelType,
     rPfd.cColorBits,
     rPfd.cRedBits,
     rPfd.cRedShift,
     rPfd.cGreenBits,
     rPfd.cGreenShift,
     rPfd.cBlueBits,
     rPfd.cBlueShift,
     rPfd.cAlphaBits,
     rPfd.cAlphaShift,
     rPfd.cAccumBits,
     rPfd.cAccumRedBits,
     rPfd.cAccumGreenBits,
     rPfd.cAccumBlueBits,
     rPfd.cAccumAlphaBits,
     rPfd.cDepthBits,
     rPfd.cStencilBits,
     rPfd.cAuxBuffers,
     rPfd.iLayerType,
     rPfd.bReserved,
     rPfd.dwLayerMask,
     rPfd.dwVisibleMask,
     rPfd.dwDamageMask);
	
	return strText;
}

////////////////////////////////////////////////////////////////////////
// Miscellaneous

CString SCGDICommentText(DWORD dwTag)
{
	switch(dwTag)
	{
	case GDICOMMENT_WINDOWS_METAFILE:	return _T("GDI.Embedded WMF");
	case GDICOMMENT_MULTIFORMATS:		return _T("GDI.Embedded formats");
	case GDICOMMENT_BEGINGROUP:			return _T("GDI.Begin Group");
	case GDICOMMENT_ENDGROUP:			return _T("GDI.End Group");
	case EPS_SIGNATURE:					return _T("GDI.EPS Signature");
	case GDICOMMENT_UNICODE_STRING:		return _T("GDI.UNICODE String");
	case GDICOMMENT_UNICODE_END:		return _T("GDI.UNICODE End");
	}
	
	return  _T("GDI.Private");
}

CString SCGDIObjectTypeText(HGDIOBJ hGdiObj)
{
	CString strText;
	
	switch(GetObjectType(hGdiObj))
	{
	case OBJ_EXTPEN:
		{
			strText = _T("OBJ_EXTPEN");
			EXTLOGPEN LogPen;
			if (::GetObject((HPEN)hGdiObj, sizeof(LogPen), &LogPen))
			{
				strText += _T(".(") + SCPenStyleText(LogPen.elpPenStyle) + _T(")");
			}
		}
		break;
		
	case OBJ_PEN:
		{
			strText = _T("OBJ_PEN");
			LOGPEN LogPen;
			if (::GetObject((HPEN)hGdiObj, sizeof(LogPen), &LogPen))
			{
				strText += _T(".(") + SCPenStyleText(LogPen.lopnStyle) + _T(")");
			}
		}
		break;
		
	case OBJ_BRUSH:
		{
			strText = _T("OBJ_BRUSH");
			LOGBRUSH LogBrush;
			if (::GetObject((HBRUSH)hGdiObj, sizeof(LogBrush), &LogBrush))
			{
				strText += _T(".(") + SCBrushStyleText(LogBrush.lbStyle) + _T(")");
			}
		}
		break;
		
	case OBJ_FONT:			strText = _T("OBJ_FONT"); break;
	case OBJ_REGION:		strText = _T("OBJ_REGION"); break;
	case OBJ_PAL:			strText = _T("OBJ_PAL"); break;
	case OBJ_BITMAP:		strText = _T("OBJ_BITMAP"); break;
		
		// Just for completeness
	case OBJ_MEMDC:			strText = _T("OBJ_MEMDC");	break;
	case OBJ_METAFILE:		strText = _T("OBJ_METAFILE"); break;
	case OBJ_METADC:		strText = _T("OBJ_METADC"); break;
	case OBJ_ENHMETAFILE:	strText = _T("OBJ_ENHMETAFILE"); break;
	case OBJ_ENHMETADC:		strText = _T("OBJ_ENHMETADC"); break;
	case OBJ_DC:			strText = _T("OBJ_DC"); break;
		
		// Error
	default:
		strText.Format(_T("OBJ_?? GDI handle=%d"), hGdiObj);
		break;
	}

	return strText;
}

⌨️ 快捷键说明

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