当前位置: 首页>>代码示例>>C++>>正文


C++ DocRect::Inflate方法代码示例

本文整理汇总了C++中DocRect::Inflate方法的典型用法代码示例。如果您正苦于以下问题:C++ DocRect::Inflate方法的具体用法?C++ DocRect::Inflate怎么用?C++ DocRect::Inflate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DocRect的用法示例。


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

示例1: RenderObjectBlobs

void NodeBrush::RenderObjectBlobs(RenderRegion* pRegion)
{
#if !defined(EXCLUDE_FROM_RALPH)
    // Find out about the groups bounding rect
    DocRect BoundingRect = GetBoundingRect();

    // Inflate the bounds by the width of a blob
    DocRect TempRect;
    GetApplication()->GetBlobManager()->GetBlobRect(BoundingRect.lo,&TempRect);
    INT32 Delta = ((TempRect.hi.x - TempRect.lo.x)*3)/4;
    BoundingRect.Inflate(Delta);

    // Find out where to draw the blobs
    DocCoord Low  = BoundingRect.LowCorner();
    DocCoord High = BoundingRect.HighCorner();

    // Set the colours of the blobs
    pRegion->SetFillColour(COLOUR_UNSELECTEDBLOB);
    pRegion->SetLineColour(COLOUR_NONE);

    // Draw all the blobs
    pRegion->DrawBlob(Low, BT_UNSELECTED);
    pRegion->DrawBlob(High, BT_UNSELECTED);
    pRegion->DrawBlob(DocCoord(Low.x, High.y), BT_UNSELECTED);
    pRegion->DrawBlob(DocCoord(High.x, Low.y), BT_UNSELECTED);

    // for some reason the NBP is never called, there is probably a
    // proper fix for this but I don't have time right now, so render
    // the nodeblend path here
    m_pNodeBrushPath->RenderObjectBlobs(pRegion);


#endif
}
开发者ID:eradman,项目名称:xara-cairo,代码行数:34,代码来源:nodebrsh.cpp

示例2: GetBlobBoundingRect

DocRect NodeBrush::GetBlobBoundingRect()
{

#if !defined(EXCLUDE_FROM_RALPH)
    // Find the base class blob bounding rectangle
    DocRect Rect = NodeGroup::GetBlobBoundingRect();

    // inflate it by the width of a blob (plus a bit)
    DocRect TempRect;
    GetApplication()->GetBlobManager()->GetBlobRect(Rect.lo,&TempRect);
    INT32 Delta = ((TempRect.hi.x - TempRect.lo.x)*1)/1;
    Rect.Inflate(Delta);

    return Rect;
#else
    return DocRect(0,0,0,0);
#endif

}
开发者ID:eradman,项目名称:xara-cairo,代码行数:19,代码来源:nodebrsh.cpp

示例3: DrawCell

/********************************************************************************************
>	void BitmapExportPaletteControl::DrawCell(DocRect *pCellRect, DocColour colour, INT32 flags,
					RenderRegion *pRender, bool webSafe, bool selected, bool highlight)
	Author:		Jonathan_Payne (Xara Group Ltd) <[email protected]>
	Created:	12/12/2000
	Purpose:	Draw a palette cell with the given options
	Inputs:		pCellRect	- The rect to draw the palette cell in
				colour		- The colour of the palette entry to draw
				flags		- The flags of that palette entry (locked, transparency, etc)
				pRender		- The render region to render with (tested with an OS rr)
				webSafe		- Is the colour web safe (ie do we draw the web safe mark)
				selected	- Do we draw the cell as the selected cell?
********************************************************************************************/
void BitmapExportPaletteControl::DrawCell(DocRect *pCellRect, DocColour colour, INT32 flags, RenderRegion *pRender,
												bool webSafe, bool selected)
{
	pRender->SetLineColour(COLOUR_BLACK);
	pRender->SetFillColour(colour);
	pRender->DrawRect(pCellRect);

	if (selected)
	{
		pRender->SetFillColour(COLOUR_TRANS);

		DocRect cell = *pCellRect; // make temp copy

		// Draw the outer line in white
		pRender->SetLineColour(COLOUR_WHITE);
		cell.Inflate(-1 * m_nPixelSize);
		pRender->DrawRect(&cell);

		// Draw the inner line in black
		pRender->SetLineColour(COLOUR_BLACK);
		cell.Inflate(-1 * m_nPixelSize);
		pRender->DrawRect(&cell);
	}

	if (flags & DELETED_COLOUR)
	{
		//  Draw a mark to show that this palette entry has been deleted

		// Draw a black line from top left to bottom right
		pRender->SetLineColour(COLOUR_BLACK);
		pRender->DrawLine(	DocCoord(pCellRect->lo.x, pCellRect->hi.y + m_nPixelSize),
							DocCoord(pCellRect->hi.x + m_nPixelSize, pCellRect->lo.y));

		// Draw a white line from top right to bottom left
		pRender->SetLineColour(COLOUR_WHITE);
		pRender->DrawLine(	DocCoord(pCellRect->hi.x + m_nPixelSize, pCellRect->hi.y + m_nPixelSize),
							DocCoord(pCellRect->lo.x + m_nPixelSize, pCellRect->lo.y + m_nPixelSize));

		return; // Stop before rending any other marks
	}

	if (flags & LOCKED_COLOUR)
	{
		//  Draw a mark to show that this palette entry has been
		//  edited by the user.

		pRender->SetLineColour(COLOUR_BLACK);
		pRender->SetFillColour(COLOUR_WHITE);
		
		// Draw a rectangle in the bottom left corner of the cell
		DocRect markRect;
		markRect.hi.x	= pCellRect->lo.x + m_nPixelSize * 2;
		markRect.lo.x	= pCellRect->lo.x;
		markRect.hi.y	= pCellRect->lo.y + m_nPixelSize * 2;
		markRect.lo.y	= pCellRect->lo.y;
		pRender->DrawRect(&markRect);
	}

	if (flags & TRANSPARENT_COLOUR)
	{
		//  Draw a mark to show that this palette entry is transparent

		pRender->SetLineColour(COLOUR_BLACK);
		pRender->SetFillColour(COLOUR_WHITE);
		
		// Draw a rectangle in the top left corner of the cell
		DocRect markRect;
		markRect.hi.x	= pCellRect->lo.x + m_nPixelSize * 2;
		markRect.lo.x	= pCellRect->lo.x;
		markRect.hi.y	= pCellRect->hi.y;
		markRect.lo.y	= pCellRect->hi.y - m_nPixelSize * 2;
		pRender->DrawRect(&markRect);
	}
	
	if (webSafe)
	{
		//  Draw a mark to show that this palette entry is web-safe

		pRender->SetLineColour(COLOUR_BLACK);
		pRender->SetFillColour(COLOUR_WHITE);

		DocRect markRect = *pCellRect;
		markRect.Inflate(-4 * m_nPixelSize);
		pRender->DrawRect(&markRect);
	}
}
开发者ID:vata,项目名称:xarino,代码行数:99,代码来源:bmpalctrl.cpp

示例4: ProcessPath

void PathProcessorStrokeAirbrush::ProcessPath(Path *pPath,
											  RenderRegion *pRender,
											  PathShape ShapePath)
{
	PORTNOTETRACE("other","PathProcessorStrokeAirbrush::ProcessPath - do nothing");
#ifndef EXCLUDE_FROM_XARALX
	ERROR3IF(pPath == NULL || pRender == NULL, "Illegal NULL Params");

	// --- If the provided path is not stroked, then we'll just pass it straight through
	// We also don't touch it if we're doing EOR rendering, or click regions
	// BLOCK
	{
		StrokeColourAttribute *pStrokeColour = (StrokeColourAttribute *) pRender->GetCurrentAttribute(ATTR_STROKECOLOUR);
		if (pRender->DrawingMode != DM_COPYPEN || pRender->IsHitDetect()
			|| !pPath->IsStroked || pStrokeColour == NULL || pStrokeColour->Colour.IsTransparent())
		{
			pRender->DrawPath(pPath, this, ShapePath);
			return;
		}
	}

	// --- If the quality is set low, strokes are just rendered as centrelines
	// BLOCK
	{
		QualityAttribute *pQuality = (QualityAttribute *) pRender->GetCurrentAttribute(ATTR_QUALITY);
		if (pQuality != NULL && pQuality->QualityValue.GetLineQuality() != Quality::FullLine)
		{
			pRender->DrawPath(pPath, this, ShapePath);
			return;
		}
	}

	// --- If the attribute which created us is not the current StrokeType attribute, then
	// we have been overridden by a different stroke type, so we do nothing.
	// BLOCK
	{
		StrokeTypeAttrValue *pTypeAttr = (StrokeTypeAttrValue *) pRender->GetCurrentAttribute(ATTR_STROKETYPE);
		if (pTypeAttr != NULL && pTypeAttr != GetParentAttr())
		{
			pRender->DrawPath(pPath, this, ShapePath);
			return;
		}
	}

	// --- Get the current line width from the render region
	// In case of failure, we initialise with suitable defaults
	INT32 LineWidth = 5000;
	// BLOCK
	{
		LineWidthAttribute *pWidthAttr = (LineWidthAttribute *) pRender->GetCurrentAttribute(ATTR_LINEWIDTH);
		if (pWidthAttr != NULL)
			LineWidth = pWidthAttr->LineWidth;
	}

	// Obtain an optimal number of steps for the line
	// When printing, we do heaps of steps to get top quality out the other end
	View *pView	= pRender->GetRenderView();
	ERROR3IF(pView == NULL, "No render view?!");

	INT32 NumSteps = MaxAirbrushSteps;
	if (!pRender->IsPrinting())
		GetNumSteps(pView, LineWidth);

	// --- Now, create a transparency mask bitmap for the airbrush
	Spread *pSpread	= pRender->GetRenderSpread();
//	ERROR3IF(pSpread == NULL, "No render spread!?");	// This can happen, rendering into a gallery

	// Get the render region's clip rectangle in Spread Coords. We don't need to
	// render anything bigger than this size, so it is the upper limit on our bitmap area.
	DocRect ClipRegion = pRender->GetClipRect();

	// Intersect this with the path bounding rectangle to get the actual region we need to redraw
	// The smaller this is, the faster we go and the less memory we use.
	//DocRect PathRect = pPath->GetBoundingRect();
	DocRect PathRect = pPath->GetBlobRect();
	PathRect.Inflate(LineWidth);

	BOOL Intersects = ClipRegion.IsIntersectedWith(PathRect);
	if(!Intersects)
	{
		// Don't bother drawing anything - it's clipped out
		return;
	}

	ClipRegion = ClipRegion.Intersection(PathRect);

	// Round the ClipRegion edges up so they all lie exactly on screen pixel boundaries.
	// If we don't do this, then there can be a sub-pixel rounding error between the ClipRegion
	// and the actual bitmap size, so that the bitmap is scaled slightly when we plot it.
	// By making sure it's pixelised, we guarantee that the bitmap & clipregion are exactly equal sizes.
	// (It doesn't matter if the bitmap is a bit bigger than necessary)
	ClipRegion.Inflate(pRender->GetScaledPixelWidth());
	ClipRegion.lo.Pixelise(pView);
	ClipRegion.hi.Pixelise(pView);

	// Get the current view's rendering matrix and view scale
	Matrix ConvMatrix = pRender->GetMatrix();//pView->ConstructRenderingMatrix(pSpread);
	FIXED16 ViewScale = pView->GetViewScale();

	// Generate a 256-colour greyscale palette
//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:xara-xtreme,代码行数:101,代码来源:ppairbsh.cpp


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