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


C++ Rect::Contains方法代码示例

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


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

示例1: OnMouseMove

/*----------------------------------------------------------------------------------------------
	Change selection as the mouse moves to a new color cell (button)
----------------------------------------------------------------------------------------------*/
void IconComboPopup::OnMouseMove(UINT nFlags, int xp, int yp)
{
    Point pt(xp, yp);

    if (m_fIgnoreButtonUp)
    {
        Point ptT(pt);
        Rect rc;
        ::ClientToScreen(m_hwnd, &ptT);
        ::GetWindowRect(m_hwnd, &rc);
        if (rc.Contains(ptT))
            m_fIgnoreButtonUp = false;
    }

    // Get the row and column from the point (GetTableIndexFromRowCol returns -1 if the mouse
    // if not over a button.
    int ivalNew = GetTableIndexFromRowCol(GetRowFromPt(pt), GetColFromPt(pt));

    // In range? If not, default and exit
    if (ivalNew < 0)
        return;

    // OK - we have the row and column of the current selection
    // Has the row/col selection changed? If yes, then redraw old and new cells.
    if (ivalNew != m_ivalHot)
        ChangeSelection(ivalNew);
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: pattern

static void
RepeatOrStretchSurface(DrawTarget& aDT, SourceSurface* aSurface,
                       const Rect& aDest, const Rect& aSrc, Rect& aSkipRect)
{
  if (aSkipRect.Contains(aDest)) {
    return;
  }

  if ((!aDT.GetTransform().IsRectilinear() &&
       aDT.GetBackendType() != BackendType::CAIRO) ||
      (aDT.GetBackendType() == BackendType::DIRECT2D)) {
    // Use stretching if possible, since it leads to less seams when the
    // destination is transformed. However, don't do this if we're using cairo,
    // because if cairo is using pixman it won't render anything for large
    // stretch factors because pixman's internal fixed point precision is not
    // high enough to handle those scale factors.
    // Calling FillRect on a D2D backend with a repeating pattern is much slower
    // than DrawSurface, so special case the D2D backend here.
    aDT.DrawSurface(aSurface, aDest, aSrc);
    return;
  }

  SurfacePattern pattern(aSurface, ExtendMode::REPEAT,
                         Matrix::Translation(aDest.TopLeft() - aSrc.TopLeft()),
                         Filter::GOOD, RoundedToInt(aSrc));
  aDT.FillRect(aDest, pattern);
}
开发者ID:TheTypoMaster,项目名称:system-addons,代码行数:27,代码来源:gfxBlur.cpp

示例3: rec

int		LinkTimeControl::HitTestFCurves( ParamDimensionBase *dim, TrackHitTab& hits, Rect& rcHit, Rect& rcGraph,			
			float tzoom, int tscroll, float vzoom, int vscroll, DWORD flags )
{
	int h = rcGraph.h()-1;

	bool hit = false;

	const int n = NumKeys();
	for ( int i=0; i<n; ++i )
	{
		BOOL sel = IsKeySelected( i );
		if ( ( flags & HITTRACK_SELONLY ) && !sel )
			continue;
		if ( ( flags & HITTRACK_UNSELONLY ) && sel )
			continue;
		TimeValue t = GetKeyTime( i );
		int x = TimeToScreen( t, tzoom, tscroll );
		float val;
		Interval valid;
		GetValue( t, &val, valid );
		int y = ValueToScreen( dim->Convert(val), h, vzoom, vscroll );
		if ( rcHit.Contains( IPoint2( x, y ) ) )
		{
			hit = true;
			TrackHitRecord rec( i, 0 );
			hits.Append( 1, &rec );
			if ( flags & HITTRACK_ABORTONHIT )
				break;
		}
	}

	return hit ?  HITCURVE_KEY : HITCURVE_NONE;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:33,代码来源:link_timectrl.cpp

示例4: pattern

static void
RepeatOrStretchMirroredSurface(DrawTarget* aDT, SourceSurface* aSurface,
                               const Rect& aDest, const Rect& aSrc,
                               const Rect& aSkipRect, Float aScaleX, Float aScaleY)
{
  if (aSkipRect.Contains(aDest)) {
    return;
  }

  if (ShouldStretchSurface(aDT, aSurface)) {
    aScaleX *= aDest.width / aSrc.width;
    aScaleY *= aDest.height / aSrc.height;
    DrawMirroredRect(aDT, aSurface, aDest, aSrc.TopLeft(), aScaleX, aScaleY);
    return;
  }

  SurfacePattern pattern(aSurface, ExtendMode::REPEAT,
                         Matrix::Scaling(aScaleX, aScaleY)
                           .PreTranslate(-aSrc.TopLeft())
                           .PostTranslate(
                             aScaleX < 0 ? aDest.XMost() : aDest.x,
                             aScaleY < 0 ? aDest.YMost() : aDest.y),
                         SamplingFilter::GOOD, RoundedToInt(aSrc));
  aDT->FillRect(aDest, pattern);
}
开发者ID:yrliou,项目名称:gecko-dev,代码行数:25,代码来源:gfxBlur.cpp

示例5: tileRect

void
DrawTargetTiled::StrokeRect(const Rect& aRect, const Pattern& aPattern, const StrokeOptions &aStrokeOptions, const DrawOptions& aDrawOptions)
{
  Rect deviceRect = mTransform.TransformBounds(aRect);
  Margin strokeMargin = MaxStrokeExtents(aStrokeOptions, mTransform);
  Rect outerRect = deviceRect;
  outerRect.Inflate(strokeMargin);
  Rect innerRect;
  if (mTransform.IsRectilinear()) {
    // If rects are mapped to rects, we can compute the inner rect
    // of the stroked rect.
    innerRect = deviceRect;
    innerRect.Deflate(strokeMargin);
  }
  for (size_t i = 0; i < mTiles.size(); i++) {
    if (mTiles[i].mClippedOut) {
      continue;
    }
    Rect tileRect(mTiles[i].mTileOrigin.x,
                  mTiles[i].mTileOrigin.y,
                  mTiles[i].mDrawTarget->GetSize().width,
                  mTiles[i].mDrawTarget->GetSize().height);
    if (outerRect.Intersects(tileRect) && !innerRect.Contains(tileRect)) {
      mTiles[i].mDrawTarget->StrokeRect(aRect, aPattern, aStrokeOptions, aDrawOptions);
    }
  }
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:27,代码来源:DrawTargetTiled.cpp

示例6: IntersectsWithRect

BOOL CArcView::IntersectsWithRect(const Rect& rectangle)
{
	Point topLeft(rectangle.GetLeft(), rectangle.GetTop());
	Point topRight(rectangle.GetRight(), rectangle.GetTop());
	Point bottomLeft(rectangle.GetLeft(), rectangle.GetBottom());
	Point bottomRight(rectangle.GetRight(), rectangle.GetBottom());

	Point currentPoint(*pathPoints.begin());
	for(auto it=pathPoints.begin() + 1; it != pathPoints.end(); ++it)
	{
		if(rectangle.Contains(currentPoint))
			return TRUE;
		if(Geometry::LinesIntersect(topLeft, topRight, currentPoint, *it))
			return TRUE;
		if(Geometry::LinesIntersect(topLeft, bottomLeft, currentPoint, *it))
			return TRUE;
		if(Geometry::LinesIntersect(bottomLeft, bottomRight, currentPoint, *it))
			return TRUE;
		if(Geometry::LinesIntersect(topRight, bottomRight, currentPoint, *it))
			return TRUE;

		currentPoint = *it;
	}

	return FALSE;
}
开发者ID:hlobit,项目名称:SimPetri,代码行数:26,代码来源:ArcView.cpp

示例7: DoMouseFB

void Ctrl::DoMouseFB(int event, Point p, int zdelta, CParser& cp)
{
	ReadKeyMods(cp);
	MousePos = p;
	int a = event & ACTION;
	if(a == UP && Ctrl::ignoreclick) {
		EndIgnore();
		return;
	}
	else
	if(a == DOWN && ignoreclick)
		return;
	LLOG("### Mouse event: " << event << " position " << p << " zdelta " << zdelta << ", capture " << Upp::Name(captureCtrl));
	if(captureCtrl)
		MouseEventFB(captureCtrl->GetTopCtrl(), event, p, zdelta);
	else
		for(int i = topctrl.GetCount() - 1; i >= 0; i--) {
			Ptr<Ctrl> t = topctrl[i];
			Rect rr = t->GetRect();
			if(rr.Contains(p)) {
				MouseEventFB(t, event, p, zdelta);
				return;
			}
		}
	Ctrl *desktop = GetDesktop();
	if(desktop) {
		desktop->DispatchMouse(event, p, zdelta);
		desktop->PostInput();
	}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:30,代码来源:Event.cpp

示例8: Subtract

Rect Rect::Subtract(const Rect& rect) const {
  // boundary cases:
  if (!Intersects(rect))
    return *this;
  if (rect.Contains(*this))
    return Rect();

  int32_t rx = x();
  int32_t ry = y();
  int32_t rr = right();
  int32_t rb = bottom();

  if (rect.y() <= y() && rect.bottom() >= bottom()) {
    // complete intersection in the y-direction
    if (rect.x() <= x()) {
      rx = rect.right();
    } else {
      rr = rect.x();
    }
  } else if (rect.x() <= x() && rect.right() >= right()) {
    // complete intersection in the x-direction
    if (rect.y() <= y()) {
      ry = rect.bottom();
    } else {
      rb = rect.y();
    }
  }
  return Rect(rx, ry, rr - rx, rb - ry);
}
开发者ID:BenitoJedai,项目名称:mutantspider,代码行数:29,代码来源:mutantspider.cpp

示例9:

Point
DSWindow::MapPoint(const Point& pt) const
{
	const Rect
		bounds(0, MainScreenHeight, MainScreenWidth, MainScreenHeight << 1);

	return bounds.Contains(pt) ? pt - bounds.GetPoint() : Point::Invalid;
}
开发者ID:xuxiaowei007,项目名称:YSLib,代码行数:8,代码来源:DSWindow.cpp

示例10:

CVariable *CBlockUnit::GetIOPort(UINT x, UINT y)
{
  Rect rect;

  if (x == 0 && y == 0)
  {
    return NULL;
  }

  // Check for input ports
  for (int i = 0; i < m_vInput.size(); i++)
  {
    // Assign selection box rect
    rect.X = m_vInput[i]->m_ptPort.X - 5;
    rect.Y = m_vInput[i]->m_ptPort.Y - 5;
    rect.Width  = 10;
    rect.Height = 10;

    // Check if pos in box
    if (rect.Contains(x, y))
    {
      return m_vInput[i];
    }
  }

  // Check for output ports
  for (int i = 0; i < m_vOutput.size(); i++)
  {
    // Assign selection box rect
    rect.X = m_vOutput[i]->m_ptPort.X - 5;
    rect.Y = m_vOutput[i]->m_ptPort.Y - 5;
    rect.Width  = 10;
    rect.Height = 10;

    // Check if pos in box
    if (rect.Contains(x, y))
    {
      return m_vOutput[i];
    }
  }

  return NULL;
}
开发者ID:neuks,项目名称:Synaptics,代码行数:43,代码来源:CBlockUnit.cpp

示例11:

static void
DrawCorner(DrawTarget* aDT, SourceSurface* aSurface,
           const Rect& aDest, const Rect& aSrc, const Rect& aSkipRect)
{
  if (aSkipRect.Contains(aDest)) {
    return;
  }

  aDT->DrawSurface(aSurface, aDest, aSrc);
}
开发者ID:yrliou,项目名称:gecko-dev,代码行数:10,代码来源:gfxBlur.cpp

示例12: if

DockCont *DockWindow::FindDockTarget(DockCont &dc, int &dock)
{
	Point p = GetMousePos();
	Rect r = GetScreenView();
	DockCont *target = NULL;
	int align = DOCK_NONE;

	dock = DOCK_NONE;

	if (r.Contains(p)) {
		dock = GetPointAlign(p, r, true, true, true);
		if (dock != DOCK_NONE && dockpane[dock].IsVisible())
			dock = DOCK_NONE;
	}
	else {
		target = GetMouseDockTarget();
		if (target) {
			r = target->GetScreenRect();
			dock = GetDockAlign(*target);
			align = GetPointAlign(p, r, IsTabbing(), IsTB(dock), !IsTB(dock));
		}
		else
			return NULL;
	}

	if (dock != DOCK_NONE && (!dc.IsDockAllowed(dock)
		 || IsPaneAnimating(dock) || IsFrameAnimating(dock))
		 || (dock == DOCK_NONE && !target)) {
		dock = DOCK_NONE;
		return NULL;
	}

	// Prepare for highlight
	if (target) {
		GetHighlightCtrl().bounds = GetAlignBounds(align, r, IsTabbing(), IsTB(dock), !IsTB(dock));
		if (align == DOCK_NONE)
			dock = DOCK_NONE; // Tabbing
		// The following code handles the case of an insertion between two docked controls. In this case we must set
		//  the highlight bounds to be a union of the bounds from each control. Very ugly.
		if (dock != DOCK_NONE) {
			Ctrl *c = IsTL(align) ? target->GetPrev() : target->GetNext();
			if (c) {
				int opal = align > 1 ? align-2 : align+2;
				GetHighlightCtrl().bounds.Union(GetAlignBounds(opal, c->GetScreenRect(), IsTabbing()));
			}
			target = IsTL(align) ? target : dynamic_cast<DockCont*>(target->GetNext());
		}

	}
	else if (dock != DOCK_NONE)
		GetHighlightCtrl().bounds = GetAlignBounds(dock, r, true);

	return target;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:54,代码来源:DockWindow.cpp

示例13: DrawMirroredRect

static void
DrawMirroredCorner(DrawTarget* aDT, SourceSurface* aSurface,
                   const Rect& aDest, const Point& aSrc,
                   const Rect& aSkipRect, Float aScaleX, Float aScaleY)
{
  if (aSkipRect.Contains(aDest)) {
    return;
  }

  DrawMirroredRect(aDT, aSurface, aDest, aSrc, aScaleX, aScaleY);
}
开发者ID:yrliou,项目名称:gecko-dev,代码行数:11,代码来源:gfxBlur.cpp

示例14: DispatchMouseIn

bool Ctrl::DispatchMouseIn(int act, int zd)
{
	Point p = GetMousePos();
	Rect r = GetScreenRect();
	if(r.Contains(p)) {
		p -= r.TopLeft();
		DispatchMouse(act, p, zd);
		return true;
	}
	return false;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:11,代码来源:GtkEvent.cpp

示例15: GetMousePos

/*
 * Docking Interface helpers
*/
DockCont *DockWindow::GetMouseDockTarget()
{
	Point mp = GetMousePos();
	for (int i = 0; i < 4; i++) {
		if (dockpane[i].IsShown()) {
			Rect r = dockpane[i].GetScreenRect();
			if (r.Contains(mp))
				return dynamic_cast<DockCont *>(dockpane[i].ChildFromPoint(mp -= r.TopLeft()));
		}
	}
	return NULL;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:15,代码来源:DockWindow.cpp


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