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


C++ DrawingContext::ConvertToScreenForDrawing方法代码示例

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


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

示例1: sizeof

static void
draw_polygon(void* _context, size_t numPoints, const BPoint viewPoints[],
	bool isClosed, bool fill)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);

	if (numPoints == 0)
		return;

	const size_t kMaxStackCount = 200;
	char stackData[kMaxStackCount * sizeof(BPoint)];
	BPoint* points = (BPoint*)stackData;
	if (numPoints > kMaxStackCount) {
		points = (BPoint*)malloc(numPoints * sizeof(BPoint));
		if (points == NULL)
			return;
	}

	context->ConvertToScreenForDrawing(points, viewPoints, numPoints);

	BRect polyFrame;
	get_polygon_frame(points, numPoints, &polyFrame);

	context->GetDrawingEngine()->DrawPolygon(points, numPoints, polyFrame,
		fill, isClosed && numPoints > 2);

	if (numPoints > kMaxStackCount)
		free(points);
}
开发者ID:simonsouth,项目名称:haiku,代码行数:29,代码来源:ServerPicture.cpp

示例2:

static void
stroke_line(void* _context, const BPoint& _start, const BPoint& _end)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
	BPoint start = _start;
	BPoint end = _end;

	context->ConvertToScreenForDrawing(&start);
	context->ConvertToScreenForDrawing(&end);
	context->GetDrawingEngine()->StrokeLine(start, end);

	context->CurrentState()->SetPenLocation(_end);
	// the DrawingEngine/Painter does not need to be updated, since this
	// effects only the view->screen coord conversion, which is handled
	// by the view only
}
开发者ID:simonsouth,项目名称:haiku,代码行数:16,代码来源:ServerPicture.cpp

示例3: p

static void
pop_state(void* _context)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
	context->PopState();

	BPoint p(0, 0);
	context->ConvertToScreenForDrawing(&p);
	context->GetDrawingEngine()->SetDrawState(context->CurrentState(),
		(int32)p.x, (int32)p.y);
}
开发者ID:simonsouth,项目名称:haiku,代码行数:11,代码来源:ServerPicture.cpp

示例4: rect

static void
draw_arc(void* _context, const BPoint& center, const BPoint& radii,
	float startTheta, float arcTheta, bool fill)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);

	BRect rect(center.x - radii.x, center.y - radii.y,
		center.x + radii.x - 1, center.y + radii.y - 1);
	context->ConvertToScreenForDrawing(&rect);
	context->GetDrawingEngine()->DrawArc(rect, startTheta, arcTheta, fill);
}
开发者ID:simonsouth,项目名称:haiku,代码行数:11,代码来源:ServerPicture.cpp

示例5: bitmap

static void
draw_pixels(void* _context, const BRect& src, const BRect& _dest, uint32 width,
	uint32 height, size_t bytesPerRow, color_space pixelFormat, uint32 options,
	const void* data, size_t length)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);

	UtilityBitmap bitmap(BRect(0, 0, width - 1, height - 1),
		(color_space)pixelFormat, 0, bytesPerRow);

	if (!bitmap.IsValid())
		return;

	memcpy(bitmap.Bits(), data, std::min(height * bytesPerRow, length));

	BRect dest = _dest;
	context->ConvertToScreenForDrawing(&dest);
	context->GetDrawingEngine()->DrawBitmap(&bitmap, src, dest, options);
}
开发者ID:simonsouth,项目名称:haiku,代码行数:19,代码来源:ServerPicture.cpp

示例6: offset

void
ShapePainter::Draw(BRect frame, bool filled)
{
	// We're going to draw the currently iterated shape.
	// TODO: This can be more efficient by skipping the conversion.
	int32 opCount = fOpStack.size();
	int32 ptCount = fPtStack.size();

	if (opCount > 0 && ptCount > 0) {
		int32 i;
		uint32* opList = new(std::nothrow) uint32[opCount];
		if (opList == NULL)
			return;

		BPoint* ptList = new(std::nothrow) BPoint[ptCount];
		if (ptList == NULL) {
			delete[] opList;
			return;
		}

		for (i = opCount - 1; i >= 0; i--) {
			opList[i] = fOpStack.top();
			fOpStack.pop();
		}

		for (i = ptCount - 1; i >= 0; i--) {
			ptList[i] = fPtStack.top();
			fPtStack.pop();
		}

		BPoint offset(fContext->CurrentState()->PenLocation());
		fContext->ConvertToScreenForDrawing(&offset);
		fContext->GetDrawingEngine()->DrawShape(frame, opCount, opList,
			ptCount, ptList, filled, offset, fContext->Scale());

		delete[] opList;
		delete[] ptList;
	}
}
开发者ID:simonsouth,项目名称:haiku,代码行数:39,代码来源:ServerPicture.cpp


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