• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ZRect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ZRect的典型用法代码示例。如果您正苦于以下问题:C++ ZRect类的具体用法?C++ ZRect怎么用?C++ ZRect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ZRect类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ZDC

ZDC_Off::ZDC_Off(const ZDC& inOther, bool inForceOffscreen)
:	ZDC(inOther)
	{
	// Initially, we copy all settings from inOther, then we attempt to
	// create a new offscreen canvas.
	if (inForceOffscreen || !fCanvas->IsOffScreen())
		{
		ZRect canvasClipRect = this->GetClip().Bounds() + this->GetOrigin();
		ZRef<ZDCCanvas> offCanvas;
		try
			{
			// We allow the offscreen creation to fail if inForceOffscreen is false.
			offCanvas = fCanvas->CreateOffScreen(canvasClipRect);
			}
		catch (...)
			{
			if (inForceOffscreen)
				throw;
			}
		if (offCanvas && offCanvas->IsOffScreen())
			{
			fCanvas = offCanvas;
			this->ZeroChangeCounts();
			fState.fOriginComp = canvasClipRect.TopLeft();
			this->SetOrigin(inOther.GetOrigin());
			this->SetPatternOrigin(inOther.GetPatternOrigin());
			this->SetClip(inOther.GetClip());
			}
		}
	}
开发者ID:,项目名称:,代码行数:30,代码来源:


示例2: ZAssertStop

void ZDCCanvas_X_NonWindow::CopyFrom(ZDCState& ioState, const ZPoint& inDestLocation, ZRef<ZDCCanvas> inSourceCanvas, const ZDCState& inSourceState, const ZRect& inSourceRect)
	{
	ZRef<ZDCCanvas_X> sourceCanvasX = ZRefDynamicCast<ZDCCanvas_X>(inSourceCanvas);
	ZAssertStop(kDebug_X, sourceCanvasX != nil);

	if (!fDrawable || !sourceCanvasX->Internal_GetDrawable())
		return;

	SetupLock theSetupLock(this);

	// We can (currently) only copy from one drawable to another if they're on the same display
	//	ZAssertStop(kDebug_X, fXServer == sourceCanvasX->fXServer);

	ZRect destRect = inSourceRect + (ioState.fOrigin + inDestLocation - inSourceRect.TopLeft());
	ZRect sourceRect = inSourceRect + inSourceState.fOrigin;

	ZDCRgn realClip = this->Internal_CalcClipRgn(ioState);

	fXServer->SetRegion(fGC, realClip.GetRegion());
	++fChangeCount_Clip;

	fXServer->SetFunction(fGC, GXcopy);
	++fChangeCount_Mode;

	fXServer->CopyArea(sourceCanvasX->Internal_GetDrawable(), fDrawable, fGC,
				sourceRect.Left(), sourceRect.Top(),
				sourceRect.Width(), sourceRect.Height(),
				destRect.Left(), destRect.Top());
	}
开发者ID:,项目名称:,代码行数:29,代码来源:


示例3: if

bool ZRect::operator<(const ZRect &rhs) const
{
    //< is the one that is closer to top corner (as a whole)//

    if(rY < rhs.Y())    //check Ys
        return true;
    else if(rY > rhs.Y())
        return false;
    else
    {
        if(rX < rhs.X())    //check Xs
            return true;
        else if(rX > rhs.X())
            return false;
        else
        {
            if(rHeight < rhs.Height())    //check heights
                return true;
            else if(rHeight > rhs.Height())
                return false;
            else
            {
                if(rWidth < rhs.Width())    //check widths
                    return true;
                else if(rWidth > rhs.Width())
                    return false;
                else
                    return false;    //nothing left to check, they are ==
            }
        }
    }
}
开发者ID:jamesturk,项目名称:zengine,代码行数:32,代码来源:ZE_ZRect.cpp


示例4: theSetupLock

ZRef<ZDCCanvas> ZDCCanvas_X::CreateOffScreen(const ZRect& inCanvasRect)
	{
	using namespace ZDCPixmapNS;

	SetupLock theSetupLock(this);
	return new ZDCCanvas_X_OffScreen(fXServer, inCanvasRect.Size(), eFormatEfficient_Color_32);
	}
开发者ID:,项目名称:,代码行数:7,代码来源:


示例5: isInFrontOf

bool ZRect::isInFrontOf(const ZRect& zrect) const {
	if(z > zrect.z || (z == zrect.z && getId() > zrect.getId())) {
		return true;
	} else {
		return false;
	}
}
开发者ID:LodePublishing,项目名称:GUI,代码行数:7,代码来源:zrect.cpp


示例6: sReadImageData

static void sReadImageData(const ZStreamR& iStream,
	bool iInterlaced, const ZRect& iBounds, ZRef<ZDCPixmapRaster> ioRaster)
	{
	uint8 initialCodeSize = iStream.ReadUInt8();

	StreamR_Chunk theSIC(iStream);
	ZStreamR_LZWDecode theSILZW(initialCodeSize, theSIC);

	ZDCPixmapNS::PixvalDesc sourcePixvalDesc(8, true);

	void* destBaseAddress = ioRaster->GetBaseAddress();

	ZDCPixmapNS::RasterDesc destRasterDesc = ioRaster->GetRasterDesc();

	vector<uint8> theRowBufferVector(iBounds.Width());
	void* theRowBuffer = &theRowBufferVector[0];

	if (iInterlaced)
		{
		for (int pass = 0; pass < 4; ++pass)
			{
			for (ZCoord currentY = iBounds.top + sInterlaceStart[pass];
				currentY < iBounds.bottom; currentY += sInterlaceIncrement[pass])
				{
				theSILZW.Read(theRowBuffer, iBounds.Width());
				void* destRowAddress = destRasterDesc.CalcRowAddress(destBaseAddress, currentY);

				ZDCPixmapNS::sBlitRowPixvals(theRowBuffer, sourcePixvalDesc, 0,
					destRowAddress, destRasterDesc.fPixvalDesc, iBounds.left,
					iBounds.Width());
				}
			}
		}
	else
		{
		for (ZCoord currentY = iBounds.top; currentY < iBounds.bottom; ++currentY)
			{
			theSILZW.Read(theRowBuffer, iBounds.Width());
			void* destRowAddress = destRasterDesc.CalcRowAddress(destBaseAddress, currentY);

			ZDCPixmapNS::sBlitRowPixvals(theRowBuffer, sourcePixvalDesc, 0,
				destRowAddress, destRasterDesc.fPixvalDesc, iBounds.left,
				iBounds.Width());
			}
		}
	}
开发者ID:,项目名称:,代码行数:46,代码来源:


示例7: InvertRoundRect

void ZDCCanvas_X::InvertRoundRect(ZDCState& ioState, const ZRect& inRect, const ZPoint& inCornerSize)
	{
	if (!fDrawable)
		return;
	if (inRect.IsEmpty())
		return;

	this->InvertRegion(ioState, ZDCRgn::sRoundRect(inRect, inCornerSize));
	}
开发者ID:,项目名称:,代码行数:9,代码来源:


示例8: FrameEllipse

void ZDCCanvas_X::FrameEllipse(ZDCState& ioState, const ZRect& inBounds)
	{
	if (!fDrawable)
		return;
	if (!ioState.fInk)
		return;
	if (ioState.fPenWidth <= 0)
		return;
	if (inBounds.IsEmpty())
		return;

	SetupLock theSetupLock(this);
	SetupClip theSetupClip(this, ioState);
	if (theSetupClip.IsEmpty())
		return;

	SetupInk theSetupInk(this, ioState);
	ZPoint ellipseSize = inBounds.Size();
	ZCoord twicePenWidth = ioState.fPenWidth * 2;
	if (twicePenWidth >= ellipseSize.h || twicePenWidth >= ellipseSize.v)
		{
		fXServer->FillArc(fDrawable, fGC,
			inBounds.left + ioState.fOrigin.h,
			inBounds.top + ioState.fOrigin.v,
			ellipseSize.h,
			ellipseSize.v,
			0, 360*64);
		}
	else
		{
		ZCoord halfPenWidth = ioState.fPenWidth / 2;
		fXServer->DrawArc(fDrawable, fGC,
			inBounds.left + ioState.fOrigin.h + halfPenWidth,
			inBounds.top + ioState.fOrigin.v + halfPenWidth,
			ellipseSize.h - 2 * halfPenWidth,
			ellipseSize.v - 2 * halfPenWidth,
			0, 360 * 64);
		}
	}
开发者ID:,项目名称:,代码行数:39,代码来源:


示例9: FrameRoundRect

void ZDCCanvas_X::FrameRoundRect(ZDCState& ioState, const ZRect& inRect, const ZPoint& inCornerSize)
	{
	if (!fDrawable)
		return;
	if (!ioState.fInk)
		return;
	if (ioState.fPenWidth <= 0)
		return;
	if (inRect.IsEmpty())
		return;

	this->FrameRegion(ioState, ZDCRgn::sRoundRect(inRect, inCornerSize));
	}
开发者ID:,项目名称:,代码行数:13,代码来源:


示例10: ZRect

ZRect ZRect::Intersection(const ZRect &rect) const
{
    float tempX=0,tempY=0,tempW=0,tempH=0;

    //can only grab the intersection if they intersect
    if(Intersects(rect))
    {
        tempX = rX > rect.X() ? rX : rect.X();
        tempY = rY > rect.Y() ? rY : rect.Y();
        tempW = rX+rWidth < rect.Right() ? rX+rWidth : rect.Right();
        tempH = rY+rHeight < rect.Bottom() ? rY+rHeight : rect.Bottom();

        tempW -= tempX;        //adjust width and height
        tempH -= tempY;
    }

    return ZRect(tempX,tempY,tempW,tempH);
}
开发者ID:jamesturk,项目名称:zengine,代码行数:18,代码来源:ZE_ZRect.cpp


示例11: InvertRect

void ZDCCanvas_X::InvertRect(ZDCState& ioState, const ZRect& inRect)
	{
	if (!fDrawable)
		return;
	if (inRect.IsEmpty())
		return;

	SetupLock theSetupLock(this);
	SetupClip theSetupClip(this, ioState);
	if (theSetupClip.IsEmpty())
		return;

	fXServer->SetFunction(fGC, GXinvert);
	++fChangeCount_Mode;

	fXServer->FillRectangle(fDrawable, fGC, inRect.left + ioState.fOrigin.h, inRect.top + ioState.fOrigin.v, inRect.Width(), inRect.Height());
	}
开发者ID:,项目名称:,代码行数:17,代码来源:


示例12: InvertEllipse

void ZDCCanvas_X::InvertEllipse(ZDCState& ioState, const ZRect& inBounds)
	{
	if (!fDrawable)
		return;
	if (inBounds.IsEmpty())
		return;

	SetupLock theSetupLock(this);
	SetupClip theSetupClip(this, ioState);
	if (theSetupClip.IsEmpty())
		return;

	fXServer->SetFunction(fGC, GXinvert);
	++fChangeCount_Mode;

	fXServer->FillArc(fDrawable, fGC, inBounds.left + ioState.fOrigin.h, inBounds.top + ioState.fOrigin.v, inBounds.Width(), inBounds.Height(), 0, 360*64);
	}
开发者ID:,项目名称:,代码行数:17,代码来源:


示例13: FillRect

void ZDCCanvas_X::FillRect(ZDCState& ioState, const ZRect& inRect)
	{
	if (!fDrawable)
		return;
	if (!ioState.fInk)
		return;
	if (inRect.IsEmpty())
		return;

	SetupLock theSetupLock(this);
	SetupClip theSetupClip(this, ioState);
	if (theSetupClip.IsEmpty())
		return;

	SetupInk theSetupInk(this, ioState);

	fXServer->FillRectangle(fDrawable, fGC, inRect.left + ioState.fOrigin.h, inRect.top + ioState.fOrigin.v, inRect.Width(), inRect.Height());
	}
开发者ID:,项目名称:,代码行数:18,代码来源:


示例14: FillEllipse

void ZDCCanvas_X::FillEllipse(ZDCState& ioState, const ZRect& inBounds)
	{
	if (!fDrawable)
		return;
	if (!ioState.fInk)
		return;
	if (inBounds.IsEmpty())
		return;

	SetupLock theSetupLock(this);
	SetupClip theSetupClip(this, ioState);
	if (theSetupClip.IsEmpty())
		return;

	SetupInk theSetupInk(this, ioState);

	fXServer->FillArc(fDrawable, fGC, inBounds.left + ioState.fOrigin.h, inBounds.top + ioState.fOrigin.v, inBounds.Width(), inBounds.Height(), 0, 360*64);
	}
开发者ID:,项目名称:,代码行数:18,代码来源:


示例15: Imp_Write

void ZDCPixmapEncoder_GIF::Imp_Write(const ZStreamW& iStream,
	const void* iBaseAddress,
	const ZDCPixmapNS::RasterDesc& iRasterDesc,
	const ZDCPixmapNS::PixelDesc& iPixelDesc,
	const ZRect& iBounds)
	{
	ZRef<ZDCPixmapNS::PixelDescRep_Indexed> thePixelDescRep_Indexed
		= ZRefDynamicCast<ZDCPixmapNS::PixelDescRep_Indexed>(iPixelDesc.GetRep());
	ZAssertStop(2, thePixelDescRep_Indexed);

	if (fTransparent)
		iStream.WriteString("GIF89a");
	else
		iStream.WriteString("GIF87a");
	iStream.WriteUInt16LE(iBounds.Width());
	iStream.WriteUInt16LE(iBounds.Height());

	uint8 globalStrmFlags = 0;
	globalStrmFlags |= 0x80; // hasGlobalColorTable
	globalStrmFlags |= 0x70; // colorResolution (8 bits per component)
	// globalStrmFlags |= 0x08; // set this if the color table is sorted in priority order

	ZAssertStop(2, iRasterDesc.fPixvalDesc.fDepth > 0 && iRasterDesc.fPixvalDesc.fDepth <= 8);
	
	globalStrmFlags |= iRasterDesc.fPixvalDesc.fDepth - 1; // globalColorTableSize & depth
	iStream.WriteUInt8(globalStrmFlags);

	iStream.WriteUInt8(0); // backgroundColorIndex
	iStream.WriteUInt8(0); // Pixel aspect ratio -- 0 == none specified.

	const ZRGBColorPOD* theColors;
	size_t theColorsCount;
	thePixelDescRep_Indexed->GetColors(theColors, theColorsCount);
	sWriteColorTable(iStream, theColors, theColorsCount, 1 << iRasterDesc.fPixvalDesc.fDepth);

	if (fTransparent)
		{
		iStream.WriteUInt8('!'); // Extension block
		iStream.WriteUInt8(0xF9); // Graphic Control Extension
		iStream.WriteUInt8(4); // Block size
		// The next byte encodes four fields:
		// 3 bits, Reserved == 0
		// 3 bits, Disposal Method == none (0),
		// 1 bit, User Input Flag == none (0)
		// 1 bit, Transparent Color Flag = yes (1)
		iStream.WriteUInt8(1);
		iStream.WriteUInt16LE(0); // Delay time
		iStream.WriteUInt8(fTransparentPixval);
		iStream.WriteUInt8(0); // Block terminator
		}

	iStream.WriteUInt8(','); // Start of image
	iStream.WriteUInt16LE(0); // Origin h
	iStream.WriteUInt16LE(0); // Origin v
	iStream.WriteUInt16LE(iBounds.Width());
	iStream.WriteUInt16LE(iBounds.Height());

	uint8 localStrmFlags = 0;
//	localStrmFlags |= 0x80; // hasLocalColorTable
	if (fInterlace)
		localStrmFlags |= 0x40; // interlaced
//	localStrmFlags |= 0x20; // sorted
//	localStrmFlags |= 0x70; // localColorTableSize
	iStream.WriteUInt8(localStrmFlags);

	iStream.WriteUInt8(iRasterDesc.fPixvalDesc.fDepth); // Initial code size.

	{ // Scope theSC.
	StreamW_Chunk theSC(iStream);

	ZStreamW_LZWEncode* theSLZW = nil;
	ZStreamW_LZWEncodeNoPatent* theSLZWNP = nil;

	ZStreamW* theStream;
	if (fNoPatent)
		{
		theSLZWNP = new ZStreamW_LZWEncodeNoPatent(iRasterDesc.fPixvalDesc.fDepth, theSC);
		theStream = theSLZWNP;
		}
	else
		{
		theSLZW = new ZStreamW_LZWEncode(iRasterDesc.fPixvalDesc.fDepth, theSC);
		theStream = theSLZW;
		}

	ZDCPixmapNS::PixvalDesc destPixvalDesc(8, true);

	vector<uint8> theRowBufferVector(iBounds.Width());
	void* theRowBuffer = &theRowBufferVector[0];

	try
		{
		if (fInterlace)
			{
			for (int pass = 0; pass < 4; ++pass)
				{
				for (ZCoord currentY = iBounds.top + sInterlaceStart[pass];
					currentY < iBounds.bottom; currentY += sInterlaceIncrement[pass])
					{
					const void* sourceRowAddress
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


示例16: sReadPixmap

static void sReadPixmap(const ZStreamR& inStream, ZDCPixmap& outPixmap)
	{
	uint16 rowBytes = inStream.ReadUInt16();
	if (!(rowBytes & 0x8000))
		::sThrowBadFormat();
	rowBytes &= 0x7FFF;

	ZRect bounds;
	bounds.top = inStream.ReadInt16();
	bounds.left = inStream.ReadInt16();
	bounds.bottom = inStream.ReadInt16();
	bounds.right = inStream.ReadInt16();
	inStream.ReadInt16(); // version
	inStream.ReadInt16(); // packType
	inStream.ReadInt32(); // packSize
	inStream.ReadInt32(); // hRes
	inStream.ReadInt32(); //vRes
	short pixelType = inStream.ReadInt16(); // pixelType
	short pixelSize = inStream.ReadInt16(); // pixelSize
	short cmpCount = inStream.ReadInt16(); // cmpCount
	short cmpSize = inStream.ReadInt16(); // cmpSize
	inStream.ReadInt32(); // planeBytes
	inStream.ReadInt32(); // pmTable
	inStream.ReadInt32(); // pmReserved

	// We only deal with pixel type of 0 (indexed pixels)
	if (pixelType != 0)
		::sThrowUnsupportedFormat();

	// indexed pixels have a cmpCount of 1
	if (cmpCount != 1)
		::sThrowBadFormat();

	// pixelSize and cmpSize should be equal for indexed pixels
	if (pixelSize != cmpSize)
		::sThrowBadFormat();

	// Next on the stream is the color table
	vector<ZRGBColor> theColorTable;
	inStream.ReadInt32(); // ctSeed
	inStream.ReadInt16(); // ctFlags
	short ctSize = inStream.ReadInt16();
	for (int i = 0; i <= ctSize; ++i)
		{
		inStream.ReadInt16(); // colorSpecIndex
		ZRGBColor theColor;
		theColor.red = inStream.ReadUInt16();
		theColor.green = inStream.ReadUInt16();
		theColor.blue = inStream.ReadUInt16();
		theColorTable.push_back(theColor);
		}

	// Now we have the source rect
	inStream.Skip(8);

	// and the destination rect
	inStream.Skip(8);

	// Penultimately we have the mode
	inStream.ReadUInt16();

	// The remaining data is the packed pixels. Allocate our ZDCPixmap
	// using the size we read in, but with no initialized data.
	ZDCPixmap thePixmap(bounds.Size(), ZDCPixmapNS::eFormatEfficient_Color_32);
	void* baseAddress = thePixmap.GetBaseAddress();
	ZDCPixmapNS::RasterDesc theRasterDesc = thePixmap.GetRasterDesc();
	ZDCPixmapNS::PixelDesc thePixelDesc = thePixmap.GetPixelDesc();
	::sUnpackFromStream(inStream,
		bounds.Width(), bounds.Height(),
		rowBytes, pixelSize,
		&theColorTable[0], theColorTable.size(),
		baseAddress, theRasterDesc, thePixelDesc);

	outPixmap = thePixmap;
	}
开发者ID:,项目名称:,代码行数:75,代码来源:


示例17: rEngine

ZRect::ZRect(const ZRect &rhs) :
    rEngine(ZEngine::GetInstance()),
    rX(rhs.X()),rY(rhs.Y()),rWidth(rhs.Width()),rHeight(rhs.Height())
{
}
开发者ID:jamesturk,项目名称:zengine,代码行数:5,代码来源:ZE_ZRect.cpp


示例18: Contains

bool ZRect::Contains(const ZRect &rect) const
{
    //contains all 4 points
    return Contains(rect.Left(),rect.Top()) && Contains(rect.Right(),rect.Top()) &&
        Contains(rect.Left(),rect.Bottom()) && Contains(rect.Right(),rect.Bottom());
}
开发者ID:jamesturk,项目名称:zengine,代码行数:6,代码来源:ZE_ZRect.cpp


示例19: Intersects

bool ZRect::Intersects(const ZRect &rect) const
{
    return !(rX > rect.Right() || rect.Left() > rX+rWidth ||
        rY > rect.Bottom() || rect.Top() > rY+rHeight);
}
开发者ID:jamesturk,项目名称:zengine,代码行数:5,代码来源:ZE_ZRect.cpp



注:本文中的ZRect类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ZSList类代码示例发布时间:2022-05-31
下一篇:
C++ ZPack类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap