示例#1
0
static ZRef<NPaintDataRep> sRead_NPaintDataRep(const ZStreamRPos& iStreamRPos, string& oFormat)
	{
	iStreamRPos.SetPosition(0);
	if (ZRef<NPaintDataRep> theRep = sTryRead_BMP(iStreamRPos))
		{
		oFormat = "bmp";
		return theRep;
		}

	iStreamRPos.SetPosition(0);
	if (ZRef<NPaintDataRep> theRep = sTryRead_GIF(iStreamRPos))
		{
		oFormat = "gif";
		return theRep;
		}

	iStreamRPos.SetPosition(0);
	if (ZRef<NPaintDataRep> theRep = sTryRead_JPEG(iStreamRPos))
		{
		oFormat = "jpg";
		return theRep;
		}

	iStreamRPos.SetPosition(0);
	if (ZRef<NPaintDataRep> theRep = sTryRead_PNG(iStreamRPos))
		{
		oFormat = "png";
		return theRep;
		}

	iStreamRPos.SetPosition(0);
	ZRef<NPaintDataRep> theRep = new NPaintDataRep;
	theRep->FromStream(iStreamRPos);
	if (theRep->HasData())
		{
		oFormat = "kf";
		return theRep;
		}

	return new NPaintDataRep(ZPoint(320, 240));
	}