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


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

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


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

示例1:

static void
move_pen_by(void* _context, const BPoint& delta)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
	context->CurrentState()->SetPenLocation(
		context->CurrentState()->PenLocation() + delta);
}
开发者ID:simonsouth,项目名称:haiku,代码行数:7,代码来源:ServerPicture.cpp

示例2: style

static void
set_font_style(void* _context, const char* _style, size_t length)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
	BString style(_style, length);

	ServerFont font(context->CurrentState()->Font());

	FontStyle* fontStyle = gFontManager->GetStyle(font.Family(), style);

	font.SetStyle(fontStyle);
	context->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
}
开发者ID:simonsouth,项目名称:haiku,代码行数:13,代码来源: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: family

static void
set_font_family(void* _context, const char* _family, size_t length)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
	BString family(_family, length);

	FontStyle* fontStyle = gFontManager->GetStyleByIndex(family, 0);
	ServerFont font;
	font.SetStyle(fontStyle);
	context->CurrentState()->SetFont(font, B_FONT_FAMILY_AND_STYLE);
}
开发者ID:simonsouth,项目名称:haiku,代码行数:11,代码来源:ServerPicture.cpp

示例5: new

static void
clip_to_picture(void* _context, int32 pictureToken, const BPoint& where,
	bool clipToInverse)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);

	ServerPicture* picture = context->GetPicture(pictureToken);
	if (picture == NULL)
		return;

	AlphaMask* mask = new(std::nothrow) AlphaMask(
		picture, clipToInverse, where, *context->CurrentState());
	context->SetAlphaMask(mask);
	context->UpdateCurrentDrawingRegion();
	if (mask != NULL)
		mask->ReleaseReference();

	picture->ReleaseReference();
}
开发者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::CurrentState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。