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


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

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


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

示例1: 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

示例2: Intersects

bool Rect::Intersects(Rect box)
{
	if(right < box.GetLeft() || left > box.GetRight() || 
		top > box.GetBottom() || bottom < box.GetTop())
		return false;
	else
		return true;
}
开发者ID:cdatkins,项目名称:Color-Kingdom,代码行数:8,代码来源:rect.cpp

示例3: DrawRectangle

void Graphics::DrawRectangle(Pen* pen, const Rect& rc) {
	cairo_t* cg = reinterpret_cast<cairo_t*>(_private);
	cairo_save(cg);
	PenPrivate* pp = reinterpret_cast<PenPrivate*>(pen->_private);
	cairo_pattern_t* cp = pp->pattern;
	cairo_set_source(cg, cp);
	cairo_set_line_width(cg, pp->width);
	cairo_translate(cg, rc.GetLeft(), rc.GetTop());
	cairo_rectangle(cg, 0, 0, rc.GetWidth(), rc.GetHeight());
	cairo_stroke(cg);
	cairo_restore(cg);
}
开发者ID:pixelspark,项目名称:corespark,代码行数:12,代码来源:tjgraphics-cairo.cpp

示例4: DrawImage

void Graphics::DrawImage(Image* image, const Rect& rc, const ImageAttributes* attr) {
    Gdiplus::Graphics* g = reinterpret_cast<Gdiplus::Graphics*>(_private);
    Gdiplus::Image* gdiImage = reinterpret_cast<Gdiplus::Image*>(image->_private);

    if(attr!=0) {
        Gdiplus::ImageAttributes* ia = reinterpret_cast<Gdiplus::ImageAttributes*>(attr->_private);
        g->DrawImage(gdiImage, Gdiplus::Rect(rc.GetLeft(), rc.GetTop(), rc.GetWidth(), rc.GetHeight()), 0, 0, gdiImage->GetWidth(), gdiImage->GetHeight(), Gdiplus::UnitPixel, ia);
    }
    else {
        g->DrawImage(gdiImage, ToGDIRect<Rect, Gdiplus::Rect>(rc));
    }
}
开发者ID:pixelspark,项目名称:corespark,代码行数:12,代码来源:tjgraphics-gdiplus.cpp

示例5: IntersectsWithRect

BOOL CCircleView::IntersectsWithRect(const Rect& rectangle)
{
	Point center(position);

	double edgeCenterDistance = INT_MAX;
	std::vector<Point> rectCorners;
	Point topLeft(rectangle.GetLeft(), rectangle.GetTop());
	Point topRight(rectangle.GetRight(), rectangle.GetTop());
	Point bottomLeft(rectangle.GetLeft(), rectangle.GetBottom());
	Point bottomRight(rectangle.GetRight(), rectangle.GetBottom());

	rectCorners.push_back(topLeft);
	rectCorners.push_back(topRight);
	rectCorners.push_back(bottomLeft);
	rectCorners.push_back(bottomRight);

	//Le centre du cercle est-il dans le rectangle ?
	if(rectangle.Contains(center)) return TRUE;

	//Un coin du rectangle est-il dans le cercle ?
	for(auto it=rectCorners.begin(); it!=rectCorners.end(); ++it)
		if(Geometry::Distance(*it, center) < radius) return TRUE;

	//Un côté du rectangle coupe-t-il dans le cercle ?
	if(topLeft.X < center.X && center.X < topRight.X
		&& Geometry::LinePointDistance(topLeft, topRight, center) < radius)
		return TRUE;
	if(topLeft.Y < center.Y && center.Y < bottomLeft.Y
		&& Geometry::LinePointDistance(topLeft, bottomLeft, center) < radius)
		return TRUE;
	if(bottomLeft.X < center.X && center.X < bottomRight.X
		&& Geometry::LinePointDistance(bottomLeft, bottomRight, center) < radius)
		return TRUE;
	if(topRight.Y < center.Y && center.Y < bottomRight.Y
		&& Geometry::LinePointDistance(topRight, bottomRight, center) < radius)
		return TRUE;

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

示例6: FillRectangle

void Graphics::FillRectangle(Brush* brush, const Rect& rc) {
	cairo_t* cg = reinterpret_cast<cairo_t*>(_private);
	cairo_save(cg);
	if(cg!=0) {
		cairo_pattern_t* cp = reinterpret_cast<cairo_pattern_t*>(brush->_private);
		if(cp!=0) {
			cairo_set_source(cg, cp);
			cairo_translate(cg, rc.GetLeft(), rc.GetTop());
			cairo_rectangle(cg, 0, 0, rc.GetWidth(), rc.GetHeight());
			cairo_fill(cg);
		}
	}
	cairo_restore(cg);
}
开发者ID:pixelspark,项目名称:corespark,代码行数:14,代码来源:tjgraphics-cairo.cpp

示例7: DrawBevel

/*
** Draws a bevel inside the given area
*/
void Meter::DrawBevel(Graphics& graphics, const Rect& rect, const Pen& light, const Pen& dark)
{
    int l = rect.GetLeft();
    int r = rect.GetRight() - 1;
    int t = rect.GetTop();
    int b = rect.GetBottom() - 1;

    graphics.DrawLine(&light, l,     t,     l,     b);
    graphics.DrawLine(&light, l,     t,     r,     t);
    graphics.DrawLine(&light, l + 1, t + 1, l + 1, b - 1);
    graphics.DrawLine(&light, l + 1, t + 1, r - 1, t + 1);
    graphics.DrawLine(&dark,  l,     b,     r,     b);
    graphics.DrawLine(&dark,  r,     t,     r,     b);
    graphics.DrawLine(&dark,  l + 1, b - 1, r - 1, b - 1);
    graphics.DrawLine(&dark,  r - 1, t + 1, r - 1, b - 1);
}
开发者ID:Rivolvan,项目名称:rainmeter,代码行数:19,代码来源:Meter.cpp

示例8: LockBits

bool Bitmap::LockBits(const Rect& rc, bool write, BitmapData* data) {
    Gdiplus::BitmapData* bd = reinterpret_cast<Gdiplus::BitmapData*>(data->_private);
    Gdiplus::Bitmap* gdiBitmap = dynamic_cast<Gdiplus::Bitmap*>(reinterpret_cast<Gdiplus::Image*>(_private));
    Gdiplus::Rect gdiRect(rc.GetLeft(), rc.GetTop(), rc.GetWidth(), rc.GetHeight());
    return gdiBitmap->LockBits(&gdiRect, write ? Gdiplus::ImageLockModeWrite : Gdiplus::ImageLockModeRead, PixelFormat32bppARGB, bd) == Gdiplus::Ok;
}
开发者ID:pixelspark,项目名称:corespark,代码行数:6,代码来源:tjgraphics-gdiplus.cpp


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